I use the following in my script to find how many available cores I can use.
This is for Linux:
JavaScript
x
NPROCS = $(shell grep -c 'processor' /proc/cpuinfo)
This is for Mac (darwin):
JavaScript
NPROCS = $(shell sysctl -n hw.ncpu)
How should it be in Windows?
Advertisement
Answer
You can use one of those commands:
JavaScript
c:wmic cpu get NumberOfCores, NumberOfLogicalProcessors/Format:List
NumberOfCores=6
NumberOfLogicalProcessors=12
NumberOfCores=6
NumberOfLogicalProcessors=12
(here you have two physical processors)
Or as suggested in comments:
JavaScript
c:echo %NUMBER_OF_PROCESSORS%
24
In Makefile the record should be something like:
JavaScript
NPROCS = $(shell echo %NUMBER_OF_PROCESSORS%)
P.S. And the commands you write in question are wrong! You must remove space around =