【发布时间】:2015-07-05 05:22:47
【问题描述】:
我正在研究从编译器课程项目中获得的 Makefile。这里只粘贴了一部分。
# Retain intermediate bitcode files
.PRECIOUS: %.bc
# The default target builds the plugin
plugin:
make -C lib/p1
# create .bc from source
%.bc: %.c
clang -emit-llvm -O0 -c $*.c -o $*.bc
# run printCode on a .bc file
%.printCode: %.bc plugin
opt -load Debug/lib/P1.so -printCode $*.bc
如您所见,目标“插件”没有依赖关系,如果我理解正确,这应该意味着它的配方永远不会运行(除非它被声明为虚假目标,这里不是这种情况)
但是,当我键入“make printCode”时(printCode 是列表中的最后一个目标),插件目标会执行。这怎么可能?是否有一些隐含的规则表明 Makefile 的第一个目标被视为虚假目标,例如“all”?
【问题讨论】:
标签: makefile