Search code examples
gccbuildbuild-processg++makefile

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-compiled 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.


Solution

  • 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.