【发布时间】:2019-07-25 19:07:19
【问题描述】:
这个问题是在 MadScientist 的回答之后编辑的。查看原始 makefile 的历史记录,但问题仍然存在。
我有一个小的 makefile:
DEPFLAGS=-MD -Mo $(OUTDIR)/$*.Td
POSTCOMPILE=@mv -f $(OUTDIR)/$*.Td $(OUTDIR)/$*.d && touch $@
VPATH=../src
OUTDIR=../out
SOURCES:=$(notdir $(wildcard ../src/*.c))
OBJECTS:=$(SOURCES:%.c=$(OUTDIR)/%.o)
all: $(OBJECTS) $(OBJECTS:%.o=%.d)
$(OUTDIR)/%.o : %.c
$(OUTDIR)/%.o : %.c $(OUTDIR)/%.d
@$(CC) $(DEPFLAGS) -c $< -o $@
@$(POSTCOMPILE)
$(OUTDIR)/%.d : ;
.PRECIOUS: $(OUTDIR)/%.d
目录结构如下:
src
contains file.c
out
empty, after make: contains file.o and file.d
make
contains the makefile
当我调用 makefile 时,一切正常,并生成了两个文件:file.o 和 file.d
但是,当我删除 file.d 时,什么也没有发生。我希望 make 找到 file.c 的缺失依赖项并开始重建。为什么没有发生?
Make 版本是为 Windows 7 下的 i386-pc-mingw32 构建的 3.81。
【问题讨论】:
标签: makefile