Skip to content

Commit

Permalink
Cleaned up make file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerbecky committed Aug 18, 2024
1 parent 5ed60d4 commit 5700178
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions makeprojects/makefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from .config import _MAKEFILE_MATCH
from .watcom_util import get_custom_list, get_output_list

# List of IDES this module supports
# IDEs supported by this generator
SUPPORTED_IDES = (IDETypes.make,)

# Command to delete the bin folder if it's empty
Expand Down Expand Up @@ -714,15 +714,15 @@ def write_test_variables(self, line_list):
line_list.extend((
"",
"#",
"# Required environment variables",
"# Test for required environment variables",
"#"
))
for variable in variable_list:
line_list.extend((
"",
"ifndef " + variable,
("$(error the environment variable {} "
"was not declared)").format(variable),
("$(error The environment variable {} "
"was not declared with a value)").format(variable),
"endif"
))
return 0
Expand Down Expand Up @@ -1161,8 +1161,9 @@ def write_all_target(self, line_list):
"#",
""
))
items = " ".join(source_list)
line_list.append(items + ": ;")
for item in source_list:
line_list.append(item + " \\")
line_list.append("\t: ;")

line_list.extend((
"",
Expand Down Expand Up @@ -1306,8 +1307,10 @@ def write_builds(self, line_list):

# Invoke the proper linker for a library or exe
if configuration.project_type is ProjectTypes.library:
line_list.append("\t@echo Creating library...")
line_list.append("\t@ar -rcs $@ $(OBJS)")
else:
line_list.append("\t@echo Performing link...")
line_list.append(
"\t@$(LINK) -o $@ $(OBJS) "
"$(LFlags$(CONFIG)$(TARGET))")
Expand Down Expand Up @@ -1336,6 +1339,10 @@ def write_builds(self, line_list):
line_list.append(item.format(deploy_folder, binary_name))

line_list.extend((
"",
"#",
"# Speed up make by telling it to ignore these extensions",
"#",
"",
"%.d: ;",
"",
Expand Down Expand Up @@ -1375,6 +1382,7 @@ def generate(self, line_list=None):
line_list = []

self.write_header(line_list)
self.write_test_variables(line_list)
self.write_output_list(line_list)
self.write_default_goal(line_list)
self.write_phony_targets(line_list)
Expand All @@ -1389,7 +1397,6 @@ def generate(self, line_list=None):

# Write out the records that are only value if
# TARGET and CONFIG are set
self.write_test_variables(line_list)
self.write_configurations(line_list)
self.write_source_dir(line_list)
self.write_rules(line_list)
Expand Down

0 comments on commit 5700178

Please sign in to comment.