我有一个 Make 文件, 如果它没有在最后一小时发生, 就可以执行任务。 它是这样做的:
HOUR_FROM_NOW = $(shell perl -e ($$s,$$m,$$h,$$d,$$M)=localtime(time()+3600); printf("%02d%02d%02d%02d
",$$M+1,$$d,$$h,$$m); )
NOW_FILE = $(shell mkdir -p .make; touch .make/now; echo .make/now )
.PHONY: externals
externals: $(PROJECTS:%=.make/proj_%)
.make/proj_%: $(NOW_FILE)
$(MAKE) -s $(*F)
touch -t $(HOUR_FROM_NOW) $@
.PHONY: $(PROJECTS)
$(PROJECTS):
# do stuff, specifically, clone git-repo if not exists, else pull latest
那部分的功过功过功,我只得听到警告:
make: Warning: File `.make/proj has modification time 3.5e+03 s in the future
make: Nothing to be done for `externals .
make: warning: Clock skew detected. Your build may be incomplete.
有人知道如何制止这些警告吗?