From 1c2ee740a373958c27c819645732de529bc4e3db Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Tue, 28 Apr 2020 12:03:09 -0400 Subject: [PATCH] glue depends.mk into the boilermake framework we can't just `-include foo.la` from the source make files, as they are evaluated by the boilermake framework. Instead, we have to jump through some additional hoops --- scripts/boiler.mk | 22 ++++++++++++++++++++++ src/tests/unit/all.mk | 3 +-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/scripts/boiler.mk b/scripts/boiler.mk index edd5b50b3bd5..4304effd8e04 100644 --- a/scripts/boiler.mk +++ b/scripts/boiler.mk @@ -205,6 +205,15 @@ define ADD_TARGET_TO_ALL endef +# ADD_TARGET_TO_ALL - Parameterized "function" that adds the target, +# and makes "all" depend on it. +# +# USE WITH EVAL +# +define ADD_DEPENDS_MK + ALL_DEPENDS_MK += ${1} +endef + # ADD_TARGET_RULE.* - Parameterized "functions" that adds a new target to the # Makefile. There should be one ADD_TARGET_RULE definition for each # type of target that is used in the build. @@ -375,6 +384,7 @@ define INCLUDE_SUBMAKEFILE MAN := FILES := OUTPUT := + DEPENDS_MK := SUBMAKEFILES := @@ -509,6 +519,10 @@ define INCLUDE_SUBMAKEFILE $$(call QUALIFY_PATH,$${DIR},$${MK}))))) endif + ifneq "$${DEPENDS_MK}" "" + $$(eval $$(call ADD_DEPENDS_MK,$${DEPENDS_MK})) + endif + # Reset the "current" target to it's previous value. TGT_STACK := $$(call POP,$${TGT_STACK}) # If we're about to change targets, create the rules for the target @@ -711,6 +725,14 @@ endif $(foreach D,$(patsubst %/,%,$(sort $(dir ${ALL_INSTALL}))),\ $(eval $(call ADD_INSTALL_RULE.dir,${D}))) +# +# Now that all of the targets have been defined, include auto-build +# dependency files. +# +ifneq "$(ALL_DEPENDS_MK)" "" +-include $(ALL_DEPENDS_MK) +endif + scan: ${ALL_PLISTS} .PHONY: clean.scan diff --git a/src/tests/unit/all.mk b/src/tests/unit/all.mk index f5aae0893e38..9f9703948780 100644 --- a/src/tests/unit/all.mk +++ b/src/tests/unit/all.mk @@ -32,8 +32,7 @@ $(FILES.$(TEST)): export TZ = GMT # # Look in each file for `proto foo`, and then make that file depend in `libfreeradius-foo.a` # --include $(OUTPUT)/depends.mk - +DEPENDS_MK := $(OUTPUT)/depends.mk $(OUTPUT)/depends.mk: $(addprefix $(DIR)/,$(FILES)) | $(OUTPUT) ${Q}rm -f $@ ${Q}touch $@