1 # set ARCH in your environment if you want to do a multible architecture
2 # build. This means you Mac users.
3 # ARCH= -arch x386 -arch x86_64
5 LDFLAGS= $(ARCH) -lm -L.
6 CFLAGS= -Wall -Wno-parentheses $(ARCH) -I. -I..
7 OBJS= hexagon.o astar.o lib/cantor.o
9 TESTS= t/cantor.t t/distance.t t/adjacency.t t/range.t t/hexbin.t \
10 t/gridsize.t t/center.t t/polar.t
12 RELEASE = $(shell git tag | tail -1)
14 all: libhexagon.a docs testfiles hexagon
16 hexagon: cli/hexagon.o libhexagon.a
17 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lhexagon
20 rm -f $(OBJS) libhexagon.a $(TESTS)
21 rm -f doc/hexagon.3 doc/hexagon.pdf doc/hexagon.tex doc/hexagon.txt \
22 doc/hexagon.idx doc/hexagon.aux doc/hexagon.log doc/hexagon.toc
24 t/%.t: t/%.o t/ctap.o t/ctap.h $(OBJS)
25 $(CC) -I.. -I. -o $@ $+ $(LDFLAGS)
29 test: libhexagon.a prove $(TESTS)
30 @./prove $(TESTS) 2>/dev/null
32 ptest: libhexagon.a $(TESTS)
33 @prove --exec '' $(TESTS) 2>/dev/null
48 install: libhexagon.a hexagon.h doc/hexagon.3
49 cp libhexagon.a $(PREFIX)/lib
50 cp hexagon.h $(PREFIX)/include
51 cp doc/hexagon.3 $(PREFIX)/share/man/man3
53 docs: doc/hexagon.3 doc/hexagon.txt
55 doc/hexagon.3: doc/hexagon.pod
56 pod2man --center='hexagon library' --section=3 --release='Version $(RELEASE)' $+ > $@
58 doc/hexagon.txt: doc/hexagon.pod
61 doc/hexagon.pdf: doc/hexagon.pod
66 rm -f hexagon.tex hexagon.idx hexagon.aux hexagon.toc hexagon.log
69 $(CC) $(CFLAGS) -c -o $@ $<