主makefile在子目录中运行make文件 [英] Master makefile which runs make files in subdirectories
本文介绍了主makefile在子目录中运行make文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建一个makefile,它将启动所有子目录中的所有make文件.是否可以在主makefile的主目录上运行"make",从而自动触发子目录的make?
How do I go about creating a makefile that will launch all the make files in all the sub-directories. Is it possible run "make" on the main directory for the main makefile, which will automatically trigger the makes for the sub-directories?
示例:
/makefile (this is the main makefile)
/subdirectory1/makefile
/subdirectory1/various .c/.h files compiled by the makefile in this directory
/subdirectory2/makefile
/subdirectory2/various .c/.h files compiled by the makefile in this directory
/subdirectory3/makefile
/subdirectory3/various .c/.h files compiled by the makefile in this directory
推荐答案
是的,非常简单.在主文件中:
Yes, it's pretty straightforward. In the main makefile:
all:
$(MAKE) -C subdirectory1
$(MAKE) -C subdirectory2
$(MAKE) -C subdirectory3
一旦发现问题,就会有更复杂的变化形式.
There are more sophisticated variations, once you have this down.
这篇关于主makefile在子目录中运行make文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文