]> pd.if.org Git - hexagon/blob - Makefile
Added make target to make test files.
[hexagon] / Makefile
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
4
5 LDFLAGS= $(ARCH) -lm
6 CFLAGS= -Wall -Wno-parentheses $(ARCH) -I. -I..
7 OBJS= hexagon.o astar.o
8 SRC=$(OBJS:.o=.c)
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/astar.t
11 PREFIX=/usr/local
12
13 all:    libhexagon.a docs testfiles
14
15 clean:
16         rm -f $(OBJS) libhexagon.a $(TESTS)
17
18 t/%.t:  t/%.o t/tap.o $(OBJS)
19         $(CC) -I.. -I. -o $@ $+ $(LDFLAGS)
20
21 testfiles:      $(TESTS)
22
23 test:   libhexagon.a $(TESTS)
24         @prove --exec '' 2>/dev/null
25
26 libhexagon.a:   $(OBJS)
27         ar r $@ $+
28         ranlib $@
29
30 install: libhexagon.a hexagon.h doc/hexagon.3
31         cp libhexagon.a $(PREFIX)/lib
32         cp hexagon.h $(PREFIX)/include
33         cp doc/hexagon.3 $(PREFIX)/share/man/man3
34
35 docs:
36         make -C doc
37
38 .c.o:
39         $(CC) $(CFLAGS) -c -o $@ $<
40
41 .SUFFIXES:      .c .h