-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
185 lines (124 loc) · 4.67 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Cytosim was created by Francois Nedelec. Copyright 2007-2017 EMBL.
# THIS FILE SHOULD NOT BE EDITED
# ONLY EDIT FILE makefile.inc
# disable all implicit rules:
.SUFFIXES:
#include the compiler-specifications
include makefile.inc
#-----------------check the compilers and the compiler-flags--------------------
ifndef CXX
$(error No compiler defined for $$(MACHINE)=$(MACHINE))
endif
ifndef Flags$(MODE)
$(warning No compiler options defined for $$(MACHINE)=$(MACHINE) in mode $(MODE))
endif
ifndef LINK
$(error No linkage-options defined for $$(MACHINE)=$(MACHINE))
endif
# command to invoke compiler:
COMPILE := $(CXX) $(CXXFLG) $(Flags$(MODE))
# macro to make a library:
MAKELIB = $(LIBTOOL) lib/$@ $(addprefix build/, $(notdir $^))
# macro to fix the paths of objects:
OBJECTS = $(filter %.cc, $^) $(addprefix build/, $(notdir $(filter %.o, $^))) $(addprefix lib/, $(notdir $(filter %.a, $^)))
# macro to notify that a task was completed:
DONE = printf "> > > > > > > made %s\n" $@;
SRCDIR1 := $(addprefix src/, math base sim disp play)
SRCDIR2 := $(addprefix src/sim/, spaces hands fibers singles couples organizers)
SRCDIR := $(SRCDIR1) $(SRCDIR2)
#-----------------------GIT revision number-------------------------------------
CODE_VERSION = $(shell git rev-parse --short HEAD || echo unknown)
INFO = -D'CODE_VERSION="$(CODE_VERSION)"'
#-------------------------make's search paths-----------------------------------
vpath %.h $(SRCDIR)
vpath %.c $(SRCDIR)
vpath %.cc $(SRCDIR)
vpath %.o build/
vpath %.a lib/
vpath %.dep dep/
vpath SFMT% src/math/
#----------------------------targets--------------------------------------------
# calling 'make' without arguments will make sim, play and report:
.PHONY: simplay
simplay: sim report play
info:
@echo $(MACHINE)
include src/sim/makefile.inc
include src/base/makefile.inc
include src/math/makefile.inc
include src/disp/makefile.inc
include src/play/makefile.inc
-include src/tools/makefile.inc
-include src/test/makefile.inc
# Attention: Mersenne-Twister is coded in C-language,
# and we must tell the compiler with '-x c':
SFMT.o: SFMT.c SFMT.h
$(CXX) -x c -DNDEBUG -DSFMT_MEXP=19937 -c $< -o build/$@
.PHONY: all dim1 dim2 dim3 alldim allsim doc
all: sim play tools tests
dim1: bin1/sim bin1/report bin1/play
dim2: bin2/sim bin2/report bin2/play
dim3: bin3/sim bin3/report bin3/play
alldim: dim1 dim2 dim3
allsim: bin1/sim bin2/sim bin3/sim
doc:
if test -d doc/code/doxygen; then rm -rf doc/code/doxygen; fi
mkdir doc/code/doxygen;
doxygen doc/code/doxygen.cfg > log.txt 2> /dev/null
#------------------------------- archive ---------------------------------------
.PHONY: tar tarzip tarsrc pack
tar:
COPYFILE_DISABLE=1 tar cf cytosim.tar --exclude "*.o" --exclude "*~" --exclude xcuserdata \
--exclude doxygen src makefile makefile.inc cym python doc cytosim.xcodeproj
tarzip: tar
rm -f cytosim.tar.bz2;
bzip2 cytosim.tar;
tarsrc:
COPYFILE_DISABLE=1 tar cf cytosim_src.tar --exclude "*.o" --exclude ".*" \
--exclude ".svn" --exclude "*~" src makefile makefile.inc cym python
pack: sterile tarsrc
#---------------------------- maintenance --------------------------------------
.PHONY: bin build clean cleaner sterile
bin:
if ! test -d bin; then mkdir bin; fi
bin1:
if ! test -d bin1; then mkdir bin1; fi
bin2:
if ! test -d bin2; then mkdir bin2; fi
bin3:
if ! test -d bin3; then mkdir bin3; fi
build:
if ! test -d build; then mkdir build; fi
lib:
if ! test -d lib; then mkdir lib; fi
clean:
rm -f build/*.o
rm -f lib/*.a
cleaner:
rm -f *.cmo build/*.o lib/*.a dep/*.dep;
sterile:
rm -rf build/*
rm -rf lib/*
rm -f dep/*.dep
rm -rf bin/*.dSYM
rm -rf bin/*
rm -rf bin1/*
rm -rf bin2/*
rm -rf bin3/*
rm -f *.cmo
rm -f log.txt;
#---------------------------- dependencies -------------------------------------
.PHONY: dep
#command used to build the dependencies files automatically
MAKEDEP := g++ -std=gnu++14 -MM $(addprefix -I, $(SRCDIR))
dep:
if ! test -d dep; then mkdir dep; else rm -f dep/*; fi
$(foreach file, $(wildcard src/base/*.cc), $(MAKEDEP) $(file) >> dep/part0.dep; )
$(foreach file, $(wildcard src/math/*.cc), $(MAKEDEP) $(file) >> dep/part1.dep; )
$(foreach file, $(wildcard src/sim/*.cc), $(MAKEDEP) $(file) >> dep/part2.dep; )
$(foreach file, $(wildcard src/sim/*/*.cc), $(MAKEDEP) $(file) >> dep/part3.dep; )
$(foreach file, $(wildcard src/disp/*.cc), $(MAKEDEP) $(file) >> dep/part4.dep; )
$(foreach file, $(wildcard src/play/*.cc), $(MAKEDEP) $(file) >> dep/part5.dep; )
$(foreach file, $(wildcard src/tools/*.cc), $(MAKEDEP) $(file) >> dep/part6.dep; )
$(foreach file, $(wildcard src/test/*.cc), $(MAKEDEP) $(file) >> dep/part7.dep; )
-include dep/part?.dep