X-Git-Url: https://pd.if.org/git/?p=hexagon;a=blobdiff_plain;f=Makefile;h=a5e35a1315a072383b226bf77cc5268e2046d2a5;hp=9b2f4426ffc8f1cda05ba94a46b00e0bf69184af;hb=HEAD;hpb=8ca2b8a06b00066a20f744a61c9bcdd65949a344 diff --git a/Makefile b/Makefile index 9b2f442..a5e35a1 100644 --- a/Makefile +++ b/Makefile @@ -2,32 +2,71 @@ # 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/gridsize.t t/center.t t/polar.t +PREFIX=/usr/local +RELEASE = $(shell git tag | tail -1) -all: test libhexagon.a docs +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) -test: $(TESTS) - @prove --exec '' 2>/dev/null +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 $< $@ + +prove.c: ctap/prove.c + cp $< $@ libhexagon.a: $(OBJS) ar r $@ $+ ranlib $@ -docs: - make -C doc +install: libhexagon.a hexagon.h doc/hexagon.3 + cp libhexagon.a $(PREFIX)/lib + cp hexagon.h $(PREFIX)/include + cp doc/hexagon.3 $(PREFIX)/share/man/man3 + +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 +