1
# Unix Makefile for qhull and rbox (default gcc/g++)
2
#
3
#   see README.txt and 'make help'
4
#   For qhulltest, use Qt project file at src/qhull-all.pro
5
#   For static builds, an alternative is src/libqhull/Makefile
6
#   
7
# Results
8
#   qhull          Computes convex hull and related structures (libqhullstatic)
9
#   qconvex, qdelaunay, qhalf, qvoronoi
10
#                  Specializations of qhull for each geometric structure
11
#   libqhull.so    Shared library with a static qh_qh struct
12
#   libqhull_p.so  ... with a malloc'd qh_qh struct with -Dqh_QHpointer
13
#   make SO=dll    ... on Windows, use SO=dll.  It compiles dlls
14
#   libqhullstatic.a Static library with a static qh_qh struct
15
#                  ... called 'static' to avoid naming conflicts
16
#   libqhullstatic_p.a with a malloc'd qh_qh struct with -Dqh_QHpointer
17
#   libqhullcpp.a  Static library using a malloc'd qh_qh struct
18
#   user_eg        An example of using shared library qhull_p
19
#                  ... compiled with -Dqh_QHpointer
20
#   user_eg2       An example of using shared library qhull
21
#   user_eg3       An example of the C++ interface to qhull
22
#                  ... using libqhullcpp, libqhullstatic_p, -Dqh_QHpointer
23
#   testqset       Standalone test program for qset.c with mem.c
24
#
25
# Make targets
26
#   make           Produce all of the results
27
#   make qhullx    Produce qhull, qconvex etc. without using library
28
#   make qtest     Quick test of rbox and qhull (bin/rbox D4 | bin/qhull)
29
#   make qtestall  Quick test of all programs except qhulltest
30
#   make test      Test of rbox and qhull
31
#   make bin/qvoronoi  Produce bin/qvoronoi (etc.)
32
#   make doc       Print documentation
33
#   make install   Copy qhull, rbox, qhull.1, rbox.1 to BINDIR, MANDIR
34
#   make new       Rebuild qhull and rbox from source
35
#
36
#   make printall  Print all files
37
#   make clean     Remove object files
38
#   make cleanall  Remove generated files
39
#
40
#   DESTDIR        destination directory. Other directories are relative
41
#   BINDIR         directory where to copy executables
42
#   DOCDIR         directory where to copy html documentation
43
#   INCDIR         directory where to copy headers
44
#   LIBDIR         directory where to copy libraries
45
#   MANDIR         directory where to copy manual pages
46
#   PRINTMAN       command for printing manual pages
47
#   PRINTC         command for printing C files
48
#   CC             ANSI C or C++ compiler
49
#   CC_OPTS1       options used to compile .c files
50
#   CC_OPTS2       options used to link .o files
51
#   CC_OPTS3       options to build shared libraries
52
#   CXX            ANSI C++ compiler
53
#   CXX_OPTS1      options used to compile .cpp files
54
#   CXX_OPTS2      options used to link .o files
55
#   CC_WARNINGS    warnings for .c programs
56
#   CXX_WARNINGS   warnings for .cpp programs
57
#
58
#   LIBQHULLS_OBJS .o files for linking
59
#   LIBQHULL_HDRS  .h files for printing
60
#   CFILES         .c files for printing
61
#   CXXFILES       .cpp files for printing
62
#   TESTFILES      .cpp test files for printing
63
#   DOCFILES       documentation files
64
#   FILES          miscellaneous files for printing
65
#   HTMFILES       documentation source files
66
#   TFILES         .txt versions of html files
67
#   FILES          all other files
68
#   LIBQHULLS_OBJS specifies the object files of libqhullstatic.a
69
#
70
# Do not replace tabs with spaces.  Needed by 'make' for build rules
71
72
# You may build the qhull programs without using a library
73
# make qhullx
74
75
DESTDIR = /usr/local
76
BINDIR	= $(DESTDIR)/bin
77
INCDIR	= $(DESTDIR)/include
78
LIBDIR	= $(DESTDIR)/lib
79
DOCDIR	= $(DESTDIR)/share/doc/qhull
80
MANDIR	= $(DESTDIR)/share/man/man1
81
82
# if you do not have enscript, try a2ps or just use lpr.  The files are text.
83
PRINTMAN = enscript -2rl
84
PRINTC = enscript -2r
85
# PRINTMAN = lpr
86
# PRINTC = lpr
87
88
#for Gnu's gcc compiler, -O2 for optimization, -g for debugging
89
CC        = gcc
90
CC_OPTS1  = -O2 -fPIC -ansi -Isrc/libqhull $(CC_WARNINGS)
91
CXX       = g++
92
93
# libqhullcpp must be before libqhull
94
CXX_OPTS1 = -O2 -Dqh_QHpointer -Isrc/ -Isrc/libqhullcpp -Isrc/libqhull $(CXX_WARNINGS)
95
96
# for shared library link
97
CC_OPTS3  =
98
99
# Define qhull_VERSION in CMakeLists.txt, Makefile, and qhull-warn.pri
100
# Truncated version in qhull-exports.def, qhull_p-exports.def, 
101
#  qhull.so -- static qh_qhT global data structure (qh_QHpointer=0)
102
#  qhull_p.so -- allocated qh_qhT global data structure (qh_QHpointer=1).  Required for libqhullcpp
103
#  qhull_m.so -- future version of Qhull with qh_qhT passed as an argument.
104
qhull_SOVERSION=6
105
SO  = so.6.3.1
106
107
# On MinGW, 
108
#   make SO=dll
109
#   Copy lib/libqhull6_p.dll and lib/libqhull.dll to bin/
110
111
# for Sun's cc compiler, -fast or O2 for optimization, -g for debugging, -Xc for ANSI
112
#CC       = cc
113
#CC_OPTS1 = -Xc -v -fast
114
115
# for Silicon Graphics cc compiler, -O2 for optimization, -g for debugging
116
#CC       = cc
117
#CC_OPTS1 = -ansi -O2
118
119
# for Next cc compiler with fat executable
120
#CC       = cc
121
#CC_OPTS1 = -ansi -O2 -arch m68k -arch i386 -arch hppa
122
123
# For loader, ld, 
124
CC_OPTS2 = $(CC_OPTS1)
125
CXX_OPTS2 = $(CXX_OPTS1)
126
127
# [gcc 4.4] Compiles without error (-Werror)
128
CC_WARNINGS  = -Wall -Wcast-qual -Wextra -Wwrite-strings -Wshadow
129
CXX_WARNINGS = -Wall -Wcast-qual -Wextra -Wwrite-strings -Wno-sign-conversion -Wshadow -Wconversion 
130
131
# Compiles OK with all gcc warnings except for -Wno-sign-conversion and -Wconversion
132
# Compiles OK with all g++ warnings except Qt source errors on -Wshadow and -Wconversion
133
#    -Waddress -Warray-bounds -Wchar-subscripts -Wclobbered -Wcomment -Wunused-variable
134
#    -Wempty-body -Wformat -Wignored-qualifiers -Wimplicit-function-declaration -Wimplicit-int
135
#    -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-parameter-type -Wnonnull
136
#    -Wold-style-declaration -Woverride-init -Wparentheses -Wpointer-sign -Wreturn-type
137
#    -Wsequence-point -Wsign-compare -Wsign-compare -Wstrict-aliasing -Wstrict-overflow=1
138
#    -Wswitch -Wtrigraphs -Wtype-limits -Wuninitialized -Wuninitialized -Wvolatile-register-var
139
#    -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value
140
141
# Default targets for make
142
     
