Makefile---相同目标如何处理
如果Makefile中有多个相同的目标,它是怎么执行的?
target1: dep1 target1: dep2 cmd2 |
这种情况下,这两个相同的target1会被合并成
target1: dep1 dep2 cmd2 |
sample01:
#测试多个相同目标,是如何执行的
all: test
test: a.c a.h
test: a.c
echo "02 target" #flag the second target
echo $^ #print the second target depend
执行结果:
sample02:
#测试多个相同目标,是如何执行的
all: test
test: a.c a.h
echo "01 target" #flag the first target
echo $^ #print the first target depend
test: a.c
echo "02 target" #flag the second target
echo $^ #print the second target depend
执行结果: