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 copy rule, but I suspect that there's a file called copy confusing the matter. Anyway, [copy] a bad rule.

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 $< $@

Tags:

Makefile