chiark / gitweb /
fake plastic imitation weights for XBITS==5
[moebius2.git] / Makefile
1
2
3 ALLDIMS=33 64 125 246 487 968
4 TARGETS= primer lumpy.cfm sgtatham.cfm ring.cfm \
5         minimise-33 minimise-64 \
6         $(addprefix interpolate-, $(ALLDIMS)) \
7         $(addprefix view-, $(ALLDIMS)) \
8         $(addprefix output-, $(ALLDIMS))
9 SGTATHAM=sgtatham
10
11 CWARNS= -Wall -Wwrite-strings -Wpointer-arith -Werror -Wshadow
12 CXXWARNS= $(CWARNS) -Wno-shadow -Wno-error
13
14 OPTIMISE=       -O2
15 CFLAGS_UNIPROC= -MMD $(OPTIMISE) -g $(CWARNS) $(DIMCFLAGS)
16 CXXFLAGS=       -MMD $(OPTIMISE) -g $(CXXWARNS)
17 CFLAGS=         $(CFLAGS_UNIPROC) $(NPROCCFLAGS)
18
19 LIBGSL= -lgsl -lgslcblas
20
21 o= >$@.new && mv -f $@.new $@
22
23 all:            $(TARGETS)
24
25 compute:        all
26                 $(MAKE) best-33.CFM
27                 $(MAKE) best-968.CFM
28
29 minimise:       energy.o graph.o common.o mgraph.o minimise.o half.o
30                 $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBGSL)
31
32 primer:         primer.o common.o
33                 $(CC) $(CFLAGS) -o $@ $^ $(LIBGSL)
34
35 nprocessors:    nprocessors.o common.o
36                 $(CC) $(CFLAGS_UNIPROC) -o $@ $^ $(LIBGSL)
37
38 common.o nprocessors.o: %.o: %.c
39                 $(CC) -c $(CPPFLAGS) $(CFLAGS_UNIPROC) $< -o $@
40
41 .nprocessors.make: ./nprocessors
42         set -e; n=`./nprocessors`; \
43         echo "NPROCCFLAGS := -DNPROCESSORS=$$n" $o
44
45 include .nprocessors.make
46
47
48 prime.data:     primer
49                 ./$^ $o
50
51 sgtatham.cfm:   sgtatham-regenerator prime.data $(SGTATHAM)/z.typescript
52                 ./$^ -T -o$@
53
54 lumpy.cfm: oldmoebius-converter prime.data ../moebius/ins-new ../moebius/a.out
55                 ./$^ -o$@
56
57 ring.cfm: oldmoebius-converter prime.data /dev/null ../moebius/a.out
58                 ./$^ -o$@
59
60 best-33.CFM:
61                 ./minimise-33 sgtatham.cfm -iwip-33.cfm -o$@
62
63 start-64.cfm:   best-33.CFM
64                 ./interpolate-64 -a4 $< -o$@
65
66 best-64.CFM:
67                 ./minimise-64 start-64.cfm -iwip-64.CFM -o$@
68
69 define interpolate_aa
70 best-$1.cfm:    interpolate-$1 $2
71                 ./$$< -aa $2 -o$$@
72 endef
73
74 $(eval $(call interpolate_aa,968, best-487.cfm))
75 $(eval $(call interpolate_aa,487, best-246.cfm))
76 $(eval $(call interpolate_aa,246, best-125.cfm))
77 $(eval $(call interpolate_aa,125, best-64.CFM))
78
79 view-%:         view+%.o mgraph+%.o common.o
80                 $(CC) $(CFLAGS) -o $@ $^ $(LIBGSL) -L/usr/X11R6/lib -lX11
81
82 output-%:       output+%.o mgraph+%.o common.o
83                 $(CC) $(CFLAGS) -o $@ $^ $(LIBGSL) -L/usr/X11R6/lib -lX11
84
85 interpolate-%:  interpolate+%.o mgraph+%.o common.o
86                 $(CC) $(CFLAGS) -o $@ $^ $(LIBGSL)
87
88 minimise-%:     energy+%.o graph+%.o mgraph+%.o minimise+%.o \
89                         half+%.o parallel.o common.o
90                 $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBGSL) -lpthread
91
92 # this ridiculous repetition is due to make being too lame
93
94 view+%.o: view.c
95                 $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
96
97 output+%.o: output.c
98                 $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
99
100 mgraph+%.o: mgraph.c
101                 $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
102
103 minimise+%.o: minimise.c
104                 $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
105
106 graph+%.o: graph.c
107                 $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
108
109 energy+%.o: energy.c
110                 $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
111
112 half+%.o: half.c
113                 $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
114
115 interpolate+%.o: interpolate.c
116                 $(CC) -c $(CPPFLAGS) $(CFLAGS) -DDEFSZ=$* $< -o $@
117
118 .PRECIOUS: view+%.o output+%.o mgraph+%.o interpolate+%.o
119
120 clean:
121                 rm -f prime.data $(TARGETS)
122                 rm -f *.o *.new *.tmp *.rej *.orig core vgcore.* *~
123                 rm -f *.d *.cfm
124
125 realclean:      clean
126                 rm -f *.CFM
127
128 %.d:
129
130 -include *.d