Makefile: Copying files with a rule
The problem with the $(COPY_FILES)
rule is that the targets of that rule are two files that already exist, namely code/xml/schema/schema.xsd
and config.txt
. Make sees no reason to execute the rule. I'm not sure why Make doesn't execute the Anyway, [copy] a bad rule.copy
rule, but I suspect that there's a file called copy
confusing the matter.
Try this:
COPY_FILES = $(BUILD_DIR)/schema.xsd $(BUILD_DIR)/config.txt
all: $(COPY_FILES)
$(BUILD_DIR)/schema.xsd: code/xml/schema/schema.xsd
$(BUILD_DIR)/config.txt: config.txt
$(BUILD_DIR)/%:
cp -f $< $@