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