I have a large project which uses a recursive autotools structure. Most of the build time is spent on a single directory within this, so I want to make that directory build in parallel. I've found documentation related to make's -j
option to enable parallel building, but the question is, where should I specify -j
in my Makefile.am
for the directory I am building?
I understand that it's better to use a non-recursive structure for parallel building, but that's too big a job for now, and I'm hoping there's still a way to make this one directory build in parallel.
It is not your task as a maintainer to specify the level of parallelism of the build, because it depends on the machine you are building on. Often passing the number of CPUs to -j
is a good idea, but not always. What is supposed to happen is that a user just runs make
with the appropriate -j
flag. If you also happen to be that user and you are tired of passing -j
explicitly all the time, then
export MAKEFLAGS=-j2
from your shell profile (e.g. .bashrc
) and have make
always consider this option.