Fix basic makefile not issuing a job server due to variable expansion not working as expected
This commit is contained in:
parent
8ac6068b8d
commit
fd0dd378f4
@ -31,6 +31,7 @@ LANG::=$(EXT)
|
||||
MAIN_EXECUTABLE::=tester
|
||||
PRE_TARGETS::=
|
||||
POST_TARGETS::=
|
||||
CLEAN_TARGETS::=
|
||||
RELEASE?=0
|
||||
MEMCHK?=0
|
||||
|
||||
@ -58,7 +59,7 @@ else #windows
|
||||
AS::=$(MINGW_PREFIX)as
|
||||
endif #windows
|
||||
|
||||
#Put your custom targets for PRE_TARGETS and POST_TARGETS here:
|
||||
#Put your custom targets for PRE_TARGETS, POST_TARGETS, and CLEAN_TARGETS here:
|
||||
|
||||
|
||||
|
||||
@ -118,19 +119,20 @@ THIS_MAKEFILE_NAME::=$(lastword $(MAKEFILE_LIST))
|
||||
SOURCES::=$(foreach source,$(SOURCE_DIRS),$(foreach ext,$(EXT),$(wildcard $(source)/*.$(ext))))
|
||||
OBJECTS::=$(addprefix $(OBJDIR)/,$(subst \,.,$(subst /,.,$(addsuffix .o,$(SOURCES)))))
|
||||
|
||||
#generate a command to run a submake using this same makefile without printing "Entering directory" stuff
|
||||
#note: the empty line is required in this definition
|
||||
define RUN_SUBMAKE_TARGET
|
||||
@$(MAKE) --no-print-directory -f "$(THIS_MAKEFILE_NAME)" "$(1)"
|
||||
#Arguments to make submake use this makefile without "Entering directory" stuff
|
||||
SUBMAKE_ARGUMENTS::=--no-print-directory -f "$(THIS_MAKEFILE_NAME)"
|
||||
#just a variable for a newline
|
||||
define \n
|
||||
|
||||
|
||||
endef
|
||||
|
||||
#default target: run targets in PRE_TARGETS, then the main executable, then POST_TARGETS
|
||||
.PHONY: all
|
||||
all:
|
||||
$(foreach target,$(PRE_TARGETS),$(call RUN_SUBMAKE_TARGET,$(target)))
|
||||
$(call RUN_SUBMAKE_TARGET,$(MAIN_EXECUTABLE))
|
||||
$(foreach target,$(POST_TARGETS),$(call RUN_SUBMAKE_TARGET,$(target)))
|
||||
$(foreach target,$(PRE_TARGETS),@$(MAKE) $(SUBMAKE_ARGUMENTS) "$(target)"$(\n))
|
||||
@$(MAKE) $(SUBMAKE_ARGUMENTS) "$(MAIN_EXECUTABLE)"
|
||||
$(foreach target,$(POST_TARGETS),@$(MAKE) $(SUBMAKE_ARGUMENTS) "$(target)")
|
||||
|
||||
#Called in POST_TARGETS when RELEASE=1
|
||||
.PHONY: do_strip
|
||||
@ -159,6 +161,7 @@ $(DEPDIR):
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(foreach target,$(CLEAN_TARGETS),@$(MAKE) $(SUBMAKE_ARGUMENTS) "$(target)"$(\n))
|
||||
$(call rmdir,"$(DEPDIR)")
|
||||
$(call rmdir,"$(OBJDIR)")
|
||||
$(call rm,"$(MAIN_EXECUTABLE)")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user