Creating nested makefile

前端 未结 3 1323
独厮守ぢ
独厮守ぢ 2021-02-08 05:45

I am learning makefiles and I know how to create a simple makefile. I am moving on to nested makefiles. Here is my directory structure

/src
...makefile
         


        
3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-08 06:22

    There is a lot to be said for not doing this. Read Recursive Make Considered Harmful. Also in PDF form.

    The short short version is that recursive make effectively builds several disjoint but possibly overlapping dependency trees and can not guarantee either a correct or maximally efficient build. The problem get worse if you hope to build in parallel.

    To solve the problem you arrange an single, non-recursive make that builds a single all-spanning dependency tree which allows make to solve all the above problems.

    Example structures for non-recursive make and solutions to the several tricky problems that come up in writing them can be found in the original paper and in the answers to:

    • What is your experience with non-recursive make?
    • Recursive Make - friend or foe?

提交回复
热议问题