对 makefile 中 $(MAKE) 的学习体会
上例子
主 Makefile内容:
SUBDIRS=foo bar baz
subdirs:
for dir in $(SUBDIRS); do\
$(MAKE) -C $$dir; \
done
当前目录下各个子目录的Makfile内容:
./foo/Makefile:
foo: @echo "foo..."
./bar/Makefile:
bar: @echo "bar..."
./baz/Makefile:
baz: @echo "baz..."
执行结果:
for dir in foo bar baz;do\
make -C $dir; \
done
make[1]:Entering directory '/soft/gao/test/foo'
foo...
make[1]:Leaving directory '/soft/gao/test/foo'
make[1]:Entering directory '/soft/gao/test/bar'
bar...
make[1]:Leaving directory '/soft/gao/test/bar'
make[1]:Entering directory '/soft/gao/test/baz'
baz...
make[1]:Leaving directory '/soft/gao/test/baz'