chiark / gitweb /
do not have threads at all if NPROCESSORS=1
[moebius2.git] / Makefile
index 9443d70dc9241974290d08ee973b243854564fba..927f45d1a8e60855abc87ebb43f1652cc1f26387 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,8 +11,6 @@ SGTATHAM=sgtatham
 CWARNS=        -Wall -Wwrite-strings -Wpointer-arith -Werror -Wshadow
 CXXWARNS= $(CWARNS) -Wno-shadow -Wno-error
 
-NPROCCFLAGS := -DNPROCESSORS=$(shell ./nprocessors)
-
 OPTIMISE=      -O2
 CFLAGS_UNIPROC=        -MMD $(OPTIMISE) -g $(CWARNS) $(DIMCFLAGS)
 CXXFLAGS=      -MMD $(OPTIMISE) -g $(CXXWARNS)
@@ -40,6 +38,13 @@ nprocessors: nprocessors.o common.o
 common.o nprocessors.o: %.o: %.c
                $(CC) -c $(CPPFLAGS) $(CFLAGS_UNIPROC) $< -o $@
 
+.nprocessors.make: ./nprocessors
+       set -e; n=`./nprocessors`; \
+       echo "NPROCCFLAGS := -DNPROCESSORS=$$n" $o
+
+include .nprocessors.make
+
+
 prime.data:    primer
                ./$^ $o