Linux – Is there a way to get the -j parameter from the make call?

Is there a way to get the -j parameter from the make call?… here is a solution to the problem.

Is there a way to get the -j parameter from the make call?

Let’s say I call:

make -j 5

Is there a way to get the -j parameter in my Makefile?

My goal is to call scons from Makefile A to maintain the ability to use multiple jobs to speed up compilation.

Similar to:

# The Makefile
all:
    scons -j ${GET_J_PARAMETER}

Thank you.

Footnote: I know I’d better call scons directly, but some of the developers I work on have been typing make for almost a decade, and it seems impossible for them to enter anything else to build their library….

Solution

I THINK MAKEFLAGS CONTAINS THAT INFORMATION.

Read more here GNU Make

Section 7.3 explains how to test specific parameters.

Related Problems and Solutions