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
|
EXTRA=-Wsign-compare -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wold-style-definition -Wno-pointer-sign
# -Wcast-qual causes issue. We cast away const with
# respect to create keyptr in places as we will actually eventually
# request (calling code we do not control) that data possibly
# be freed (and hence is changed).
OPTS= -g -Wall $(EXTRA) -Wextra -Wpointer-arith -Wmissing-declarations -Wcomment -Wformat -Wpedantic -Wuninitialized -Wshadow -Wno-long-long -Wmissing-prototypes -Wdeclaration-after-statement -Wbad-function-cast -Wmissing-parameter-type -Wnested-externs
CC = gcc
HDR=dwarf_tsearch.h config.h
TESTMAIN = tsearch_tester.c
TS = dwarf_tsearchbin.c
TSE = dwarf_tsearchepp.c
TSH = dwarf_tsearchhash.c
TSR = dwarf_tsearchred.c
TSB = dwarf_tsearchbal.c
TESTMAINOBJ = tsearch_testerstd.o
all: binarysearch eppingerdel hashsearch gnusearch redblack balancedsearch
tsearch_testerstd.o: $(TESTMAIN) $(HDR)
$(CC) $(OPTS) -c $(TESTMAIN) -o tsearch_testerstd.o
dwarf_tsearchbin.o: $(TS) $(HDR)
$(CC) $(OPTS) -c $(TS)
binarysearch: dwarf_tsearchbin.o $(TESTMAINOBJ) $(HDR)
$(CC) $(OPTS) $(TESTMAINOBJ) dwarf_tsearchbin.o -o binarysearch
dwarf_tsearchbal.o: $(TSB) $(HDR)
$(CC) $(OPTS) -c $(TSB)
balancedsearch: dwarf_tsearchbal.o $(TESTMAINOBJ) $(HDR)
$(CC) $(OPTS) $(TESTMAINOBJ) dwarf_tsearchbal.o -o balancedsearch
dwarf_tsearchepp.o: $(TSE) $(HDR)
$(CC) $(OPTS) -c $(TSE)
eppingerdel: dwarf_tsearchepp.o $(TESTMAINOBJ) $(HDR)
$(CC) $(OPTS) $(TESTMAINOBJ) dwarf_tsearchepp.o -o eppingerdel
dwarf_tsearchhash.o: $(TSH) $(HDR)
$(CC) $(OPTS) -c $(TSH)
hashsearch: dwarf_tsearchhash.o $(TESTMAIN) $(HDR)
$(CC) $(OPTS) -DHASHSEARCH -c $(TESTMAIN) -o tsearch_testerhash.o
$(CC) $(OPTS) tsearch_testerhash.o dwarf_tsearchhash.o -o hashsearch
# Needs a special compile of tsearch_tester.
gnusearch: $(TESTMAINOBJ) $(HDR) $(TESTMAIN)
$(CC) $(OPTS) -DLIBC_TSEARCH -c $(TESTMAIN) -o tsearch_testergnu.o
$(CC) $(OPTS) tsearch_testergnu.o -o gnusearch
dwarf_tsearchred.o: $(TSR) $(HDR)
$(CC) $(OPTS) -c $(TSR)
redblack: dwarf_tsearchred.o $(TESTMAINOBJ) $(HDR)
$(CC) $(OPTS) $(TESTMAINOBJ) dwarf_tsearchred.o -o redblack
valgrind:
valgrind -v --leak-check=full ./binarysearch
valgrind -v --leak-check=full ./eppingerdel
valgrind -v --leak-check=full ./hashsearch
valgrind -v --leak-check=full ./gnusearch
valgrind -v --leak-check=full ./redblack
valgrind -v --leak-check=full ./balancedsearch
test: all
sh RUNTEST
clean:
rm -f junk*
rm -f *.o
rm -f gnusearch
rm -f redblack
rm -f binarysearch
rm -f simplesearch
rm -f eppingerdel
rm -f hashsearch
rm -f balancedsearch
rm -f testfail
rm -f testpass
rm -f testfailerrs
|