1## Makefile (Felipe H. da Jornada -  Dec 2012)
2## This is not the Makefile that comes with Qhull.
3## It has been simplified and made compatible with the arch.mk of BerkeleyGW.
4
5PREFIX=../..
6include $(PREFIX)/Common/common-rules.mk
7
8QHULL_HEADERS = geom.h io.h libqhull.h mem.h merge.h poly.h qhull_a.h qset.h \
9random.h stat.h user.h
10QHULL_SRCS = geom2.c geom.c global.c io.c libqhull.c mem.c merge.c poly2.c \
11poly.c qset.c random.c rboxlib.c stat.c user.c usermem.c userprintf.c \
12userprintf_rbox.c
13QHULL_OBJS = $(QHULL_SRCS:.c=.o)
14BGW_HEADERS = libtile_qhull.h libtile_qhull_find.h qhull_blas.h
15BGW_SRCS = libtile_qhull.c libtile_qhull_find.c test_delaunay_c.c test_delaunay_f.f90
16BGW_OBJS = $(subst .f90,.o,$(BGW_SRCS:.c=.o))
17ALL_OBJS = $(QHULL_OBJS) $(BGW_OBJS)
18
19#Don`t use $(TILE_LIBS) here, since we might have to use multiple libraries in
20# the future to implement different tessellation routines.
21LIB = libtile_qhull.a
22
23default : all
24lib : $(LIB)
25all :
26	$(MAKE) $(LIB) && $(MAKE) test_delaunay_f.x test_delaunay_c.x
27
28.PHONY: lib all
29
30$(ALL_OBJS) : $(QHULL_HEADERS)
31$(BGW_OBJS) : $(BGW_HEADERS)
32
33$(LIB) : libtile_qhull.o libtile_qhull_find.o $(QHULL_OBJS)
34	$(AR) ru $@ $^
35
36test_delaunay_f.o: $(COMMON)/tile_m.mod
37
38LIBS = $(TILE_LIBS_EXT) $(LAPACKLIB)
39
40test_delaunay_f.x : test_delaunay_f.o $(GLOBALOBJS) $(COMMON)/tile.o $(TILE_LIBS)
41	$(LINK) $(FOPTS) -o $@ $^ $(LIBS)
42
43test_delaunay_c.x : test_delaunay_c.o $(LIB)
44	$(C_LINK) $(C_OPTS) -o $@ $^ $(LAPACKLIB)
45