# $HeadURL$ $LastChangedRevision$ ifndef METHOD_COPY_MK METHOD_COPY_MK = 1 # Variables (needed by method-*.mk in pass #1 and the file-*.mk in pass #0) MAKEFILE_COPY_RECIPES = $(PCMS_STATE_PREFIX)/makefiles/copy-recipes.mk MAKEFILE_COPY_FILES = $(PCMS_STATE_PREFIX)/makefiles/copy-files.mk # Generate all recipes and recipe list (but they not be used by pass #0) ifeq ($(PCMS_PASS_NUM),1) all.facility: all.copy # Check symbols we'll use in recipes below. $(eval $(call check_var_set,FILESPATH)) all.copy: force-execution-each-time msg --progname=$(PROGNAME) --debug=$(VERBOSELEVEL) debug 10 "$@: generating $(MAKEFILE_COPY_RECIPES) ..." mkdir -p $(dir $(MAKEFILE_COPY_RECIPES)) set -e; \ for X in $(patsubst %.copy,%,$(filter %.copy,$^)); 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 \ echo "$$X.copy: $$DECODED_X $$D$$DECODED_X"; \ echo " mkdir -p \"$$(dirname $$DECODED_X)\""; \ echo " cp -a $$D$$DECODED_X $$DECODED_X"; \ echo " touch \$$@"; \ echo "$$DECODED_X: ;"; \ else \ echo "$$X.copy:"; \ echo " msg --progname=\$$(PROGNAME) --debug=\$$(VERBOSELEVEL) error \"$$X: none of the possible sources of this file exist\""; \ fi; \ echo; \ done > $(MAKEFILE_COPY_RECIPES) # msg --progname=$(PROGNAME) --debug=$(VERBOSELEVEL) debug 10 "$@: generating $(MAKEFILE_COPY_FILES) ..." mkdir -p $(dir $(MAKEFILE_COPY_FILES)) echo "COPY_FILES = $(filter %.copy,$^)" > $(MAKEFILE_COPY_FILES) # Stop descent %.copy: ; # 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_COPY_RECIPES) include $(MAKEFILE_COPY_FILES) # ... but it's up to the associated file-*.mk to demand that # $(COPY_FILES) be built. endif # PCMS_PASS_NUM endif # METHOD_COPY_MK