# $HeadURL$ $LastChangedRevision$ ifndef METHOD_GENERATOR_MK METHOD_GENERATOR_MK = 1 # Variables (needed by method-*.mk in pass #1 and the file-*.mk in pass #0) MAKEFILE_GENERATOR_RECIPES = $(PCMS_STATE_PREFIX)/makefiles/generator-recipes.mk MAKEFILE_GENERATOR_FILES = $(PCMS_STATE_PREFIX)/makefiles/generator-files.mk # Generate all recipes and recipe list (but they not be used by pass #0) ifeq ($(PCMS_PASS_NUM),3) all.facility: all.generator # Check symbols we'll use in recipes below. $(eval $(call check_var_set,GENERATORSPATH)) all.generator: force-execution-each-time mkdir -p $(dir $(MAKEFILE_GENERATOR_RECIPES)) set -e; \ for X in $(patsubst %.generator,%,$(filter %.generator,$^)); do \ eval "DECODED_X=$$(encode --decode $$X)"; \ echo "# $$DECODED_X"; \ FOUND=false; \ for D in $(subst :, ,$(GENERATORSPATH)); do \ [ ! -f "$$D/$${DECODED_X#/}" ] || { FOUND=true; break; }; \ done; \ if $$FOUND; then \ echo "$$X.generator:"; \ echo " $$D$$DECODED_X"; \ else \ echo "$$X.generator:"; \ echo " msg --progname=\$$(PROGNAME) --debug=\$$(VERBOSELEVEL) error \"$$X: none of the possible sources of this generator exist\""; \ fi; \ echo; \ done > $(MAKEFILE_GENERATOR_RECIPES) # mkdir -p $(dir $(MAKEFILE_GENERATOR_FILES)) echo "GENERATOR_FILES = $(filter %.generator,$^)" > $(MAKEFILE_GENERATOR_FILES) # Stop descent %.generator: ; # method-*.mk does nothing in pass #0; see the associated file-*mk. else ifeq ($(PCMS_PASS_NUM),2) # 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_GENERATOR_RECIPES) include $(MAKEFILE_GENERATOR_FILES) all.facility: $(GENERATOR_FILES) else ifeq ($(PCMS_PASS_NUM),1) include $(MAKEFILE_GENERATOR_FILES) all.copy: $(patsubst %.generator, %.copy, $(GENERATOR_FILES)) else ifeq ($(PCMS_PASS_NUM),0) # ... but it's up to the associated file-*.mk to demand that # $(GENERATOR_FILES) be built. endif # PCMS_PASS_NUM endif # METHOD_GENERATOR_MK