User forums > Using Code::Blocks

custom makefile support mutliple cpus

(1/4) > >>

mattn2:
Hi,

we are looking for a way to get the amount of cpus in a codeblocks variable that can be used in the custom makefile parameters

something like:

$make -r -R -j $cpus -f $makefile $target

is something like this available?

thanks a lot
martin

dmoore:
I think per project variables is what you are looking for.

Jenna:

--- Quote from: mattn2 on October 14, 2012, 08:57:06 pm ---Hi,

we are looking for a way to get the amount of cpus in a codeblocks variable that can be used in the custom makefile parameters

something like:

$make -r -R -j $cpus -f $makefile $target

is something like this available?

thanks a lot
martin

--- End quote ---

On linux you should be able to use something like (note the backticks):

--- Quote ---$make -r -R -j `getconf _NPROCESSORS_ONLN` -f $makefile $target
--- End quote ---

dmoore:
Isn't it a bit odd that a compiler that supports multiple CPUs doesn't have a switch to detect the number of CPUs?

mattn2:
it's not the compiler, but make

on windows i could also use the env var %NUMBER_OF_PROCESSORS% - but i'm looking for a portable way to handle this.

Navigation

[0] Message Index

[#] Next page

Go to full version