chiark / gitweb /
use nprocessors to set -DNPROCESSORS
authorIan Jackson <ian@davenant.relativity.greenend.org.uk>
Sat, 27 Sep 2008 15:08:52 +0000 (16:08 +0100)
committerIan Jackson <ian@davenant.relativity.greenend.org.uk>
Sat, 27 Sep 2008 15:08:52 +0000 (16:08 +0100)
Makefile

index d3ddd4f..a0b643a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,9 +11,12 @@ SGTATHAM=sgtatham
 CWARNS=        -Wall -Wwrite-strings -Wpointer-arith -Werror -Wshadow
 CXXWARNS= $(CWARNS) -Wno-shadow -Wno-error
 
+NPROCCFLAGS := -DNPROCESSORS=$(shell ./nprocessors)
+
 OPTIMISE=      -O2
-CFLAGS=                -MMD $(OPTIMISE) -g $(CWARNS) $(DIMCFLAGS)
+CFLAGS_UNIPROC=        -MMD $(OPTIMISE) -g $(CWARNS) $(DIMCFLAGS)
 CXXFLAGS=      -MMD $(OPTIMISE) -g $(CXXWARNS)
+CFLAGS=                $(CFLAGS_UNIPROC) $(NPROCCFLAGS)
 
 LIBGSL= -lgsl -lgslcblas
 
@@ -32,12 +35,14 @@ primer:             primer.o common.o
                $(CC) $(CFLAGS) -o $@ $^ $(LIBGSL)
 
 nprocessors:   nprocessors.o common.o
-               $(CC) $(CFLAGS) -o $@ $^ $(LIBGSL)
+               $(CC) $(CFLAGS_UNIPROC) -o $@ $^ $(LIBGSL)
+
+common.o nprocessors.o: %.o: %.c
+               $(CC) -c $(CPPFLAGS) $(CFLAGS_UNIPROC) $< -o $@
 
 prime.data:    primer
                ./$^ $o
 
-
 sgtatham.cfm:  sgtatham-regenerator prime.data $(SGTATHAM)/z.typescript
                ./$^ -T -o$@
 
@@ -47,7 +52,6 @@ lumpy.cfm: oldmoebius-converter prime.data ../moebius/ins-new ../moebius/a.out
 ring.cfm: oldmoebius-converter prime.data /dev/null ../moebius/a.out
                ./$^ -o$@
 
-
 best-33.CFM:
                ./minimise-33 sgtatham.cfm -iwip-33.cfm -o$@