GCC/Make Build Time Optimizations

前端 未结 10 664
鱼传尺愫
鱼传尺愫 2021-02-02 01:22

We have project which uses gcc and make files. Project also contains of one big subproject (SDK) and a lot of relatively small subprojects which use that SDK and some shared fra

10条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-02 02:18

    You could consider switching to a different build system (which obviously won't work for everyone), such as SCons. SCons is much smarter than make. It automatically scans header dependencies, so you always have the smallest set of rebuild dependencies. By adding the line Decider('MD5-timestamp') to your SConstruct file, SCons will first look at the time stamp of a file, and if it's newer than the previously built time stamp, it will use the MD5 of the file to make sure you actually changed something. This works not just on source files but object files as well. This means that if you change a comment, for instance, you don't have to re-link.

    The automatic scanning of header files has also ensured that I never have to type scons --clean. It always does the right thing.

提交回复
热议问题