1# tthsum makefile 2# 3# Makefile for GNU Make. 4 5.PHONY: all clean dists install manual tthsum uninstall test runtest 6 7ifeq ($(BIN),) 8 BIN = $(DESTDIR)/usr/local/bin 9endif 10ifeq ($(MAN),) 11 MAN = $(DESTDIR)/usr/local/man 12endif 13 14CC ?= gcc 15GZIP = gzip -9 -c 16RM = rm -rf 17 18override CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DUSE_TEXTS #-DUSE_MY_GETOPT 19CFLAGS += -Wall #-pedantic #-ansi 20LDFLAGS += -Wall 21 22BINS = obj-unix 23SHARES = share 24HEADERS = base32.h endian.h escape.h getopt.h read.h test.h texts.h \ 25 thex.h tiger.h tthsum.h types.h utf8.h 26APPSRC = base32.c escape.c getopt.c read.c texts.c thex.c tiger.c \ 27 tthsum.c utf8.c 28APPOBJ = $(patsubst %.c,$(BINS)/%.o, $(APPSRC)) 29APPENTRY = $(BINS)/main.o 30TSTSRC = $(APPSRC) base32_test.c endian_test.c escape_test.c getopt_test.c \ 31 read_test.c texts_test.c thex_test.c tiger_test.c types_test.c \ 32 utf8_test.c 33TSTOBJ = $(patsubst %.c,$(BINS)/%.o, $(TSTSRC)) 34TSTENTRY = $(BINS)/test.o 35 36# "autoconf" 37override CPPFLAGS += $(shell cat $(BINS)/autoconf.cppflags) 38 39 40all: tthsum manual 41 42install: tthsum manual 43 install -d $(BIN) $(DESTDIR)$(MANPREFIX)/man/man1 44 install $(BINS)/tthsum $(DESTDIR)$(PREFIX)/bin 45 install -m644 $(SHARES)/tthsum.1.gz $(DESTDIR)$(MANPREFIX)/man/man1 46 47uninstall: 48 $(RM) $(BIN)/tthsum 49 $(RM) $(MAN)/man1/tthsum.1.gz 50 51tthsum: $(BINS)/tthsum 52 53manual: $(SHARES)/tthsum.1.gz 54 55test: $(BINS)/test 56 57runtest: test tthsum 58 $(BINS)/test 59 $(BINS)/tthsum $(BINS)/tthsum $(BINS)/test | $(BINS)/tthsum -cv 60 61dists: 62 sh -c 'X=`basename \`pwd\`` ; for opts in "zcf ../$$X.tar.gz" \ 63 "jcf ../$$X.tar.bz2" ; do tar $$opts --no-recursion -C.. \ 64 `svn ls ../$$X | sed -e "s#^#$$X/#"` ; done' 65 #sh -c 'X=`basename \`pwd\`` ; cp ../$$X.tar.gz /usr/src/rpm/SOURCES/' 66 #rpm -bs rpm/tthsum.spec 67 #rpm -bb rpm/tthsum.spec 68 69clean: 70 $(RM) $(BINS) $(SHARES) 71 72# TSTSRC includes APPSRC 73$(TSTSRC) autoconf.c: $(HEADERS) 74 touch $(TSTSRC) autoconf.c 75 76$(BINS)/%.o: %.c 77 @mkdir -p $(BINS) 78 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ 79 80$(BINS)/tthsum: $(APPOBJ) $(APPENTRY) 81 82$(SHARES)/tthsum.1.gz: tthsum.1 83 @mkdir -p $(SHARES) 84 $(GZIP) $< > $@ 85 86$(BINS)/test: $(TSTOBJ) $(TSTENTRY) 87 88# "autoconf" 89$(BINS)/autoconf.cppflags: autoconf.c 90 @mkdir -p $(BINS) 91 $(CC) $(CPPFLAGS) $(CFLAGS) -c autoconf.c -o $(BINS)/autoconf.o 92 $(CC) $(LDFLAGS) $(BINS)/autoconf.o -o $(BINS)/autoconf 93 $(BINS)/autoconf >$(BINS)/autoconf.cppflags 94$(APPOBJ): $(BINS)/autoconf.cppflags 95$(TSTOBJ): $(BINS)/autoconf.cppflags 96