-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
272 lines (211 loc) · 7.93 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# get the system name
SYSTEM = $(shell uname)
# change this in shell to -g for debug
OPT_FLAGS ?= -O3 -ffast-math
EXTRA_FLAGS ?=
ifeq ($(SYSTEM),IRIX64)
# IRIX 6.x with new 32-bit libraries
CXX = CC -LANG:std
CXXFLAGS = -fullwarn -n32 -ptused $(OPT_FLAGS) $(EXTRA_FLAGS)
INC_DIRS = -I$(HOME)/src/libxml2-2.6.2/include -I/usr/local/include
OPENGL_LIBS = -L/usr/share/src/OpenGL/toolkits/lib32 -L$(GLUI_DIR) \
-lglui -lglut -lGLU -lGL -lX11 -lXmu
OPENGL_INC = -I/usr/include/GL -I/usr/share/src/OpenGL/toolkits/include/GL \
-I/usr/share/src/OpenGL/toolkits/include -I$(GLUI_DIR)
SOCKET_LIBS = -L/usr/local/lib -lptypes
LIBS = -L$(HOME)/src/libxml2-2.6.2/.libs
endif
ifeq ($(SYSTEM),Linux)
# GNU compiler flags
CXX = g++
CXXFLAGS = -Wall -fexceptions $(OPT_FLAGS) $(EXTRA_FLAGS)
INC_DIRS = -I${HOME}/Unix/include -I${HOME}/Unix/include/libxml2
LIBS = -L${HOME}/Unix/lib
# extras for Beowulf compilation
ifeq ($(HOSTNAME),ulgbc1.liv.ac.uk)
OPT_FLAGS += -march=k6
SOCKET_LIBS = -L$(HOME)/src/ptypes-1.8.3/lib -lptypes
LIBS = -L$(HOME)/src/libxml2-2.6.2/.libs
INC_DIRS = -I$(HOME)/src/ptypes-1.8.3/include -I$(HOME)/src/libxml2-2.6.2/include
endif
ifeq ($(HOSTNAME),microlith)
#OPT_FLAGS += -march=opteron
SOCKET_LIBS = -L$(HOME)/src/ptypes-2.0.2/lib -lptypes
LIBS = -L$(HOME)/src/libxml2-2.6.2/.libs -L$(HOME)/src/cvs-1.11.5/zlib
INC_DIRS = -I$(HOME)/src/ptypes-2.0.2/include -I$(HOME)/src/libxml2-2.6.2/include
EXTRA_FLAGS += -DUSING_64_BIT_POINTERS
endif
OPENGL_LIBS = -L/usr/X11R6/lib -L$(GLUI_DIR) \
-lglui -lglut -lGLU -lGL -lXmu -lXi -lX11
OPENGL_INC = -I/usr/X11R6/include -I/usr/X11R6/include/GL -I/usr/include/GL -I$(GLUI_DIR)
# set the memory debugging library
# LIBS += -lefence
endif
ifeq ($(SYSTEM),SunOS)
# GNU compiler flags
CXX = g++
CXXFLAGS = -Wall -fexceptions $(OPT_FLAGS) $(EXTRA_FLAGS)
INC_DIRS = -I$(HOME)/include
SOCKET_LIBS = -L$(HOME)/lib -lptypes -lsocket -lnsl -lrt
endif
ifeq ($(SYSTEM),Darwin)
# GNU compiler flags (works with g++ and egcs)
CXX = c++
CXXFLAGS = -Wall -fexceptions $(OPT_FLAGS) $(EXTRA_FLAGS) -DUPDATE_CONTROLS_ON_IDLE -DUSE_LIBTIFF -DUSE_TIFF_LZW
# suggested by linker
LDFLAGS = -Xlinker -bind_at_load
INC_DIRS = -I/usr/local/include/libxml2
OPENGL_LIBS = -L$(GLUI_DIR) -L$(GLUT_DIR)/lib -L/usr/X11R6/lib \
-lglui -lglut -lGLU -lGL -lXmu -lXext -lX11
OPENGL_INC = -I$(GLUI_DIR) \
-I$(GLUT_DIR)/include -I$(GLUT_DIR)/include/GL \
-I/usr/X11R6/include -I/usr/X11R6/include/GL
GLUT_DIR = /usr/local
LIBS = -ltiff
# set the memory debugging library
#LIBS = -lMallocDebug
endif
ifeq ($(SYSTEM),CYGWIN_NT-5.1)
# GNU compiler flags
CXX = c++
CXXFLAGS = -Wall -fexceptions $(OPT_FLAGS) $(EXTRA_FLAGS)
INC_DIRS = -I/usr/include/libxml2
OPENGL_LIBS = -L$(GLUI_DIR) -L$(GLUT_DIR)/lib -L/usr/X11R6/lib \
-lglui -lglut -lGLU -lGL -lXmu -lXext -lX11
OPENGL_INC = -I/usr/include/GL -I$(GLUI_DIR) \
-I/usr/X11R6/include -I/usr/X11R6/include/GL
SOCKET_LIBS = -L/usr/local/lib -lptypes
endif
# generic library and include definitions
DYN_DIR = dynamechs_4.0pre1
GLUI_DIR = glui_v2_1_beta
DYN_LIBS = $(DYN_DIR)/dm/libdm.a
DYN_INC = -I$(DYN_DIR)/dm
DYN_LIBS_OPENGL = $(DYN_DIR)/dm/libdm_opengl.a
SOCKET_LIBS ?= -lptypes
LIBS += -L/usr/local/lib -lxml2 -lpthread -lm -lz
SYMCCFILES = \
CyclicDriver.cc LoadObj.cc MyRevoluteLink.cc Simulation.cc \
DampedSpringStrap.cc MAMuscle.cc ObjectiveMain.cc StrapForce.cc \
DataFile.cc ModifiedContactModel.cc Random.cc StrapForceAnchor.cc \
GLUIRoutines.cc MyMobileBaseLink.cc SideStabilizer.cc Util.cc \
StepDriver.cc DataTarget.cc UGMMuscle.cc TIFFWrite.cc \
MyEnvironment.cc
SYMOBJECTS = $(addsuffix .o, $(basename $(SYMCCFILES) ) )
vpath %.cc src ga merge utils
BINARIES = bin/objective bin/objective_opengl \
bin/objective_socket bin/objective_socketgl \
bin/ga bin/ga_socket \
bin/merge \
bin/CalcPhase bin/ParseContactDebug bin/ParseMAMuscleDebug \
bin/ApplyGenome
BINARIES_NO_OPENGL = bin/objective \
bin/objective_socket \
bin/ga bin/ga_socket \
bin/merge \
bin/CalcPhase bin/ParseContactDebug bin/ParseMAMuscleDebug \
bin/ApplyGenome
all: directories libraries binaries
no_opengl: directories libraries binaries_no_opengl
directories: bin obj obj/obj obj/opengl obj/socket obj/socketgl \
obj/ga_obj obj/ga_socket \
obj/merge \
obj/utils
binaries: $(BINARIES)
binaries_no_opengl: $(BINARIES_NO_OPENGL)
libraries: dynamechs glui
obj/obj:
mkdir obj/obj
obj/opengl:
mkdir obj/opengl
obj/socket:
mkdir obj/socket
obj/socketgl:
mkdir obj/socketgl
bin:
mkdir bin
obj:
mkdir obj
obj/ga_obj:
mkdir obj/ga_obj
obj/ga_socket:
mkdir obj/ga_socket
obj/merge:
mkdir obj/merge
obj/utils:
mkdir obj/utils
obj/obj/%.o : %.cc
$(CXX) $(CXXFLAGS) $(DYN_INC) $(INC_DIRS) -c $< -o $@
bin/objective: $(addprefix obj/obj/, $(SYMOBJECTS) )
$(CXX) $(LDFLAGS) -o $@ $^ $(DYN_LIBS) $(LIBS)
obj/opengl/%.o : %.cc
$(CXX) -DUSE_OPENGL $(CXXFLAGS) $(DYN_INC) $(INC_DIRS) $(OPENGL_INC) -c $< -o $@
bin/objective_opengl: $(addprefix obj/opengl/, $(SYMOBJECTS) )
$(CXX) $(LDFLAGS) -o $@ $^ $(DYN_LIBS_OPENGL) $(OPENGL_LIBS) $(LIBS)
obj/socket/%.o : %.cc
$(CXX) -DUSE_SOCKETS $(CXXFLAGS) $(DYN_INC) $(INC_DIRS) -c $< -o $@
bin/objective_socket: $(addprefix obj/socket/, $(SYMOBJECTS) )
$(CXX) $(LDFLAGS) -o $@ $^ $(DYN_LIBS) $(SOCKET_LIBS) $(LIBS)
obj/socketgl/%.o : %.cc
$(CXX) -DUSE_SOCKETS -DUSE_OPENGL $(CXXFLAGS) $(DYN_INC) $(OPENGL_INC) $(INC_DIRS) -c $< -o $@
bin/objective_socketgl: $(addprefix obj/socketgl/, $(SYMOBJECTS) )
$(CXX) $(LDFLAGS) -o $@ $^ $(DYN_LIBS_OPENGL) $(SOCKET_LIBS) $(OPENGL_LIBS) $(LIBS)
clean:
rm -rf obj bin
rm -f *~ *.bak *.bck *.tmp *.o
( cd src; rm -f *~ *.bak *.bck *.tmp *.o )
( cd ga; rm -f *~ *.bak *.bck *.tmp *.o )
( cd merge; rm -f *~ *.bak *.bck *.tmp *.o )
superclean:
rm -rf obj bin
rm -f *~ *.bak *.bck *.tmp *.o
( cd src; rm -f *~ *.bak *.bck *.tmp *.o )
( cd ga; rm -f *~ *.bak *.bck *.tmp *.o )
( cd merge; rm -f *~ *.bak *.bck *.tmp *.o )
( cd dynamechs_4.0pre1 ; make clean )
( cd glui_v2_1_beta ; make clean )
rm -rf project_builder/build project_builder/GaitSym.pbproj/*.pbxuser
find . -name '.DS_Store' -exec rm -f {} \;
find . -name '.gdb_history' -exec rm -f {} \;
find . -name '.#*' -exec rm -f {} \;
dynamechs:
( cd dynamechs_4.0pre1 ; make all )
glui:
( cd glui_v2_1_beta ; make all )
GACCFILES = \
GA.cc Genome.cc Mating.cc Objective.cc Population.cc \
Random.cc Statistics.cc DataFile.cc XMLConverter.cc ExpressionParser.cc
GAOBJECTS = $(addsuffix .o, $(basename $(GACCFILES) ) )
obj/ga_socket/%.o : %.cc
$(CXX) -Isrc -DUSE_SOCKETS $(CXXFLAGS) $(INC_DIRS) -c $< -o $@
bin/ga_socket: $(addprefix obj/ga_socket/, $(GAOBJECTS) )
$(CXX) -o $@ $^ $(SOCKET_LIBS) $(LIBS)
obj/ga_obj/%.o : %.cc
$(CXX) -Isrc -DUSE_FS $(CXXFLAGS) $(INC_DIRS) -c $< -o $@
bin/ga: $(addprefix obj/ga_obj/, $(GAOBJECTS) )
$(CXX) -o $@ $^ $(LIBS)
MERGECCFILES = \
MergeXML.cc SimulationContainer.cc DataFile.cc
MERGEOBJECTS = $(addsuffix .o, $(basename $(MERGECCFILES) ) )
obj/merge/%.o : %.cc
$(CXX) -Isrc $(CXXFLAGS) $(DYN_INC) $(INC_DIRS) -c $< -o $@
bin/merge: $(addprefix obj/merge/, $(MERGEOBJECTS) )
$(CXX) -o $@ $^ $(LIBS)
obj/utils/%.o : %.cc
$(CXX) -Isrc -Iga $(INC_DIRS) $(CXXFLAGS) -c $< -o $@
bin/CalcPhase: $(addprefix obj/utils/, CalcPhase.o )
$(CXX) -o $@ $^ $(LIBS)
bin/ParseContactDebug: $(addprefix obj/utils/, ParseContactDebug.o )
$(CXX) -o $@ $^ $(LIBS)
bin/ParseMAMuscleDebug: $(addprefix obj/utils/, ParseMAMuscleDebug.o )
$(CXX) -o $@ $^ $(LIBS)
bin/ApplyGenome: $(addprefix obj/utils/, ApplyGenome.o Genome.o XMLConverter.o \
Random.o ExpressionParser.o DataFile.o )
$(CXX) -o $@ $^ $(LIBS)
INSTALL_BIN ?= /usr/local/bin
install: all
install $(BINARIES) $(INSTALL_BIN)
install scripts/gait_morph.py $(INSTALL_BIN)
install scripts/kinematic_match.py $(INSTALL_BIN)
install scripts/ExtractValues.py $(INSTALL_BIN)
install scripts/SmartTextMerge.py $(INSTALL_BIN)