|
I have occasionally had situations where I wanted to include the
output of one MSI substitutions file when expanding another. To
get the effect of a nested loop, or when I want one repeated
section to be included in two final .db files.
In trying to make this work, I have continually struggled to get
complete dependency lists for Make. Below is the outcome of my
most recent iteration, which is hopefully closer to correct.
To make up an example, suppose I have three files:
- top.substitutions (includes 'middle.db')
- middle.substitutions (includes 'leaf.template')
- leaf.template
I want to install only 'top.db'. My Makefile would now look
like:
TOP=../..
include $(TOP)/configure/CONFIG
DB += top.db
DBDDEPENDS_FILES += middle.db$(DEP)
include $(TOP)/configure/RULES
top.db$(DEP): $(COMMON_DIR)/middle.db
The two special lines, in order of effect:
top.db$(DEP): $(COMMON_DIR)/middle.db
This establishes the initial dependency. The '.db$(DEP)' target
is needed as the MSI dependency creation rule requires 'middle.db'
to exist.
I do not find it necessary to have an explicit dependency
"$(COMMON_DIR)/top.db: $(COMMON_DIR)/middle.db" for a clean build
to succeed, but I am not certain why. Is "$(DEP)" file creation
somehow ordered first? Or have I just been lucky so far?
Of course this dependency will appear in 'top.db$(DEP)' when it
is created. So no problem for incremental rebuild.
DBDDEPENDS_FILES += middle.db$(DEP)
For correct incremental rebuild, this assignment is necessary to
include the '.db$(DEP)'. Otherwise it is created, but not used.
This can be verified by "make -C O.$(T_A) PRINT.DBDDEPENDS_FILES"
to see that both '.db$(DEP)' are listed. And by patient
inspection of the output of: "remake -C O.$(T_A) -p".
|