对 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'


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM