Makefile profiling

后端 未结 7 758
温柔的废话
温柔的废话 2020-12-24 13:23

So I have this Makefile based build system that my users feel is working too slowly. For the sake of this question lets define performance as the time it takes make to figur

7条回答
  •  粉色の甜心
    2020-12-24 14:04

    Make takes no time parsing the Makefile, nor building the DAG. I've used makefiles that $(eval...) thousands of lines of make, build a dag with many 100s of files and return almost instantly (well ok, in a second or two) when there is nothing to do.

    So where is your speed going?

    • Recurvsive make (i.e., starting another make in a shell recipe (${MAKE} blah...)) is invariably slow. (It's invariably bad too IMHO.)
    • You should eschew use of $(shell...)—Use make facilities wherever possible
    • Your Makefiles should work correctly when used with -jn (n > 1). Ensure that you tell make exactly what can be built in parallel with what. Do not use shell loops if at all possible.

提交回复
热议问题