143
all: bin-lib bin/rbox bin/qconvex bin/qdelaunay bin/qhalf bin/qvoronoi \
144
     bin/qhull bin/testqset qtest bin/user_eg2 bin/user_eg3 bin/user_eg qconvex-prompt
145
146
help:
147
	head -n 50 Makefile
148
149
bin-lib:
150
	mkdir -p bin lib
151
     
152
# Remove intermediate files for all builds
153
clean:
154
	rm -f src/*/*.o src/qhulltest/RoadTest.h.cpp build/*/*/*.o  build/*/*.o
155
	rm -f src/*/*.obj build/*/*/*.obj build/*/*/*/*/*.obj build/*/*.obj 
156
	rm -f bin/*.idb lib/*.idb build-cmake/*/*.idb 
157
	rm -f build/*/*/*.a build/*/*/*.rsp build/moc/*.moc
158
	rm -f build-cmake/*/*.obj build-cmake/*/*/*.obj build-cmake/*/*.ilk
159
160
# Remove intermediate files and targets for all builds
161
cleanall: clean
162
	rm -f bin/qconvex bin/qdelaunay bin/qhalf bin/qvoronoi bin/qhull
163
	rm -f core bin/core bin/user_eg bin/user_eg2 bin/user_eg3
164
	rm -f lib/libqhull* lib/qhull*.lib lib/qhull*.exp  lib/qhull*.dll
165
	rm -f bin/libqhull* bin/qhull*.dll bin/*.exe bin/*.pdb lib/*.pdb
166
	rm -f build/*.dll build/*.exe build/*.a build/*.exp 
167
	rm -f build/*.lib build/*.pdb build/*.idb
168
	rm -f build-cmake/*/*.dll build-cmake/*/*.exe build-cmake/*/*.exp 
