1 # $Revision: 1.64 $ $Author: schwehr $ $Date: 2004/12/09 17:09:51 $
2
3 # Copyright (C) 2004 Kurt Schwehr
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 #
20 # FIX: assumes we are on Mac OSX 10.3 using fink with the following installed:
21 #
22 # simvoleon21, soqt21, gengetopt (>=2.12.1), gsl, doxygen
23 #
24 # Suggested to install Lisa Tauxe's pmag (>=1.8). Sorry, it is not in fink yet.
25
26 # If you do not have bash in /bin, go get your admin to install it!!!!
27 SHELL=/bin/bash
28
29 help:
30 @echo
31 @echo " USAGE:"
32 @echo
33 @echo " make targets - Build with debugging enabled and then test"
34 @echo " make clean - Clean up all the moose droppings"
35 @echo " make docs - Generate doxygen docs"
36 @echo " make man - Generate section 1 man pages"
37 @echo " make tar - Build a distribution"
38 @echo " make check - Search for all known code issuse (FIX tags)"
39 @echo " make info - Display a number of internal make variables"
40 @echo " make html - Make html from Makefile and bash scripts"
41 @echo
42 @echo " Add 'OPTIMIZE=1' - Build with optimizations enabled and then test"
43 @echo
44 @echo " To run a complete demo"
45 @echo
46 @echo ' export PATH=$${PATH}:`pwd`; export ACOCRC=`pwd`/.acoc.conf; acoc bootbol-thesis.bash'
47
48
49 CXXFLAGS := -Wall -Wimplicit -pedantic -W -Wstrict-prototypes -Wredundant-decls
50 CXXFLAGS += -I/sw/include -L/sw/lib -I/sw/include/qt
51
52
53 # FIX: gcc can tell us the endian
54 # touch foo.h && cpp -dM foo.h
55 #
56 #define __BIG_ENDIAN__ 1
57 #define _BIG_ENDIAN 1
58
59 # This is a cheap hack to prebuild endian
60 ENDIAN_DUMMY:=${shell make -f Makefile.endian}
61 CXXFLAGS += -D${shell ./endian}
62
63 FFLAGS := -g -Wall
64
65 # Make is shut up about GSL using long double or qt use of long long
66 CXXFLAGS += -Wno-long-double -Wno-long-long
67
68 ifdef OPTIMIZE
69 CXXFLAGS += -O3 -funroll-loops -fexpensive-optimizations -DNDEBUG
70 CXXFLAGS += -ffast-math -mpowerpc
71 CXXFLAGS += -DQT_NO_DEBUG
72 # Don't want to exclude those with G3 cpus.
73 # CXXFLAGS += -mtune=G4 -mcpu=G4
74 # Fast is specific for G4 and G5 cpus, here only for the G4
75 # CXXFLAGS += -mcpu=7450 -fast
76 # Programs crashing with -fast
77 else
78 CXXFLAGS += -g3 -O0
79 CXXFLAGS += -D_GLIBCXX_DEBUG
80 CXXFLAGS += -DQT_DEBUG
81 endif
82
83 CFLAGS := ${CXXFLAGS} -Wimplicit-int -Wimplicit-function-declaration -Wnested-externs
84
85 # Need simage in library path. Have a bin in GENGETOPT_BINS that is a shell script
86 WRAPPED_BINS := render_bin simpleview_bin
87
88
89 # These are programs that give --help for help2man
90 GENGETOPT_BINS := histogram
91 GENGETOPT_BINS += render
92 GENGETOPT_BINS += s_bootstrap
93 GENGETOPT_BINS += simpleview
94 GENGETOPT_BINS += xyzdensity
95 GENGETOPT_BINS += xyz_iv
96 GENGETOPT_BINS += xyzvol_cmp
97 GENGETOPT_BINS += vol2vol
98 GENGETOPT_BINS += volhdr_edit
99 GENGETOPT_BINS += volinfo
100 GENGETOPT_BINS += vol_iv
101 GENGETOPT_BINS += volmakecmap
102
103 # Those without gengetopt
104 SIMPLE_BINS := endian
105 SIMPLE_BINS += is_equal
106 SIMPLE_BINS += makeCDF
107 #SIMPLE_BINS+= AMScrunch
108
109
110 BINS := ${GENGETOPT_BINS}
111 BINS += ${SIMPLE_BINS}
112 BINS +=
113
114
115 # TESTING TARGETS:
116 TEST_BINS := test_Cdf
117 TEST_BINS += test_Density
118 TEST_BINS += test_DensityFlagged
119 TEST_BINS += test_Eigs
120 TEST_BINS += test_s_bootstrap
121 TEST_BINS += test_SiteSigma
122 TEST_BINS += test_VecAngle
123 TEST_BINS += test_VolHeader
124
125 TARGETS := ${BINS} ${TEST_BINS}
126
127 targets-no-test: ${BINS}
128 targets: ${TARGETS} test
129
130 # e.g. make simpleview FINK='/sw'
131 FINK:=/sw
132 FINK_SAFE:=${subst /,\\/,${FINK}}
133
134 density.info: density.info.in Makefile
135 make tar
136 perl -pe "s/\@VERSION\@/`cat VERSION`/g" density.info.in > d.tmp
137 perl -pe "s/\@MD5\@/`md5sum ${TARNAME}.tar.bz2 | cut -d' ' -f1`/g" d.tmp > density.info
138 rm -f d.tmp
139 mkdir -p ${FINK}/fink/10.3/local/main/finkinfo/graphics
140 cp density.info ${FINK}/fink/10.3/local/main/finkinfo/graphics
141 sudo cp ${TARNAME}.tar.bz2 ${FINK}/src
142
143 ######################################################################
144 # GENGETOPT programs to build
145
146 %.ggo: %.ggo.in
147 perl -pe "s/\@VERSION\@/`cat VERSION`/g" $< > $@
148
149 %.c: %.ggo
150 gengetopt --input=$< --file-name=${<:.ggo=} --unamed-opts
151
152 histogram: histogram_cmd.o histogram.C
153 ${CXX} -o $@ $^ ${CXXFLAGS}
154
155 # Handle need for simage in DYLD_LIBRARY_PATH on osx
156 render: render.in render_bin
157 perl -pe "s/\@FINK\@/${FINK_SAFE}/g" $< > $@
158 chmod +x $@
159
160 render_bin: render_cmd.o InventorUtilities.o render.C
161 ${CXX} -o $@ $^ ${CXXFLAGS} -lsimage -lCoin -lSimVoleon -bind_at_load
162
163 s_bootstrap: s_bootstrap.C SiteSigma.o Bootstrap.o s_bootstrap_cmd.o Eigs.o VecAngle.o
164 ${CXX} -o $@ $^ ${CXXFLAGS} -Wno-long-double -lgsl -lgslcblas
165
166 # Handle need for simage in DYLD_LIBRARY_PATH on osx
167 simpleview: simpleview.in simpleview_bin
168 perl -pe "s/\@FINK\@/${FINK_SAFE}/g" $< > $@
169 chmod +x $@
170
171 simpleview_bin: simpleview_cmd.o InventorUtilities.o simpleview.C
172 ${CXX} -o $@ $^ -I/sw/include/qt ${CXXFLAGS} -lsimage -lCoin -lSoQt -lSimVoleon -lqt-mt -bind_at_load -Wno-long-long
173
174 xyzdensity: xyzdensity.C Density.o VolHeader.o xyzdensity_cmd.o
175 ${CXX} -o $@ $^ ${CXXFLAGS}
176
177 xyz_iv: xyz_iv_cmd.o xyz_iv.C
178 ${CXX} -o $@ $^ ${CXXFLAGS}
179
180 xyzvol_cmp: xyzvol_cmp.C Density.o VolHeader.o xyzvol_cmp_cmd.o VecAngle.o
181 ${CXX} -o $@ $^ ${CXXFLAGS}
182
183 vol2vol: vol2vol.C VolHeader.o vol2vol_cmd.o Density.o
184 ${CXX} -o $@ $^ ${CXXFLAGS}
185
186 volinfo: volinfo.C VolHeader.o volinfo_cmd.o Density.o
187 ${CXX} -o $@ $^ ${CXXFLAGS}
188
189 volhdr_edit: volhdr_edit.C VolHeader.o volhdr_edit_cmd.o
190 ${CXX} -o $@ $^ ${CXXFLAGS}
191
192 vol_iv: vol_iv.C vol_iv_cmd.o
193 ${CXX} -o $@ $^ ${CXXFLAGS}
194
195 volmakecmap: volmakecmap.C volmakecmap_cmd.o
196 ${CXX} -o $@ $^ ${CXXFLAGS} -lCoin
197
198 ######################################################################
199 # Regular commands sans GENGETOPT
200
201 # Do not need to be here unless they need some extra flags
202
203 ######################################################################
204 # Test Programs
205
206 test_Cdf: Cdf.C Cdf.H
207 ${CXX} -o $@ $< -DREGRESSION_TEST ${CXXFLAGS}
208
209 test_Density: Density.C Density.H VolHeader.o
210 ${CXX} -o $@ $< -DREGRESSION_TEST ${CXXFLAGS} VolHeader.o
211
212 test_DensityFlagged: DensityFlagged.C DensityFlagged.H Density.H Density.o VolHeader.o
213 ${CXX} -o $@ $< -DREGRESSION_TEST ${CXXFLAGS} Density.o VolHeader.o
214
215 test_Eigs: Eigs.C VecAngle.o
216 ${CXX} -o $@ $^ -Wno-long-double -DREGRESSION_TEST ${CXXFLAGS} -lgsl -lgslcblas
217
218 test_SiteSigma: SiteSigma.C SiteSigma.H
219 ${CXX} -o $@ $< -DREGRESSION_TEST ${CXXFLAGS}
220
221 test_s_bootstrap: s_bootstrap.C SiteSigma.o Bootstrap.o
222 ${CXX} -o $@ $< -DREGRESSION_TEST ${CXXFLAGS} SiteSigma.o Bootstrap.o -lgsl -lgslcblas
223
224 test_VecAngle: VecAngle.C
225 ${CXX} -o $@ $^ -Wno-long-double -DREGRESSION_TEST ${CXXFLAGS}
226
227 test_VolHeader: VolHeader.C VolHeader.H
228 ${CXX} -o $@ $< -DREGRESSION_TEST ${CXXFLAGS}
229
230 ######################################################################
231 # Weird tweaks
232
233 simpleview.help2man: simpleview simpleview.help2man.in
234 /bin/cp simpleview.help2man.in simpleview.help2man
235 @echo Generating file format text
236 ./simpleview -l >> simpleview.help2man
237 @echo FIX: need to cleanup the tables following two tables >> simpleview.help2man
238 @echo Generating keyboard shortcut text
239 ./simpleview -k >> simpleview.help2man
240
241 ######################################################################
242 # Worker Bees
243
244 # TARGETS includes TEST_BINS
245 test: ${TARGETS}
246 @for file in ${TEST_BINS}; do \
247 echo ;\
248 echo $$file ;\
249 echo ;\
250 export TESTING=yes ;\
251 ./$$file ;\
252 done
253 @echo
254 ./regression.bash
255 @echo
256 @echo SUCCESS!!
257 @echo All tests passed in "${shell pwd}"
258
259 docs:
260 doxygen
261
262 # to view a man page:
263 # groff -Tascii -man xyzdensity.1 | less
264 # Arg... this fails with the fink groff installed. Gets weird escape sequences
265 man: ${GENGETOPT_BINS} simpleview.help2man
266 mkdir -p doc/man/man1
267 for file in ${GENGETOPT_BINS}; do echo Processing $$file;help2man -N ./$$file --opt-include $$file.help2man > doc/man/man1/$$file.1; done
268
269 man2html: man
270 cd doc/man/man1 && for file in *.1; do groff -Tascii -man $$file | man2html > $${file%%.1}.html; done
271
272 install-web: install-web-doxy install-web-man2html
273 scp ChangeLog kds:www/software/density
274 install-web-doxy: docs
275 scp doc/html/* kds:www/software/density/html
276 install-web-man2html: man2html
277 scp doc/man/man1/*.html kds:www/software/density/man
278 install-web-html: html
279 scp [a-z]*.html Makefile.html kds:www/software/density/files
280 scp HEADER-files.html kds:www/software/density/files/HEADER.html
281
282
283 CODE2HTML_OPTS:=-o html-dark -N
284 html:
285 code2html ${CODE2HTML_OPTS} Makefile Makefile.html
286 code2html ${CODE2HTML_OPTS} bootvol-thesis.bash bootvol-thesis.bash.html
287 code2html ${CODE2HTML_OPTS} debug.bash debug.bash.html
288 code2html ${CODE2HTML_OPTS} getgroups-ol92.bash getgroups-ol92.bash.html
289 code2html ${CODE2HTML_OPTS} makemovie.bash makemovie.bash.html
290 code2html ${CODE2HTML_OPTS} one.bash one.bash.html
291 code2html ${CODE2HTML_OPTS} regression.bash regression.bash.html
292 code2html ${CODE2HTML_OPTS} eigs2xyz.py eigs2xyz.py.html
293 code2html ${CODE2HTML_OPTS} splitdepth.py splitdepth.py.html
294
295
296 # Need these so we can make sure the *_cmd.[ch] files exist so do not need gengetopt
297 GGOS_IN := ${wildcard *.ggo.in}
298 GGOS := ${GGOS_IN:.ggo.in=.ggo}
299 GEN_CFILES := ${GGOS:.ggo=.c}
300 GEN_HFILES := ${GGOS:.ggo=.h}
301
302
303 VERSION := ${shell cat VERSION}
304 NAME := density
305 TARNAME := ${NAME}-${VERSION}
306 #tar: ${GEN_CFILES} ${GENGETOPT_BINS} test
307 tar: ${GEN_CFILES} ${BINS}
308 rm -rf ${TARNAME} ${TARNAME}.tar ${TARNAME}.tar.bz2
309 mkdir ${TARNAME}
310 @echo
311 cp *.{C,H,in,c,h,help2man,bash} ${TARNAME}/
312 @echo
313 cp AUTHOR ChangeLog Doxyfile INSTALL LICENSE.GPL HEADER.html ${TARNAME}/
314 cp Makefile Makefile.endian README.txt TODO VERSION axes.iv ${TARNAME}/
315 @echo Copying example data for one.bash and bootvolume-thesis.bash
316 @echo Leaving out rosenbaum-ams-stripped.dat until published
317 cp sample.wpt *.cpt rosenbaum-ams-stripped.dat as1-crypt.s as2-slump.s as3-undef.s ${TARNAME}/
318 cp .acoc.conf ${TARNAME}/acoc.conf
319 @echo
320 tar cf ${TARNAME}.tar ${TARNAME}
321 bzip2 -9 ${TARNAME}.tar
322 rm -rf ${TARNAME}
323
324 release: tar density.info install-web
325 scp ChangeLog HEADER.html density.info ${TARNAME}.tar.bz2 kds.ucsd.edu:www/software/density
326
327
328 coffee:
329 @echo Go make your own!
330
331 check:
332 @echo
333 @echo "**************************************"
334 @echo "* Known issues currently in the code *"
335 @echo "**************************************"
336 @echo
337 @grep -n FIX *.{C,H,ggo,help2man} Makefile | grep -v grep
338
339 clean: clean-runs
340 rm -rf ${TARGETS} *~ *.o
341 rm -f *_cmd.[ch]
342 rm -f .*~
343
344 # Stuff that running make test or a bash script leaves behind
345 clean-runs:
346 rm -rf blah* foo* *.xyz *.eigs *.cdf [0-9]x[0-9]*test?.vol
347 rm -f .*~
348 rm -f as*.xyz* as*.vol
349 rm -f [0-9].{vol,s,xyz}
350 rm -f [0-9][0-9].{vol,s,xyz*}
351 rm -f one.xyz* one-* one.cmap one.s
352 rm -f current.cmap as[0-9]-*all-1.0.iv as?-?????-????-8.iv vol.iv
353 rm -f *.vol.cmp
354 rm -f test3.vol*
355 @echo Owens Lake stuff
356 rm -f g?-*.{iv,vol,dat,s,xyz*}
357
358
359 real-clean: clean
360 rm -rf doc
361 rm -f .gdb_history
362
363 # FIX: make optimize print on or off
364 info:
365 @echo " NAME - " ${NAME}
366 @echo " VERSION - " ${VERSION}
367 @echo " OPTIMIZE - " ${OPTIMIZE}
368 @echo " CXXFLAGS - " ${CXXFLAGS}
369 @echo " CFLAGS - " ${CFLAGS}
370 @echo " TEST_BINS - " ${TEST_BINS}
371 @echo " SIMPLE_BINS - " ${SIMPLE_BINS}
372 @echo " GENGETOPT GGOs - " ${GGOS:.ggo=}
373 @echo " GENGETOPT_BINS - " ${GENGETOPT_BINS}
374
375
376 # When you need to "RTFS/RTFM"... get the latest
377 CVSROOT_SIM:= ":pserver:cvs@cvs.coin3d.org:/export/cvsroot"
378 sim-cvs-login:
379 -mkdir tmp
380 cd tmp && export CVSROOT=${CVSROOT_SIM} && cvs login
381 get-cvs-coin:
382 -mkdir tmp
383 cd tmp && export CVSROOT=${CVSROOT_SIM} && cvs get Coin
384 get-cvs-soguiexamples:
385 -mkdir tmp
386 cd tmp && export CVSROOT=${CVSROOT_SIM} && cvs -z3 get SoGuiExamples
387 get-cvs-soqt:
388 -mkdir tmp
389 cd tmp && export CVSROOT=${CVSROOT_SIM} && cvs -z3 get SoQt
390 get-cvs-dime:
391 -mkdir tmp
392 cd tmp && export CVSROOT=${CVSROOT_SIM} && cvs -z3 get dime
393 get-cvs-smallchange:
394 -mkdir tmp
395 cd tmp && export CVSROOT=${CVSROOT_SIM} && cvs -z3 get SmallChange
396 get-cvs-voleon:
397 -mkdir tmp
398 cd tmp && export CVSROOT=${CVSROOT_SIM} && cvs -z3 get SIMVoleon
399 get-cvs-soxt:
400 -mkdir tmp
401 cd tmp && export CVSROOT=${CVSROOT_SIM} && cvs -z3 get SoXt
402
403 # Arbitrary color for programs
404 install-acoc:
405 @if [ ! -e ~/.acoc.conf ]; then echo "Installing...";/bin/cp .acoc.conf ~/; \
406 else echo "Already there. Not copying."; fi
407 install-acoc-force:
408 @echo Copying acoc.conf into your home directory. WILL OVERWRITE
409 /bin/cp .acoc.conf ~/
410
411
412
413 ############################################################
414 # Data/Project specific stuff
415 ############################################################
416
417 # For Rosenbaum's data
418 %.s: %.dat
419 awk '{print $$32/3,$$33/3,$$34/3,$$35/3,$$36/3,$$37/3,$$5/3}' $< > $@
420 g1-fluidized.dat:
421 ./getgroups.bash
422
423
424 ############################################################
425 # Dependencies - FIX: do a real depend with gcc/g++
426 ############################################################
427
428 # Thses endian ones are special
429 Density.o: endian
430 VolHeader.o: endian
431
432 xyzdensity: debug.H
433 VolHeader.o: VolHeader.C VolHeader.H
syntax highlighted by Code2HTML, v. 0.9.1