Optimize mcrealloc
[tedtools.git] / Makefile
1 CC=gcc
2 AR=ar rcv
3 RANLIB=ranlib
4 LD=ld -x -shared 
5
6 INCLUDE=-I.
7 #LINUX_CFLAGS=-D_GNU_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64
8 CFLAGS=-Wall -g -O2 -pedantic -ansi -DASSERT_CORE -DHAVE_POLL_H -DHAVE_SYS_POLL_H -DHAVE_HSTRERROR $(LINUX_CFLAGS)
9 LIB=-g -L. -ltedtools -lm
10
11 OBJS=tlog.o tmalloc.o tools.o prs_hmap.o sfxstr.o \
12         regis.o prs_inf.o shmem.o tcp.o udp.o connpool.o \
13         psort.o flatdb.o tbtree.o
14 PROGS=sfxtest hextest inftest kilter psortex flatdbtest tbtreetest gendata memtest
15
16 .SUFFIXES: .o.c
17
18 all: libtedtools.a $(PROGS)
19
20 $(PROGS): %: %.o
21         $(CC) -o $@ $< $(LIB)
22
23 $(PROGS): libtedtools.a
24
25 libtedtools.a: $(OBJS)
26         $(AR) $@ $?
27         $(RANLIB) $@
28
29 .c.o:
30         $(CC) $(CFLAGS) $(INCLUDE) -c $<
31
32
33 test: all
34         @[ -d results ] || mkdir results  
35         @[ -d diffs ] || mkdir diffs  
36         @[ -d temp ] || mkdir temp  
37         @for FILE in btree flatdb hex inf mem psort sfxmem ; do \
38                 echo -n $$FILE "        ........ " ; \
39                 if sh tests/$$FILE > results/$$FILE 2>results/$$FILE.errout && diff -c expected/$$FILE results/$$FILE > diffs/$$FILE ; then \
40                         echo ok ; \
41                 else \
42                         echo FAILED ; \
43                 fi ; \
44         done
45
46 clean:
47         rm -rf $(OBJS)
48         rm -rf $(PROGS) *.o
49         rm -rf libtedtools.a
50         rm -rf *core *gmon* nohup.out
51         rm -rf sfxtest.log BTREE
52         rm -rf results diffs temp
53