169
	rm -f build-cmake/*/*.lib build-cmake/*/*.pdb
170
171
doc: 
172
	$(PRINTMAN) $(TXTFILES) $(DOCFILES)
173
174
install:
175
	mkdir -p $(BINDIR)
176
	mkdir -p $(DOCDIR)
177
	mkdir -p $(INCDIR)/libqhull
178
	mkdir -p $(INCDIR)/libqhullcpp
179
	mkdir -p $(LIBDIR)
180
	mkdir -p $(MANDIR)
181
	cp bin/qconvex $(BINDIR)
182
	cp bin/qdelaunay $(BINDIR)
183
	cp bin/qhalf $(BINDIR)
184
	cp bin/qhull $(BINDIR)
185
	cp bin/qvoronoi $(BINDIR)
186
	cp bin/rbox $(BINDIR)
187
	cp html/qhull.man $(MANDIR)/qhull.1
188
	cp html/rbox.man $(MANDIR)/rbox.1
189
	cp html/* $(DOCDIR)
190
	cp -P lib/* $(LIBDIR)
191
	cp src/libqhull/*.h src/libqhull/*.htm $(INCDIR)/libqhull
192
	cp src/libqhullcpp/*.h $(INCDIR)/libqhullcpp
193
	cp src/qhulltest/*.h $(INCDIR)/libqhullcpp
194
195
new:	cleanall all
196
197
printall: doc printh printc printf
198
199
printh:
200
	$(PRINTC) $(LIBQHULL_HDRS)
201
	$(PRINTC) $(LIBQHULLCPP_HDRS)
202
203
printc:
204
	$(PRINTC) $(CFILES)
205
	$(PRINTC) $(CXXFILES)
206
	$(PRINTC) $(TESTFILES)
207
208
printf:
209
	$(PRINTC) $(FILES)
210
211
qtest:
212
	@echo ==============================
213
	@echo == Test qset.c with mem.c ====
214
	@echo ==============================
215
	-bin/testqset 10000
216
	@echo ==============================
217
	@echo == Run the qhull smoketest ===
218
	@echo ==============================
219
	-bin/rbox D4 | bin/qhull Tv
220
	
221
qtestall:  qtest
222
	@echo ==============================
223
	@echo ========= qconvex ============
224
	@echo ==============================
225
	-bin/rbox 10 | bin/qconvex Tv 
226
	@echo ==============================
227
	@echo ========= qdelaunay ==========
228
	@echo ==============================
229
	-bin/rbox 10 | bin/qdelaunay Tv 
230
	@echo ==============================
231
	@echo ========= qhalf ==============
232
	@echo ==============================
233
	-bin/rbox 10 | bin/qconvex FQ FV n Tv | bin/qhalf Tv
234
	@echo ==============================
235
	@echo ========= qvoronoi ===========
236
	@echo ==============================
237
	-bin/rbox 10 | bin/qvoronoi Tv
238
	@echo ==============================
239
	@echo ========= user_eg ============
240
	@echo ==============================
241
	-bin/user_eg
242
	@echo ==============================
243
	@echo ========= user_eg2 ===========
244
	@echo ==============================
245
	-bin/user_eg2
246
	@echo ==============================
247
	@echo ========= user_eg3 ===========
248
	@echo ==============================
249
	-bin/user_eg3 rbox "10 D2"  "2 D2" qhull "s p" facets
250
251
test:
252
	-eg/q_eg
253
	-eg/q_egtest
254
	-eg/q_test
255
256
qconvex-prompt:
257
	-bin/qconvex
258
	@echo '== For libqhull.so and libqhull_p.so'
259
	@echo '   export LD_LIBRARY_PATH=$$PWD/lib:$$LD_LIBRARY_PATH'
260
	@echo
261
	@echo '== For libqhull.dll and libqhull_p.dll'
262
	@echo '   cp lib/libqhull*.dll bin'
263
	@echo
264
	@echo '== The previous steps are required for user_eg and user_eg2'
265
	@echo
266
	@echo '== To smoketest each program'
267
	@echo '   make qtestall'
268
	@echo
269
270
L=    src/libqhull
271
LS=   src/libqhullstatic
272
LSP=  src/libqhullstaticp
273
LCPP= src/libqhullcpp
274
TCPP= src/qhulltest
275
276
LIBQHULL_HDRS = $(L)/user.h $(L)/libqhull.h $(L)/qhull_a.h $(L)/geom.h \
277
        $(L)/io.h $(L)/mem.h $(L)/merge.h $(L)/poly.h $(L)/random.h \
278
        $(L)/qset.h $(L)/stat.h
279
280
# LIBQHULLS_OBJS_1 and LIBQHULLSP_OBJS ordered by frequency of execution with 
281
# small files at end.  Better locality.
282
283
LIBQHULLS_OBJS_1= $(LS)/global.o $(LS)/stat.o $(LS)/geom2.o $(LS)/poly2.o \
284
        $(LS)/merge.o $(LS)/libqhull.o $(LS)/geom.o $(LS)/poly.o \
285
        $(LS)/qset.o $(LS)/mem.o $(LS)/random.o 
286
287
LIBQHULLS_OBJS_2 = $(LIBQHULLS_OBJS_1) $(LS)/usermem.o $(LS)/userprintf.o \
288
        $(LS)/io.o $(LS)/user.o
289
290
LIBQHULLS_OBJS = $(LIBQHULLS_OBJS_2) $(LS)/rboxlib.o $(LS)/userprintf_rbox.o 
291
292
LIBQHULLSP_OBJS = $(LSP)/global.o $(LSP)/stat.o \
293
        $(LSP)/geom2.o $(LSP)/poly2.o $(LSP)/merge.o \
294
        $(LSP)/libqhull.o $(LSP)/geom.o $(LSP)/poly.o $(LSP)/qset.o \
295
        $(LSP)/mem.o $(LSP)/random.o $(LSP)/usermem.o $(LSP)/userprintf.o \
296
	$(LSP)/io.o $(LSP)/user.o $(LSP)/rboxlib.o $(LSP)/userprintf_rbox.o
297
298
LIBQHULLCPP_HDRS = $(LCPP)/RoadError.h $(LCPP)/RoadLogEvent.h $(LCPP)/Coordinates.h \
299
	$(LCPP)/QhullHyperplane.h $(LCPP)/functionObjects.h $(LCPP)/PointCoordinates.h \
300
	$(LCPP)/Qhull.h $(LCPP)/QhullError.h $(LCPP)/QhullFacet.h \
301
	$(LCPP)/QhullFacetList.h $(LCPP)/QhullFacetSet.h $(LCPP)/QhullIterator.h \
302
	$(LCPP)/QhullLinkedList.h $(LCPP)/QhullPoint.h $(LCPP)/QhullPoints.h \
303
	$(LCPP)/QhullPointSet.h $(LCPP)/QhullQh.h $(LCPP)/QhullRidge.h \
304
	$(LCPP)/QhullSet.h $(LCPP)/QhullSets.h $(LCPP)/QhullStat.h \
305
	$(LCPP)/QhullVertex.h $(LCPP)/RboxPoints.h $(LCPP)/UsingLibQhull.h
306
       
307
LIBQHULLCPP_OBJS = $(LCPP)/RoadError.o $(LCPP)/RoadLogEvent.o $(LCPP)/Coordinates.o \
308
	$(LCPP)/PointCoordinates.o $(LCPP)/Qhull.o $(LCPP)/QhullFacet.o \
309
	$(LCPP)/QhullFacetList.o $(LCPP)/QhullFacetSet.o \
310
	$(LCPP)/QhullHyperplane.o $(LCPP)/QhullPoint.o \
311
	$(LCPP)/QhullPoints.o $(LCPP)/QhullPointSet.o $(LCPP)/QhullQh.o \
312
	$(LCPP)/QhullRidge.o $(LCPP)/QhullSet.o $(LCPP)/QhullStat.o \
313
	$(LCPP)/QhullVertex.o $(LCPP)/QhullVertexSet.o $(LCPP)/RboxPoints.o \
314
	$(LCPP)/UsingLibQhull.o src/user_eg3/user_eg3.o 
315
316
# CFILES ordered alphabetically after libqhull.c 
317
CFILES= src/qhull/unix.c $(L)/libqhull.c $(L)/geom.c $(L)/geom2.c $(L)/global.c $(L)/io.c \
318
	$(L)/mem.c $(L)/merge.c $(L)/poly.c $(L)/poly2.c $(L)/random.c $(L)/rboxlib.c \
319
	$(L)/qset.c $(L)/stat.c $(L)/user.c $(L)/usermem.c $(L)/userprintf.c $(L)/userprintf_rbox.c \
320
	src/qconvex/qconvex.c src/qdelaunay/qdelaun.c src/qhalf/qhalf.c src/qvoronoi/qvoronoi.c
321
322
CXXFILES= $(LCPP)/RoadError.cpp $(LCPP)/RoadLogEvent.cpp $(LCPP)/Coordinates.cpp \
323
	$(LCPP)/PointCoordinates.cpp $(LCPP)/Qhull.cpp $(LCPP)/QhullFacet.cpp \
324
	$(LCPP)/QhullFacetList.cpp $(LCPP)/QhullFacetSet.cpp \
325
	$(LCPP)/QhullHyperplane.cpp $(LCPP)/QhullPoint.cpp \
326
	$(LCPP)/QhullPoints.cpp $(LCPP)/QhullPointSet.cpp $(LCPP)/QhullQh.cpp \
327
	$(LCPP)/QhullRidge.cpp $(LCPP)/QhullSet.cpp $(LCPP)/QhullStat.cpp \
328
	$(LCPP)/QhullVertex.cpp $(LCPP)/QhullVertexSet.cpp $(LCPP)/RboxPoints.cpp \
329
	$(LCPP)/UsingLibQhull.cpp src/user_eg3/user_eg3.cpp 
330
	
331
TESTFILES= $(TCPP)/qhulltest.cpp $(TCPP)/Coordinates_test.cpp $(TCPP)/Point_test.cpp $(TCPP)/PointCoordinates_test.cpp \
332
	$(TCPP)/Qhull_test.cpp $(TCPP)/QhullFacet_test.cpp $(TCPP)/QhullFacetList_test.cpp \
333
	$(TCPP)/QhullFacetSet_test.cpp $(TCPP)/QhullHyperplane_test.cpp $(TCPP)/QhullLinkedList_test.cpp \
334
	$(TCPP)/QhullPoint_test.cpp $(TCPP)/QhullPoints_test.cpp \
335
	$(TCPP)/QhullPointSet_test.cpp $(TCPP)/QhullRidge_test.cpp \
336
	$(TCPP)/QhullSet_test.cpp $(TCPP)/QhullVertex_test.cpp $(TCPP)/QhullVertexSet_test.cpp \
337
	$(TCPP)/RboxPoints_test.cpp $(TCPP)/UsingLibQhull_test.cpp 
338
339
340
TXTFILES= Announce.txt REGISTER.txt COPYING.txt README.txt src/Changes.txt
341
DOCFILES= html/rbox.txt html/qhull.txt
342
FILES=	Makefile src/rbox/rbox.c src/user_eg/user_eg.c src/user_eg2/user_eg2.c \
343
	src/testqset/testqset.c eg/q_test eg/q_egtest eg/q_eg
344
MANFILES= html/qhull.man html/rbox.man 
345
# Source code is documented by src/libqhull/*.htm
346
HTMFILES= html/index.htm html/qh-quick.htm html/qh-impre.htm html/qh-eg.htm \
347
	html/qh-optc.htm html/qh-opto.htm html/qh-optf.htm  html/qh-optp.htm html/qh-optq.htm \
348
	html/qh-c.htm html/qh-faq.htm html/qhull.htm html/qconvex.htm html/qdelaun.htm \
349
	html/qh-geom.htm html/qh-globa.htm html/qh-io.htm html/qh-mem.htm html/qh-merge.htm \
350
	html/qh-poly.htm html/qh-qhull.htm html/qh-set.htm html/qh-stat.htm html/qh-user.htm \
351
	html/qconvex.htm html/qdelau_f.htm html/qdelaun.htm html/qhalf.htm html/qvoronoi.htm \
352
	html/qvoron_f.htm html/rbox.htm 
353
354
qhull/unix.o:            $(L)/libqhull.h $(L)/user.h $(L)/mem.h
355
qconvex/qconvex.o:       $(L)/libqhull.h $(L)/user.h $(L)/mem.h
356
qdelanay/qdelaun.o:      $(L)/libqhull.h $(L)/user.h $(L)/mem.h
357
qhalf/qhalf.o:           $(L)/libqhull.h $(L)/user.h $(L)/mem.h
358
qvoronoi/qvoronoi.o:     $(L)/libqhull.h $(L)/user.h $(L)/mem.h
359
$(LS)/libqhull.o: $(LIBQHULL_HDRS)
360
$(LS)/geom.o:     $(LIBQHULL_HDRS)
361
$(LS)/geom2.o:    $(LIBQHULL_HDRS)
362
$(LS)/global.o:   $(LIBQHULL_HDRS)
363
$(LS)/io.o:       $(LIBQHULL_HDRS)
364
$(LS)/mem.o:      $(L)/mem.h
365
$(LS)/merge.o:    $(LIBQHULL_HDRS)
366
$(LS)/poly.o:     $(LIBQHULL_HDRS)
367
$(LS)/poly2.o:    $(LIBQHULL_HDRS)
368
$(LS)/random.o:   $(L)/libqhull.h $(L)/random.h
369
$(LS)/rboxlib.o:  $(L)/libqhull.h $(L)/random.h $(L)/user.h
370
$(LS)/qset.o:     $(L)/qset.h $(L)/mem.h
371
$(LS)/stat.o:     $(LIBQHULL_HDRS)
372
$(LS)/user.o:     $(LIBQHULL_HDRS)
373
$(LSP)/libqhull.o: $(LIBQHULL_HDRS)
374
$(LSP)/geom.o:     $(LIBQHULL_HDRS)
375
$(LSP)/geom2.o:    $(LIBQHULL_HDRS)
376
$(LSP)/global.o:   $(LIBQHULL_HDRS)
377
$(LSP)/io.o:       $(LIBQHULL_HDRS)
378
$(LSP)/mem.o:      $(L)/mem.h
379
$(LSP)/merge.o:    $(LIBQHULL_HDRS)
380
$(LSP)/poly.o:     $(LIBQHULL_HDRS)
381
$(LSP)/poly2.o:    $(LIBQHULL_HDRS)
382
$(LSP)/random.o:   $(L)/libqhull.h $(L)/random.h
383
$(LSP)/rboxlib.o:  $(L)/libqhull.h $(L)/random.h $(L)/user.h
384
$(LSP)/qset.o:     $(L)/qset.h $(L)/mem.h
385
$(LSP)/stat.o:     $(LIBQHULL_HDRS)
386
$(LSP)/user.o:     $(LIBQHULL_HDRS)
387
$(LCPP)/RoadError.o:        $(LCPP)/RoadError.h $(LCPP)/RoadLogEvent.h
388
$(LCPP)/RoadLogEvent.o:     $(LCPP)/RoadError.h                  
389
$(LCPP)/Coordinates.o:      $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
390
$(LCPP)/PointCoordinates.o: $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
391
$(LCPP)/Qhull.o:            $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
392
$(LCPP)/QhullFacet.o:       $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
393
$(LCPP)/QhullFacetList.o:   $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
394
$(LCPP)/QhullFacetSet.o:    $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
395
$(LCPP)/QhullHyperplane.o:  $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
396
$(LCPP)/QhullPoint.o:       $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
397
$(LCPP)/QhullPoints.o:      $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
398
$(LCPP)/QhullPointSet.o:    $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
399
$(LCPP)/QhullQh.o:          $(LIBQHULL_HDRS)
400
$(LCPP)/QhullRidge.o:       $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
401
$(LCPP)/QhullSet.o:         $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
402
$(LCPP)/QhullStat.o:        $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
403
$(LCPP)/QhullVertex.o:      $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
404
$(LCPP)/QhullVertexSet.o:   $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
405
$(LCPP)/RboxPoints.o:       $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
406
$(LCPP)/UsingLibQhull.o:    $(LIBQHULLCPP_HDRS) $(LIBQHULL_HDRS)
407
408
.c.o:
409
	$(CC) -c $(CC_OPTS1) -o $@ $<
410
411
.cpp.o:
412
	$(CXX) -c $(CXX_OPTS1) -o $@ $<
413
414
# compile qhull without using bin/libqhull.a.  Must be after LIBQHULLS_OBJS
415
# Same as libqhull/Makefile
416
qhullx: src/qconvex/qconvex.o src/qdelaunay/qdelaun.o src/qhalf/qhalf.o \
417
            src/qvoronoi/qvoronoi.o src/qhull/unix.o src/rbox/rbox.o $(LIBQHULLS_OBJS)
418
	$(CC) -o bin/qconvex $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) src/qconvex/qconvex.o 
419
	$(CC) -o bin/qdelaunay $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) src/qdelaunay/qdelaun.o
420
	$(CC) -o bin/qhalf $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) src/qhalf/qhalf.o 
421
	$(CC) -o bin/qvoronoi $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) src/qvoronoi/qvoronoi.o 
422
	$(CC) -o bin/qhull $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) src/qhull/unix.o 
423
	$(CC) -o bin/rbox $(CC_OPTS2) -lm $(LS)/rboxlib.o $(LS)/random.o $(LS)/usermem.o $(LS)/userprintf_rbox.o src/rbox/rbox.o
424
	-bin/rbox D4 | bin/qhull
425
426
# The static library, libqhullstatic, is defined without qh_QHpointer.
427
428
$(LS)/libqhull.o: $(L)/libqhull.c
429
	$(CC) -c $(CC_OPTS1) -o $@ $<
430
$(LS)/geom.o:     $(L)/geom.c
431
	$(CC) -c $(CC_OPTS1) -o $@ $<
432
$(LS)/geom2.o:    $(L)/geom2.c
433
	$(CC) -c $(CC_OPTS1) -o $@ $<
434
$(LS)/global.o:   $(L)/global.c
435
	$(CC) -c $(CC_OPTS1) -o $@ $<
436
$(LS)/io.o:       $(L)/io.c
437
	$(CC) -c $(CC_OPTS1) -o $@ $<
438
$(LS)/mem.o:      $(L)/mem.c
439
	$(CC) -c $(CC_OPTS1) -o $@ $<
440
$(LS)/merge.o:    $(L)/merge.c
441
	$(CC) -c $(CC_OPTS1) -o $@ $<
442
$(LS)/poly.o:     $(L)/poly.c
443
	$(CC) -c $(CC_OPTS1) -o $@ $<
444
$(LS)/poly2.o:    $(L)/poly2.c
445
	$(CC) -c $(CC_OPTS1) -o $@ $<
446
$(LS)/random.o:   $(L)/random.c
447
	$(CC) -c $(CC_OPTS1) -o $@ $<
448
$(LS)/rboxlib.o:   $(L)/rboxlib.c
449
	$(CC) -c $(CC_OPTS1) -o $@ $<
450
$(LS)/qset.o:     $(L)/qset.c
451
	$(CC) -c $(CC_OPTS1) -o $@ $<
452
$(LS)/stat.o:     $(L)/stat.c
453
	$(CC) -c $(CC_OPTS1) -o $@ $<
454
$(LS)/user.o:     $(L)/user.c
455
	$(CC) -c $(CC_OPTS1) -o $@ $<
456
$(LS)/usermem.o:     $(L)/usermem.c
457
	$(CC) -c $(CC_OPTS1) -o $@ $<
458
$(LS)/userprintf.o:  $(L)/userprintf.c
459
	$(CC) -c $(CC_OPTS1) -o $@ $<
460
$(LS)/userprintf_rbox.o:  $(L)/userprintf_rbox.c
461
	$(CC) -c $(CC_OPTS1) -o $@ $<
462
463
# The static library, libqhullstatic_p, is defined with qh_QHpointer (user.h).
464
465
$(LSP)/libqhull.o: $(L)/libqhull.c
466
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
467
$(LSP)/geom.o:     $(L)/geom.c
468
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
469
$(LSP)/geom2.o:    $(L)/geom2.c
470
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
471
$(LSP)/global.o:   $(L)/global.c
472
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
473
$(LSP)/io.o:       $(L)/io.c
474
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
475
$(LSP)/mem.o:      $(L)/mem.c
476
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
477
$(LSP)/merge.o:    $(L)/merge.c
478
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
479
$(LSP)/poly.o:     $(L)/poly.c
480
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
481
$(LSP)/poly2.o:    $(L)/poly2.c
482
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
483
$(LSP)/random.o:   $(L)/random.c
484
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
485
$(LSP)/rboxlib.o:   $(L)/rboxlib.c
486
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
487
$(LSP)/qset.o:     $(L)/qset.c
488
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
489
$(LSP)/stat.o:     $(L)/stat.c
490
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
491
$(LSP)/user.o:     $(L)/user.c
492
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
493
$(LSP)/usermem.o:     $(L)/usermem.c
494
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
495
$(LSP)/userprintf.o:     $(L)/userprintf.c
496
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
497
$(LSP)/userprintf_rbox.o:     $(L)/userprintf_rbox.c
498
	$(CC) -c -Dqh_QHpointer $(CC_OPTS1) -o $@ $<
499
500
lib/libqhullstatic.a: $(LIBQHULLS_OBJS)
501
	@echo ==========================================
502
	@echo ==== If 'ar' fails, try 'make qhullx' ====
503
	@echo ==========================================
504
	ar -rs $@ $^
505
	#If 'ar -rs' fails try using 'ar -s' with 'ranlib'
506
	#ranlib $@
507
508
lib/libqhullstatic_p.a: $(LIBQHULLSP_OBJS)
509
	ar -rs $@ $^
510
	#ranlib $@
511
512
lib/libqhullcpp.a: $(LIBQHULLCPP_OBJS)
513
	ar -rs $@ $^
514
	#ranlib $@
515
516
lib/libqhull.$(SO): $(LIBQHULLS_OBJS)
517
	$(CC) -shared -o $@ $(CC_OPTS3) $^
518
	cd lib && ln -f -s libqhull.$(SO) libqhull.so
519
520
lib/libqhull_p.$(SO): $(LIBQHULLSP_OBJS)
521
	$(CC) -shared -o $@ $(CC_OPTS3) $^
522
	cd lib && ln -f -s libqhull_p.$(SO) libqhull_p.so
523
524
# don't use ../qconvex.	 Does not work on Red Hat Linux
525
bin/qconvex: src/qconvex/qconvex.o lib/libqhullstatic.a
526
	$(CC) -o $@ $< $(CC_OPTS2) -Llib -lqhullstatic -lm
527
528
bin/qdelaunay: src/qdelaunay/qdelaun.o lib/libqhullstatic.a
529
	$(CC) -o $@ $< $(CC_OPTS2) -Llib -lqhullstatic -lm
530
531
bin/qhalf: src/qhalf/qhalf.o lib/libqhullstatic.a
532
	$(CC) -o $@ $< $(CC_OPTS2) -Llib -lqhullstatic -lm
533
534
bin/qvoronoi: src/qvoronoi/qvoronoi.o lib/libqhullstatic.a
535
	$(CC) -o $@ $< $(CC_OPTS2) -Llib -lqhullstatic -lm
536
537
bin/qhull: src/qhull/unix.o lib/libqhullstatic.a
538
	$(CC) -o $@ $< $(CC_OPTS2) -Llib -lqhullstatic -lm
539
	-chmod +x eg/q_test eg/q_eg eg/q_egtest
540
541
bin/rbox: src/rbox/rbox.o lib/libqhullstatic.a
542
	$(CC) -o $@ $< $(CC_OPTS2) -Llib -lqhullstatic -lm
543
544
bin/testqset: src/testqset/testqset.o src/libqhull/qset.o src/libqhull/mem.o
545
	$(CC) -o $@ $^ $(CC_OPTS2) -lm
546
547
bin/user_eg: src/user_eg/user_eg.c lib/libqhull_p.$(SO) 
548
	@echo -e '\n\n==================================================='
549
	@echo -e '== If user_eg fails on MinGW or Cygwin, use'
550
	@echo -e '==   "make SO=dll" and copy lib/libqhull_p.dll to bin/'
551
	@echo -e '== If user_eg fails to link, switch to -lqhullstatic_p'
552
	@echo -e '===================================================\n'
553
	$(CC) -o $@ $< -Dqh_QHpointer  $(CC_OPTS1) $(CC_OPTS3) -Llib -lqhull_p -lm
554
555
# You may use  -lqhullstatic instead of -lqhull 
556
bin/user_eg2: src/user_eg2/user_eg2.o lib/libqhull.$(SO)
557
	@echo -e '\n\n==================================================='
558
	@echo -e '== If user_eg2 fails on MinGW or Cygwin, use'
559
	@echo -e '==   "make SO=dll" and copy lib/libqhull.dll to bin/'
560
	@echo -e '== If user_eg2 fails to link, switch to -lqhullstatic'
561
	@echo -e '===================================================\n'
562
	$(CC) -o $@ $< $(CC_OPTS2) -Llib -lqhull -lm
563
564
bin/user_eg3: src/user_eg3/user_eg3.o lib/libqhullstatic_p.a lib/libqhullcpp.a
565
	$(CXX) -o $@ $< $(CXX_OPTS2) -Llib -lqhullcpp -lqhullstatic_p -lm
566
567
# end of Makefile