Makefile (921B)
1 include config.mk 2 BIN = avl fib rb 3 CXX = ntree 4 LIBS = ${wildcard libutil/*.c} 5 OBJS = ${LIBS:.c=.o} 6 7 all: ${BIN} ${CXX} 8 9 config.h: 10 cp config.def.h config.h 11 12 ${BIN}: ${BIN:%=%.o} ${OBJS} 13 ${CC} ${CFLAGS} -o $@ $@.o ${OBJS} ${LDFLAGS} 14 strip $@ 15 16 ${CXX}: ${OBJS} 17 ${GXX} ${CXXFLAGS} -o $@ $@.cxx ${OBJS} ${LDFLAGS} 18 strip $@ 19 20 %.o: %.c config.h 21 ${CC} ${CFLAGS} -c $< -o $@ 22 23 test: all sample_data.txt 24 @./test.sh "./avl -c" 25 @./test.sh "./avl -s" 26 @./test.sh "./avl -cs" 27 @./test.sh "./fib -c 29" 28 @./test.sh "./fib -s 29" 29 @./test.sh "./fib -cs 29" 30 @./test.sh "./rb -c" 31 @./test.sh "./rb -s" 32 @./test.sh "./rb -cs" 33 @./test.sh "./ntree -c" 34 @./test.sh "./ntree -s" 35 @./test.sh "./ntree -d" 36 @./test.sh "./ntree -cs" 37 @./test.sh "./ntree -cd" 38 @./test.sh "./ntree -sd" 39 @./test.sh "./ntree -csd" 40 41 sample_data.txt: 42 shuf -i 0-999999 > sample_data.txt 43 44 clean: 45 rm -f ${BIN} ${CXX} ${BIN:%=%.o} ${OBJS} 46 47 .PHONY: all clean test