开发者

Speedup GNU make build process - Parallelism?

I build a huge project frequently and this takes long time (more than one hour) to finish even after configuring pre-comp开发者_开发百科iled headers. Are their any guidelines or tricks to allow make work in parallel (e.g. starting gcc in background, ...etc) to allow for faster builds?

Note: Sources and binaries are too large in size to be placed in a ram file system and I don't want to change the directory structure or build philosophy.


You can try

make -j<number of jobs to run in parallel>


make -jN is a must now that most machines are multi-core. If you don't want to write -jN each time, you can put

export MAKEFLAGS=-jN

in your .bashrc.

You may also want to checkout distcc.


If your project is becoming too big for one machine to handle, you can use one of the distributed make replacements, such as Electric Cloud.


If you want to run your build in parallel,

make -jN

does the job, but keep in mind:

  1. N should be equal to the maximum number of threads your machine supports, if you enter a number greater than that, make automatically makes N=maximum number of threads your machine supports
  2. make doesn't support parallel build using -jN in MSDOS, it just does a serial build. If you specify -jN, it will downgrade N=1.

Read more here, from the make source: http://cmdlinelinux.blogspot.com/2014/04/parallel-build-using-gnu-make-j.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