Recursive make in subdirectories

前端 未结 4 746
清歌不尽
清歌不尽 2021-02-04 01:37

How can I order make command in the Makefile to execute recursively in all subdirectories make commands (defined in the Makefile in the subdirectories)

4条回答
  •  情深已故
    2021-02-04 01:55

    I will submit here my particular solution. Suppose we have a directory with many sub-directories, all of them with its own makefile:

    root-dir\
        +----subdir1
        +----subdir2
        ...
        +----subdirn
    

    then, just copy in the root-dir this Makefile:

    SUBDIRS = $(shell ls -d */)
    all:
        for dir in $(SUBDIRS) ; do \
            make -C  $$dir ; \
        done
    

提交回复
热议问题