X-Git-Url: https://pd.if.org/git/?p=hexagon;a=blobdiff_plain;f=Makefile;h=a5e35a1315a072383b226bf77cc5268e2046d2a5;hp=1662968c9d485bdbbb4007d220719f6a0d90635c;hb=HEAD;hpb=68a4657bb9a3025823a64b7c36d997780d491701 diff --git a/Makefile b/Makefile index 1662968..a5e35a1 100644 --- a/Makefile +++ b/Makefile @@ -2,26 +2,44 @@ # build. This means you Mac users. # ARCH= -arch x386 -arch x86_64 -LDFLAGS= $(ARCH) -lm +LDFLAGS= $(ARCH) -lm -L. CFLAGS= -Wall -Wno-parentheses $(ARCH) -I. -I.. -OBJS= hexagon.o astar.o +OBJS= lib/hexagon.o lib/astar.o lib/cantor.o SRC=$(OBJS:.o=.c) TESTS= t/cantor.t t/distance.t t/adjacency.t t/range.t t/hexbin.t \ - t/gridsize.t t/center.t t/astar.t t/astarlg.t + t/gridsize.t t/center.t t/polar.t PREFIX=/usr/local +RELEASE = $(shell git tag | tail -1) -all: libhexagon.a docs testfiles +all: libhexagon.a docs testfiles hexagon + +hexagon: cli/hexagon.o libhexagon.a + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lhexagon clean: rm -f $(OBJS) libhexagon.a $(TESTS) + rm -f doc/hexagon.3 doc/hexagon.pdf doc/hexagon.tex doc/hexagon.txt \ + doc/hexagon.idx doc/hexagon.aux doc/hexagon.log doc/hexagon.toc -t/%.t: t/%.o t/tap.o $(OBJS) +t/%.t: t/%.o t/ctap.o t/ctap.h $(OBJS) $(CC) -I.. -I. -o $@ $+ $(LDFLAGS) -testfiles: $(TESTS) +testfiles: $(TESTS) + +test: libhexagon.a prove $(TESTS) + @./prove $(TESTS) 2>/dev/null + +ptest: libhexagon.a $(TESTS) + @prove --exec '' $(TESTS) 2>/dev/null + +t/ctap.c: ctap/ctap.c + cp $< $@ + +t/ctap.h: ctap/ctap.h + cp $< $@ -test: libhexagon.a $(TESTS) - @prove --exec '' 2>/dev/null +prove.c: ctap/prove.c + cp $< $@ libhexagon.a: $(OBJS) ar r $@ $+ @@ -32,10 +50,23 @@ install: libhexagon.a hexagon.h doc/hexagon.3 cp hexagon.h $(PREFIX)/include cp doc/hexagon.3 $(PREFIX)/share/man/man3 -docs: - make -C doc +docs: doc/hexagon.3 doc/hexagon.txt + +doc/hexagon.3: doc/hexagon.pod + pod2man --center='hexagon library' --section=3 --release='Version $(RELEASE)' $+ > $@ + +doc/hexagon.txt: doc/hexagon.pod + pod2text -l $+ > $@ + +doc/hexagon.pdf: doc/hexagon.pod + pod2latex -full $+ + pdflatex hexagon.tex + pdflatex hexagon.tex + pdflatex hexagon.tex + rm -f hexagon.tex hexagon.idx hexagon.aux hexagon.toc hexagon.log .c.o: $(CC) $(CFLAGS) -c -o $@ $< .SUFFIXES: .c .h +