Makefile (1148B)
1 DESTDIR?= 2 PREFIX?=/usr/local 3 4 #CFLAGS=-g -Wall -ansi -pedantic 5 CFLAGS=-O3 -Wall -ansi -pedantic 6 LDFLAGS=-s 7 SRC=inflate.c inflate_simple.c deflate.c \ 8 sflate.c crc.c adler.c 9 OBJ=${SRC:.c=.o} 10 EXE=sflate inflate_simple 11 12 all: ${EXE} 13 sflate: sflate.o crc.o adler.o inflate.o deflate.o 14 ${CC} -o $@ $^ ${LDFLAGS} 15 inflate_simple: inflate_simple.o 16 ${CC} -o $@ $^ ${LDFLAGS} 17 ${OBJ}: Makefile flate.h 18 .c.o: 19 ${CC} -c ${CFLAGS} $< 20 clean: 21 rm -f ${OBJ} ${EXE} 22 23 prof: profinf profdef 24 25 profinf: inflate.c deflate.c sflate.c crc.c adler.c 26 gcc -O3 -fprofile-arcs -ftest-coverage -pg -g -Wall $+ 27 ./a.out -d <a.z >/dev/null 28 gcov -b $+ >/dev/null 29 gprof a.out >inflate.gprof 30 # gcc -g -Wall $+ 31 # valgrind -v --leak-check=yes ./a.out -d <a.z >/dev/null 2>a.valgrind 32 # grep ERROR a.valgrind 33 # grep alloc a.valgrind 34 rm -f a.out a.valgrind *.gcno *.gcda gmon.out 35 36 profdef: inflate.c deflate.c sflate.c crc.c adler.c 37 gcc -O0 -fprofile-arcs -ftest-coverage -pg -g -Wall $+ 38 ./a.out <a.u >/dev/null 39 gcov -b $+ >/dev/null 40 gprof a.out >deflate.gprof 41 rm -f a.out *.gcno *.gcda gmon.out 42 43 install: 44 mkdir -p ${DESTDIR}${PREFIX}/bin 45 cp sflate ${DESTDIR}${PREFIX}/bin