# $HeadURL$ $LastChangedRevision$ ifndef METHOD_TMPLT_MK METHOD_TMPLT_MK = 1 # Variables (needed by method-*.mk in pass #1 and the file-*.mk in pass #0) MAKEFILE_TMPLT_RECIPES = $(PCMS_STATE_PREFIX)/makefiles/tmplt-recipes.mk MAKEFILE_TMPLT_FILES = $(PCMS_STATE_PREFIX)/makefiles/tmplt-files.mk # Generate all recipes and recipe list (but they not be used by pass #0) ifeq ($(PCMS_PASS_NUM),1) all: all.tmplt # Check symbols we'll use in recipes below. $(eval $(call check_var_set,FILESPATH)) # Between the lines 'PLACEHOLDERS=...' and 'VAR_INDEX=...' there was this loop: # # for PLACEHOLDER in $$PLACEHOLDERS; do \ # echo "\$$(eval \$$(call check_var_set,$$PLACEHOLDER))"; \ # done; \ # # But this was *erroneously* resulting in a message saying that # MAIL_CLIENT_RELAY_AUTHENTICATE_YESNO was not set when running the # facility-mail.mk makefile. It *really* was erreneous because the # addition of a small 'test: \n echo $(MAIL_CLIENT_RELAY_AUTHENTICATE_YESNO)' # recipe showed that it had a sensible value. # # I might come back to this, but for the time being, I have to disable # this faulty generation of checkers. # # A second problem in the same recipe: the second line in the main recipe # was: # # echo " ls $$X.tmplt.* | fgrep -vx $$X.tmplt.\$$(ASSIGNMENTS_$$VAR_INDEX) | xargs rm -f"; \ # # which was deleting old variable assignment-recording files, except for # the one I'm actually using. But it seemed to delete *also* that one # meaning that it kept repeating the recipe. all.tmplt: force-execution-each-time msg --progname=$(PROGNAME) --debug=$(VERBOSELEVEL) debug 10 "$@: generating $(MAKEFILE_TMPLT_RECIPES) ..." mkdir -p $(dir $(MAKEFILE_TMPLT_RECIPES)) set -e; \ for X in $(patsubst %.tmplt,%,$(filter %.tmplt,$^)); do \ eval "DECODED_X=$$(encode --decode $$X)"; \ echo "# $$DECODED_X"; \ FOUND=false; \ for D in $(subst :, ,$(FILESPATH)); do \ [ ! -f "$$D/$${DECODED_X#/}" ] || { FOUND=true; break; }; \ done; \ if $$FOUND; then \ PLACEHOLDERS=$$(sed -n -e '1s/^[^ ][^ ]* *//p' "$$D/$${DECODED_X#/}"); \ VAR_INDEX=$$RANDOM; \ echo "ASSIGNMENTS_$$VAR_INDEX = \$$(shell encode $$(for PLACEHOLDER in $$PLACEHOLDERS; do echo -n "$$PLACEHOLDER=\"\$$($$PLACEHOLDER)\" "; done))"; \ echo "$$X.tmplt: $$DECODED_X $$D$$DECODED_X $$X.tmplt.\$$(ASSIGNMENTS_$$VAR_INDEX)"; \ echo " mkdir -p \"$$(dirname $$DECODED_X)\""; \ echo " tmplt $$D$$DECODED_X $$DECODED_X \$$(ASSIGNMENTS_$$VAR_INDEX)"; \ echo " touch \$$@"; \ echo "$$X.tmplt.\$$(ASSIGNMENTS_$$VAR_INDEX): "; \ echo " touch \$$@"; \ echo "$$DECODED_X: ;"; \ else \ echo "$$X.tmplt:"; \ echo " msg --progname=\$$(PROGNAME) --debug=\$$(VERBOSELEVEL) error \"$$X: none of the possible sources of this file exist\""; \ fi; \ echo; \ done > $(MAKEFILE_TMPLT_RECIPES) # msg --progname=$(PROGNAME) --debug=$(VERBOSELEVEL) debug 10 "$@: generating $(MAKEFILE_TMPLT_FILES) ..." mkdir -p $(dir $(MAKEFILE_TMPLT_FILES)) echo "TMPLT_FILES = $(filter %.tmplt,$^)" > $(MAKEFILE_TMPLT_FILES) # Stop descent %.tmplt: ; # method-*.mk does nothing in pass #0; see the associated file-*mk. else ifeq ($(PCMS_PASS_NUM),0) # But, since the associated file-*.mk doesn't know what the recipe targets # depend on, tell pass #0 to acquaint itself with how to make *those* here. # (none) # But, as a courtesy, we can load the recipes and recipe list ... include $(MAKEFILE_TMPLT_RECIPES) include $(MAKEFILE_TMPLT_FILES) # ... but it's up to the associated file-*.mk to demand that # $(TMPLT_FILES) be built. endif # PCMS_PASS_NUM endif # METHOD_TMPLT_MK