Makefile profiling

后端 未结 7 713
温柔的废话
温柔的废话 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:01

    Try running make with the -d flag. This will output debugging information outlining exactly what make is doing and in what order, as well as why it is doing it. I use that output to find things that I would otherwise miss, such as unintentional recursive make calls or things that are out of order and forcing certain files or parts of the source tree to be processed multiple times. My guess is that you'll be surprised at how much make is doing behind the scenes that you weren't aware of.

    One warning though. The -d option causes make to produce an obscene amount of output. You will definitely want to redirect output to a file. You terminal will thank you later.

    If you are the source hacker type, you could build a custom version of make that put a high-resolution timestamp on each line that was printed due to the -d flag. This would essentially create a timeline showing you exactly how much time make wasted on each step.

提交回复
热议问题