Tuesday, July 26, 2022

[SOLVED] gcc make file and parallel building

Issue

I need to pick up in the make file the number of processor used for the paralell compilation.

e.g.

make -j32 .....

I need to pick up the number 32 inside the Makefile.

I know this comes inside the variable MAKEFLAG so I could parse it, but is there some other variable that gives this information directly?

For example:

NUMCPU = 32


Solution

already solved in

GNU Make: Check number of parallel jobs

NUMPROC = $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS))



Answered By - Mariano
Answer Checked By - Senaida (WPSolving Volunteer)