Makefile (1911B)
1 .POSIX: 2 3 include config.mk 4 5 .SUFFIXES: .1.in .1 .def.h .h.in .h .c .o 6 7 .1.in.1: 8 sh lib/replacepat $< $@ 9 10 .h.in.h: 11 sh lib/replacepat $< $@ 12 13 all: makedate makeversion $(PROG) $(MANPAGE) examples 14 if [ -f .rebuild ]; then rm .rebuild; make -e all; else true; fi 15 16 examples: 17 cd examples && make -e all 18 19 date: 20 sh lib/makedate 21 22 version: 23 sh lib/makeversion 24 25 makedate: 26 sh lib/makedate -l 27 28 makeversion: 29 sh lib/makeversion -l 30 31 table.o: table.c defs.h strtonum.h utf8.h version.h 32 33 $(MANPAGE): $(MANPAGE).in date version 34 35 version.h: version.h.in date version 36 37 utf8.o: utf8.c utf8.h 38 39 $(PROG): $(OBJS) $(SRC) $(HEADERS) 40 $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) 41 42 clean: 43 rm -f tests/testfile version date version.h *.o *.xz *~ \ 44 $(PROG) $(MANPAGE) 45 46 install: all 47 umask 022 48 $(INSTALL) -Dm 0644 $(MANPAGE) $(MANPREFIX)/man1/$(MANPAGE) 49 ln -sf $(MANPAGE) $(MANPREFIX)/man1/tablep.1 50 ln -sf $(MANPAGE) $(MANPREFIX)/man1/tsvtable.1 51 $(INSTALL) -Dm 0644 README $(DOCDIR)/README 52 $(INSTALL) -Dm 0644 LICENSE $(DOCDIR)/LICENSE 53 $(INSTALL) -Dm 0755 $(PROG) $(BINDIR)/$(PROG) 54 ln -sf table $(BINDIR)/tablep 55 ln -sf table $(BINDIR)/tsvtable 56 find examples -type f -exec sh -c 'umask 022; \ 57 basename {} | xargs printf "$(EXDIR)/%s\n" | \ 58 xargs $(INSTALL) -Dm 0644 {}' shell \; 59 60 uninstall: 61 rm -f $(MANPREFIX)/man1/$(MANPAGE) 62 rm -f $(MANPREFIX)/man1/tablep.1 63 rm -f $(MANPREFIX)/man1/tsvtable.1 64 rmdir $(MANPREFIX)/man1 2>/dev/null || true 65 rmdir $(MANPREFIX) 2>/dev/null || true 66 find $(EXDIR) -type f -exec rm {} \; || true 67 find $(EXDIR) -depth -type d -exec rmdir {} \; || true 68 rmdir $(EXDIR) 2>/dev/null || true 69 rm -f $(DOCDIR)/README 70 rm -f $(DOCDIR)/LICENSE 71 rmdir $(DOCDIR) 2>/dev/null || true 72 rm -f $(BINDIR)/$(PROG) 73 rm -f $(BINDIR)/tablep 74 rm -f $(BINDIR)/tsvtable 75 rmdir $(BINDIR) 2>/dev/null || true 76 77 pack: 78 sh -x lib/mkpack 79 80 .PHONY: all clean install makedate makeversion pack uninstall