如何复制文件并保留gnu makefile中的结构?

时间:2014-04-07 08:48:27

标签: makefile

例如,给定当前目录中的文件列表,如何将文件复制到另一个目录中。

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

如何将文件列表复制到目标目录?

1 个答案:

答案 0 :(得分:0)

.PHONY: copy_files

copy_files: $(xpi_built)
    @mkdir -p $(dest_dir)
    @cp $^ $(dest_dir)