1

我该如何创建一个makefile,它将启动所有子目录中的所有make文件。是否可以在主makefile的主目录上运行“make”,这将自动触发子目录的make?

例子:

/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
4

1 回答 1

3

是的,这很简单。在主生成文件中:

all:
    $(MAKE) -C subdirectory1
    $(MAKE) -C subdirectory2
    $(MAKE) -C subdirectory3

一旦你把它弄下来,就会有更复杂的变化。

于 2012-10-10T02:23:05.447 回答