-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
325 lines (277 loc) · 11 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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
#File: Makefile for lpzrobot directory
#Author: Georg Martius <[email protected]>
#Date: June 2005-2011
#More information: see BUILDSYSTEM.txt
SHELL=/bin/bash
include Makefile.conf
USAGE = "Try 'make help' for more..."
USAGE2 = "lpzrobots Makefile Targets:"
USAGE3 = "Usually you do: \nmake all\n see the above description for a step by step process\n"
##!help show this help text (default)
help:
@cat logo.txt
@echo $(USAGE2)
@grep -E "^\#\#\!.*" Makefile | sed -e "s/##!/ /"
@echo -e $(USAGE3)
.PHONY: all
##!all does everyhing utils, selforg, ode, ode_robots and installs them
##! (sudo automatically)
all:
@if [ -w $(PREFIX) ]; then $(MAKE) all_intern; else $(MAKE) SUDO=sudo all_intern; fi
.PHONY: all_intern
all_intern:
$(MAKE) utils
$(SUDO) $(MAKE) install_utils
$(MAKE) selforg
$(SUDO) $(MAKE) install_selforg
$(MAKE) ode
$(SUDO) $(MAKE) install_ode
$(MAKE) ode_robots
$(SUDO) $(MAKE) install_ode_robots
$(MAKE) ga_tools
$(SUDO) $(MAKE) install_ga_tools
@echo "**** Done, you can go and compile your simulations ****"
.PHONY: conf
##!conf reconfigure the installation prefix and type (done automatically at first call)
conf: usage
-mv Makefile.conf Makefile.conf.bak
# automatically creates Makefile.conf since it is included
$(MAKE) PREFIX=$(PREFIX) TYPE=$(TYPE) Makefile.conf
##!
##!******* The following targets are called by "all" in this order ************
.PHONY: utils
##!utils build utilitytools and tags (do that first)
utils: usage
-$(MAKE) guilogger
-$(MAKE) matrixviz
-$(MAKE) soundman
-$(MAKE) javacontroller
-$(MAKE) configurator
-$(MAKE) tags
@echo "********************************************************************************"
@echo "Don't worry if you have seen a lot of errors above."
@echo "This is all optional stuff which is not stricly required."
.PHONY: install_utils
##!install_utils installs the utility tools and scripts
install_utils:
install -d $(PREFIX)/bin $(PREFIX)/lib/soundMan $(PREFIX)/share/lpzrobots $(PREFIX)/include
-@if [ -d matrixviz/bin/matrixviz.app ]; then \
cp matrixviz/bin/matrixviz.app/Contents/MacOS/matrixviz $(PREFIX)/bin/ && echo "===> copied matrixviz.app to $(PREFIX)/bin/"; \
elif [ -e matrixviz/bin/matrixviz ]; then \
cp matrixviz/bin/matrixviz $(PREFIX)/bin/ && echo "===> copied matrixviz to $(PREFIX)/bin/"; \
fi
-cd javacontroller/src && $(MAKE) PREFIX=$(PREFIX)/ install
-@if [ -d guilogger/bin/guilogger.app ]; then \
cp guilogger/bin/guilogger.app/Contents/MacOS/guilogger $(PREFIX)/bin/ && echo "===> copied guilogger to $(PREFIX)/bin/"; \
elif [ -e guilogger/src/bin/guilogger ]; then \
cp guilogger/src/bin/guilogger $(PREFIX)/bin/ && echo "===> copied guilogger to $(PREFIX)/bin/"; \
else cp guilogger/bin/guilogger $(PREFIX)/bin/ && echo "===> copied guilogger to $(PREFIX)/bin/"; \
fi
-@if [ -e configurator/libconfigurator.a -o -e configurator/libconfigurator.so ]; then install --mode 644 configurator/libconfigurator.* $(PREFIX)/lib/ && install --mode 755 configurator/configurator-config $(PREFIX)/bin/ && echo "===> copied libconfigurator to $(PREFIX)/lib/"; fi
-@cp -r configurator/include/configurator $(PREFIX)/include/ && echo "===> copied configurator bins, includes and libs $(PREFIX)"
-cp soundman/class/*.class $(PREFIX)/lib/soundMan/
-cp soundman/bin/soundMan $(PREFIX)/bin/soundMan
sed -i -e "s|PREFIX=.*|PREFIX=$(PREFIX)|" $(PREFIX)/bin/soundMan
.PHONY: selforg
##!selforg compile selforg libaries in optimized and debug version
selforg: usage
@echo "*************** Configure selforg ***************"
$(MAKE) MODULE=selforg confsubmodule
@echo "*************** Compile selforg *****************"
cd selforg && $(MAKE) depend
cd selforg && $(MAKE)
.PHONY: install_selforg
##!install_selforg install selforg
install_selforg: usage
cd selforg && make install
.PHONY: ode
##!ode compile open dynamics engine in double precession (custom version)
ode:
cd opende; sh autogen.sh && ./configure --disable-asserts --enable-shared --enable-double-precision --prefix=$(PREFIX) --disable-demos && $(MAKE) && echo "you probably want to run \"make install_ode\" now (possibly as root)"
.PHONY: install_ode
##!install_ode install the customized ode library (libode_dbl)
install_ode:
@echo "*************** Install ode -double version**********"
cd opende && $(MAKE) install
.PHONY: ode_robots
##!ode_robots compile ode_robots libaries in optimized and debug version
ode_robots: usage
@echo "*************** Configure ode_robots ************"
$(MAKE) MODULE=ode_robots confsubmodule
@echo "*************** Compile ode_robots **************"
cd ode_robots && $(MAKE) depend
cd ode_robots && $(MAKE)
.PHONY: install_ode_robots
##!install_ode_robots install ode_robots
install_ode_robots: usage
cd ode_robots && make install
.PHONY: ga_tools
##!ga_tools compile ga_tools libaries in optimized and debug version
ga_tools: usage
@echo "*************** Configure ga_tools ************"
$(MAKE) MODULE=ga_tools confsubmodule
@echo "*************** Compile ga_tools **************"
cd ga_tools && $(MAKE) depend
cd ga_tools && $(MAKE)
.PHONY: install_ga_tools
##!install_ga_tools install ga_tools
install_ga_tools: usage
cd ga_tools && make install
##! *** You can find example simulations in $(PREFIX)/share/lpzrobots/, but copy
##! *** them first to your home directory to work with them.
##!
##!****** UNINSTALL and CLEAN ************
##!clean removed the object files and libs
clean: usage
-cd guilogger && $(MAKE) clean
-cd matrixviz && $(MAKE) clean
-cd configurator && $(MAKE) clean
cd opende && $(MAKE) clean
cd ode_robots && $(MAKE) clean
cd selforg && $(MAKE) clean
cd ga_tools && $(MAKE) clean
##!clean-all like clean but also removes the libraries and clears simulations
clean-all: usage
-cd guilogger && $(MAKE) distclean
-cd matrixviz && $(MAKE) distclean
-cd opende && $(MAKE) distclean
cd ode_robots && $(MAKE) clean-all
cd ode_robots/simulations && $(MAKE) clean
cd selforg && $(MAKE) clean-all
cd selforg/simulations && $(MAKE) clean
cd selforg/examples && $(MAKE) clean
cd ga_tools && $(MAKE) clean-all
cd ga_tools/simulations && $(MAKE) clean
rm -f Makefile.conf
##!distclean see clean-all
distclean : clean-all
.PHONY: uninstall
##!uninstall removes all the installed files again (except ode)
uninstall: uninstall_intern
.PHONY: uninstall_ode
##!uninstall_ode uninstall the customized ode library
uninstall_ode:
@echo "*************** uninstall ode -double version********"
cd opende && make uninstall
##!****** less common targets ***********
.PHONY: guilogger
##!guilogger compile guilogger
guilogger:
cd guilogger && ./configure && $(MAKE)
.PHONY: matrixviz
##!matrixviz compile matrixviz
matrixviz:
cd matrixviz && ./configure && $(MAKE)
.PHONY: configurator
##!configurator compile configurator
configurator:
configurator/configure --prefix=$(PREFIX) --system=$$System --type=$(TYPE) --static
$(MAKE) -C configurator
configurator/configure --prefix=$(PREFIX) --system=$$System --type=$(TYPE)
$(MAKE) -C configurator
.PHONY: javactrl
##!javactrl compile javacontroller (experimental)
javactrl:
cd javacontroller/src && $(MAKE)
.PHONY: soundman
##!soundman compile soundman (experimental)
soundman:
cd soundman/src && javac -d ../class/ SoundMan.java SoundManipulation.java SoundManGUI.java
.PHONY: confsubmodule
confsubmodule:
@if [ `uname` = "Linux" ]; then \
System="LINUX"; else System="MAC"; fi; \
if [ -n "$(MODULE)" ]; then \
CMD="$(MODULE)/configure --prefix=$(PREFIX) --system=$$System --type=$(TYPE)"; \
echo "call: $$CMD"; \
if ! $$CMD; then exit 1; fi; \
for Folder in $(MODULE)/simulations $(MODULE)/examples; do \
CMD="m4 -D $$System -D $(TYPE) $$Folder/Makefile.4sim.m4"; \
echo "call: $$CMD"; \
if $$CMD > "$$Folder/Makefile.4sim"; then \
echo -n "genenete Makefiles in: ";\
for F in `find "$$Folder" -mindepth 2 -name Makefile.conf`; do \
echo -n "$$F "; \
cp "$$Folder/Makefile.4sim" "$${F%.conf}"; done; \
else \
echo "cannot write $$Folder/Makefile.4sim"; \
fi; \
echo "...Done"; \
done; \
else \
echo "confsubmodule called without MODULE"; exit 1;\
fi
.PHONY: install_libs
install_libs:
@echo "*************** Install selforg *********************"
cd selforg/ && $(MAKE) TYPE=$(TYPE) PREFIX=$(PREFIX) install
# $(PREFIX)/share/lpzrobots/ga_tools
@echo "*************** Install ode_robots ******************"
cd ode_robots/ && $(MAKE) TYPE=$(TYPE) PREFIX=$(PREFIX) install
ifeq ($(TYPE),user)
@echo "*************** Install ga_tools ******************"
cp ga_tools/libga_tools.a $(PREFIX)/lib
# cp ga_tools/libga_tools_opt.a $(PREFIX)/lib
cp -RL ga_tools/include/ga_tools $(PREFIX)/include/
@echo "*************** Install example simulations ******************"
cp -RL ga_tools/simulations $(PREFIX)/share/lpzrobots/ga_tools/
-chmod -R ugo+r $(PREFIX)/share/lpzrobots
@echo "*************** Finished ******************"
@echo "Make sure that the $(PREFIX)/lib directory is in our lib search path"
@echo " and $(PREFIX)/include is searched for includes."
@echo "You can find example simulations in $(PREFIX)/share/lpzrobots/, but copy"
@echo " them first to your home directory to work with them."
endif
.PHONY: uninstall_intern
uninstall_intern:
@echo "*************** Uninstall selforg *********************"
cd selforg/ && $(MAKE) TYPE=$(TYPE) PREFIX=$(PREFIX) uninstall
@echo "*************** Uninstall ode_robots ******************"
cd ode_robots/ && $(MAKE) TYPE=$(TYPE) PREFIX=$(PREFIX) uninstall
@echo "*************** Uninstall ga_tools ******************"
cd ga_tools/ && $(MAKE) TYPE=$(TYPE) PREFIX=$(PREFIX) uninstall
-rm -f $(PREFIX)/bin/guilogger
-rm -f $(PREFIX)/lib/libconfigurator.*
-rm -f $(PREFIX)/bin/configurator-config
-rm -fr $(PREFIX)/include/configurator
-rm -f $(PREFIX)/bin/matrixviz
-cd javacontroller/src && $(MAKE) PREFIX=$(PREFIX) uninstall
-rm -f $(PREFIX)/lib/soundMan/SoundMan*.class
-rm -f $(PREFIX)/bin/soundMan
ifeq ($(TYPE),user)
-rm -rf $(PREFIX)/share/lpzrobots
endif
$(MAKE) uninstall_ode
Makefile.conf:
@bash createMakefile.conf.sh $(PREFIX) $(TYPE)
.PHONY: tags
##!tags create TAGS file for emacs
tags:
@if type etags; then $(MAKE) tags_internal ; else \
echo "etags program not found. If you use emacs install emacs-common-bin" ; fi
.PHONY: tags_internal
tags_internal:
rm -f TAGS
cd selforg && $(MAKE) tags
cd ode_robots && $(MAKE) tags
# cd ga_tools && $(MAKE) tags
.PHONY: doc
##!doc generate doxygen documentation in html folder
doc:
doxygen Doxyfile
.PHONY: docintern
docintern:
date "+PROJECT_NUMBER=%2d-%B-%Y" > builddate
cat builddate Doxyfile.intern | nice -19 doxygen -
find doc/html -type f | xargs chmod ug+rw
find doc/html -type f | xargs chmod o+r
.PHONY: todo
##!todo show the marked todos in the sourcecode
todo:
cd ode_robots && make todo
cd selforg && make todo
usage:
# The logo was creates with >$ figlet "LPZRobots" > logo.txt
# plus some editing
@cat logo.txt
@echo $(USAGE)