[10207] | 1 | # Simple gcc Makefile for qhull and rbox (default gcc/g++)
|
---|
| 2 | #
|
---|
| 3 | # see README.txt
|
---|
| 4 | #
|
---|
| 5 | # Results
|
---|
| 6 | # qhull Computes convex hulls and related structures
|
---|
| 7 | # qconvex, qdelaunay, qhalf, qvoronoi
|
---|
| 8 | # Specializations of qhull for each geometric structure
|
---|
| 9 | # user_eg An example of using shared library qhull6_p (with qh_QHpointer)
|
---|
| 10 | # user_eg2 An example of using shared library qhull (without qh_QHpointer)
|
---|
| 11 | # testqset Standalone test of qset.c with mem.c
|
---|
| 12 | # libqhullstatic.a Static library for qhull
|
---|
| 13 | #
|
---|
| 14 | # Make targets
|
---|
| 15 | # make Produce all of the results
|
---|
| 16 | # make qhull_all Produce qconvex, etc.
|
---|
| 17 | # Links program sources into src/libqhull
|
---|
| 18 | # make qtest Quick test of qset, rbox, and qhull
|
---|
| 19 | # make doc Print documentation
|
---|
| 20 | # make install Copy qhull, rbox, qhull.1, rbox.1 to BINDIR, MANDIR
|
---|
| 21 | # make new Rebuild qhull and rbox from source
|
---|
| 22 | #
|
---|
| 23 | # make printall Print all files
|
---|
| 24 | # make clean Remove object files
|
---|
| 25 | # make cleanall Remove generated files
|
---|
| 26 | #
|
---|
| 27 | # BINDIR directory where to copy executables
|
---|
| 28 | # DESTDIR destination directory
|
---|
| 29 | # DOCDIR directory where to copy html documentation
|
---|
| 30 | # INCDIR directory where to copy headers
|
---|
| 31 | # LIBDIR directory where to copy libraries
|
---|
| 32 | # MANDIR directory where to copy manual pages
|
---|
| 33 | # PRINTMAN command for printing manual pages
|
---|
| 34 | # PRINTC command for printing C files
|
---|
| 35 | # CC ANSI C or C++ compiler
|
---|
| 36 | # CC_OPTS1 options used to compile .c files
|
---|
| 37 | # CC_OPTS2 options used to link .o files
|
---|
| 38 | # CC_OPTS3 options to build shared libraries
|
---|
| 39 | #
|
---|
| 40 | # LIBQHULL_OBJS .o files for linking
|
---|
| 41 | # LIBQHULL_HDRS .h files for printing
|
---|
| 42 | # CFILES .c files for printing
|
---|
| 43 | # DOCFILES documentation files
|
---|
| 44 | # FILES miscellaneous files for printing
|
---|
| 45 | # TFILES .txt versions of html files
|
---|
| 46 | # FILES all other files
|
---|
| 47 | # LIBQHULL_OBJS specifies the object files of libqhullstatic.a
|
---|
| 48 | #
|
---|
| 49 | # Do not replace tabs with spaces. Needed by 'make' for build rules
|
---|
| 50 |
|
---|
| 51 | # You may build the qhull programs without using a library
|
---|
| 52 | # make qhullx
|
---|
| 53 |
|
---|
| 54 | DESTDIR = /usr/local
|
---|
| 55 | BINDIR = $(DESTDIR)/bin
|
---|
| 56 | INCDIR = $(DESTDIR)/include
|
---|
| 57 | LIBDIR = $(DESTDIR)/lib
|
---|
| 58 | DOCDIR = $(DESTDIR)/share/doc/qhull
|
---|
| 59 | MANDIR = $(DESTDIR)/share/man/man1
|
---|
| 60 |
|
---|
| 61 | # if you do not have enscript, try a2ps or just use lpr. The files are text.
|
---|
| 62 | PRINTMAN = enscript -2rl
|
---|
| 63 | PRINTC = enscript -2r
|
---|
| 64 | # PRINTMAN = lpr
|
---|
| 65 | # PRINTC = lpr
|
---|
| 66 |
|
---|
| 67 | #for Gnu's gcc compiler, -O2 for optimization, -g for debugging
|
---|
| 68 | CC = gcc
|
---|
| 69 | CC_OPTS1 = -O2 -fPIC -ansi $(CC_WARNINGS)
|
---|
| 70 |
|
---|
| 71 | # for Sun's cc compiler, -fast or O2 for optimization, -g for debugging, -Xc for ANSI
|
---|
| 72 | #CC = cc
|
---|
| 73 | #CC_OPTS1 = -Xc -v -fast
|
---|
| 74 |
|
---|
| 75 | # for Silicon Graphics cc compiler, -O2 for optimization, -g for debugging
|
---|
| 76 | #CC = cc
|
---|
| 77 | #CC_OPTS1 = -ansi -O2
|
---|
| 78 |
|
---|
| 79 | # for Next cc compiler with fat executable
|
---|
| 80 | #CC = cc
|
---|
| 81 | #CC_OPTS1 = -ansi -O2 -arch m68k -arch i386 -arch hppa
|
---|
| 82 |
|
---|
| 83 | # For loader, ld,
|
---|
| 84 | CC_OPTS2 = $(CC_OPTS1)
|
---|
| 85 | CXX_OPTS2 = $(CXX_OPTS1)
|
---|
| 86 |
|
---|
| 87 | # Default targets for make
|
---|
| 88 |
|
---|
| 89 | all: qhull_links qhull_all qtest
|
---|
| 90 |
|
---|
| 91 | clean:
|
---|
| 92 | rm -f *.o
|
---|
| 93 | # Delete linked files from other directories [qhull_links]
|
---|
| 94 | rm -f qconvex.c unix.c qdelaun.c qhalf.c qvoronoi.c rbox.c
|
---|
| 95 | rm -f user_eg.c user_eg2.c testqset.c
|
---|
| 96 |
|
---|
| 97 | cleanall: clean
|
---|
| 98 | rm -f qconvex qdelaunay qhalf qvoronoi qhull *.exe
|
---|
| 99 | rm -f core user_eg user_eg2 testqset libqhullstatic.a
|
---|
| 100 |
|
---|
| 101 | doc:
|
---|
| 102 | $(PRINTMAN) $(TXTFILES) $(DOCFILES)
|
---|
| 103 |
|
---|
| 104 | install:
|
---|
| 105 | mkdir -p $(BINDIR)
|
---|
| 106 | mkdir -p $(DOCDIR)
|
---|
| 107 | mkdir -p $(INCDIR)/libqhull
|
---|
| 108 | mkdir -p $(MANDIR)
|
---|
| 109 | cp -p qconvex qdelaunay qhalf qhull qvoronoi rbox $(BINDIR)
|
---|
| 110 | cp -p libqhullstatic.a $(LIBDIR)
|
---|
| 111 | cp -p ../../html/qhull.man $(MANDIR)/qhull.1
|
---|
| 112 | cp -p ../../html/rbox.man $(MANDIR)/rbox.1
|
---|
| 113 | cp -p ../../html/* $(DOCDIR)
|
---|
| 114 | cp *.h $(INCDIR)/libqhull
|
---|
| 115 |
|
---|
| 116 | new: cleanall all
|
---|
| 117 |
|
---|
| 118 | printall: doc printh printc printf
|
---|
| 119 |
|
---|
| 120 | printh:
|
---|
| 121 | $(PRINTC) $(LIBQHULL_HDRS)
|
---|
| 122 |
|
---|
| 123 | printc:
|
---|
| 124 | $(PRINTC) $(CFILES)
|
---|
| 125 |
|
---|
| 126 | # LIBQHULL_OBJS_1 ordered by frequency of execution with small files at end. Better locality.
|
---|
| 127 | # Same definitions as ../../Makefile
|
---|
| 128 |
|
---|
| 129 | LIBQHULLS_OBJS_1= global.o stat.o geom2.o poly2.o merge.o \
|
---|
| 130 | libqhull.o geom.o poly.o qset.o mem.o random.o
|
---|
| 131 |
|
---|
| 132 | LIBQHULLS_OBJS_2= $(LIBQHULLS_OBJS_1) usermem.o userprintf.o io.o user.o
|
---|
| 133 |
|
---|
| 134 | LIBQHULLS_OBJS= $(LIBQHULLS_OBJS_2) rboxlib.o userprintf_rbox.o
|
---|
| 135 |
|
---|
| 136 | LIBQHULL_HDRS= user.h libqhull.h qhull_a.h geom.h \
|
---|
| 137 | io.h mem.h merge.h poly.h random.h \
|
---|
| 138 | qset.h stat.h
|
---|
| 139 |
|
---|
| 140 | # CFILES ordered alphabetically after libqhull.c
|
---|
| 141 | CFILES= ../qhull/unix.c libqhull.c geom.c geom2.c global.c io.c \
|
---|
| 142 | mem.c merge.c poly.c poly2.c random.c rboxlib.c \
|
---|
| 143 | qset.c stat.c user.c usermem.c userprintf.c \
|
---|
| 144 | ../qconvex/qconvex.c ../qdelaunay/qdelaun.c ../qhalf/qhalf.c ../qvoronoi/qvoronoi.c
|
---|
| 145 |
|
---|
| 146 | TXTFILES= ../../Announce.txt ../../REGISTER.txt ../../COPYING.txt ../../README.txt ../Changes.txt
|
---|
| 147 | DOCFILES= ../../html/rbox.txt ../../html/qhull.txt
|
---|
| 148 |
|
---|
| 149 | .c.o:
|
---|
| 150 | $(CC) -c $(CC_OPTS1) -o $@ $<
|
---|
| 151 |
|
---|
| 152 | # Work around problems with ../ in Red Hat Linux
|
---|
| 153 | qhull_links:
|
---|
| 154 | [ -f qconvex.c ] || ln -s ../qconvex/qconvex.c
|
---|
| 155 | [ -f qdelaun.c ] || ln -s ../qdelaunay/qdelaun.c
|
---|
| 156 | [ -f qhalf.c ] || ln -s ../qhalf/qhalf.c
|
---|
| 157 | [ -f qvoronoi.c ] || ln -s ../qvoronoi/qvoronoi.c
|
---|
| 158 | [ -f qhull.c ] || ln -s ../qhull/unix.c
|
---|
| 159 | [ -f rbox.c ] || ln -s ../rbox/rbox.c
|
---|
| 160 | [ -f user_eg.c ] || ln -s ../user_eg/user_eg.c
|
---|
| 161 | [ -f user_eg2.c ] || ln -s ../user_eg2/user_eg2.c
|
---|
| 162 | [ -f testqset.c ] || ln -s ../testqset/testqset.c
|
---|
| 163 |
|
---|
| 164 | # compile qhull without using bin/libqhullstatic.a
|
---|
| 165 | qhull_all: qconvex.o qdelaun.o qhalf.o qvoronoi.o unix.o user_eg.o user_eg2.o rbox.o testqset.o $(LIBQHULLS_OBJS)
|
---|
| 166 | $(CC) -o qconvex $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qconvex.o
|
---|
| 167 | $(CC) -o qdelaunay $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qdelaun.o
|
---|
| 168 | $(CC) -o qhalf $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qhalf.o
|
---|
| 169 | $(CC) -o qvoronoi $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) qvoronoi.o
|
---|
| 170 | $(CC) -o qhull $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) unix.o
|
---|
| 171 | $(CC) -o rbox $(CC_OPTS2) -lm rbox.o rboxlib.o random.o usermem.o userprintf_rbox.o
|
---|
| 172 | $(CC) -o user_eg $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_2) user_eg.o
|
---|
| 173 | $(CC) -o user_eg2 $(CC_OPTS2) -lm $(LIBQHULLS_OBJS_1) user_eg2.o usermem.o userprintf.o io.o
|
---|
| 174 | $(CC) -o testqset $(CC_OPTS2) -lm mem.o qset.o testqset.o
|
---|
| 175 | -ar -rs libqhullstatic.a $(LIBQHULLS_OBJS)
|
---|
| 176 | #libqhullstatic.a is not needed for qhull
|
---|
| 177 | #If 'ar -rs' fails try using 'ar -s' with 'ranlib'
|
---|
| 178 | #ranlib libqhullstatic.a
|
---|
| 179 |
|
---|
| 180 | qtest:
|
---|
| 181 | @echo Testing qset.c and mem.c with testqset
|
---|
| 182 | ./testqset 10000
|
---|
| 183 | @echo Run the qhull smoketest
|
---|
| 184 | ./rbox D4 | ./qhull
|
---|
| 185 |
|
---|
| 186 | # end of Makefile
|
---|