例如,给定当前目录中的文件列表,如何将这些文件复制到另一个目录中。
dest_dir := /usr/bin/test
.PHONY: install
install: $(dest_dir)
#there files are in current directory
xpi_built := install.rdf \
chrome.manifest \
$(wildcard content/*.js) \
$(wildcard content/*.xul) \
$(wildcard content/*.xml) \
$(wildcard content/*.css) \
$(wildcard skin/*.css) \
$(wildcard skin/*.png) \
$(wildcard locale/*/*.dtd) \
$(wildcard locale/*/*.properties)
#how to copy there files to another directory
$(dest_dir)/% : $(xpi_built)
@mkdir -p $(dest_dir)
@cp $< $@
我该如何将文件列表复制到目标目录中?
$(dest_dir)/.copyfiles: $(xpi_built)
,其中最后一条规则是touch $@
。$(dest_dir)/.copyfiles
文件将带有日期,因此仅在构建的文件之一更新时才会更新。此外,如果你删除了 $(dest_dir),它将重新运行。 - John