Skip to content

Commit

Permalink
glue depends.mk into the boilermake framework
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alandekok committed Apr 28, 2020
1 parent 5f62997 commit 1c2ee74
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
22 changes: 22 additions & 0 deletions scripts/boiler.mk
Expand Up @@ -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.
Expand Down Expand Up @@ -375,6 +384,7 @@ define INCLUDE_SUBMAKEFILE
MAN :=
FILES :=
OUTPUT :=
DEPENDS_MK :=

SUBMAKEFILES :=

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/tests/unit/all.mk
Expand Up @@ -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 $@
Expand Down

0 comments on commit 1c2ee74

Please sign in to comment.