【发布时间】:2010-09-27 16:24:24
【问题描述】:
我正在尝试创建一个 Makefile,它将下载和处理文件以生成目标文件,这是一个简化版本:
default: all
.PHONY: all clean filelist.d
clean:
@rm -fv *.date *.d
#The actual list comes from a FTP file, but let's simplify things a bit
filelist.d:
@echo "Getting updated filelist..."
@echo "LIST=$(shell date +\%M)1.date $(shell date +\%M)2.date" > $@
@echo 'all: $$(LIST)' >> $@
%.date:
touch $@
-include filelist.d
不幸的是,目标 all 在第一次运行时没有正确更新,需要再次运行才能获取文件。这是我从中得到的输出:
$ make
Getting updated filelist...
make: Nothing to be done for `default'.
$ make
Getting updated filelist...
touch 141.date
touch 142.date
touch 143.date
我正在使用 GNU Make 3.81,其文档指出,如果包含的文件发生更改,它将重新加载整个内容。出了什么问题?
【问题讨论】: