Allow arbitrary SWCSA index size
[SXSI/TextCollection.git] / Makefile
1 HIDE=@
2 CC = g++
3 LIBCDSPATH = ../libcds
4 CPPFLAGS = -Wall -ansi -g -I$(LIBCDSPATH)/includes/ -O3 -DNDEBUG -Wno-deprecated-declarations
5 #CPPFLAGS = -Wall -ansi -g -I$(LIBCDSPATH)/includes/
6 LIBCDSA = $(LIBCDSPATH)/lib/libcds.a
7 LIBRLCSA = incbwt/rlcsa.a
8 LIBLZTRIE = lzindex/lztrie.a
9 LIBSWCSA = swcsa/swcsa.a
10 LIBS=  ${LIBRLCSA} ${LIBCDSA} ${LIBLZTRIE} ${LIBSWCSA}
11
12 dcover_obs = dcover/difference_cover.o
13
14 TextCollection_obs = TextCollection.o TextCollectionBuilder.o FMIndexBuilder.o RLCSABuilder.o FMIndex.o Tools.o \
15                      TextStorage.o Query.o EditDistance.o ResultSet.o
16 TCDebug_obs =  bittree.o rbtree.o dynFMI.o 
17
18 TEXTCOLLECTION_A=libTextCollection.a
19
20 all: $(TEXTCOLLECTION_A)
21
22 testTextCollection: testTextCollection.o $(TextCollection_obs) $(LIBS) $(TCDebug_obs) HeapProfiler.o
23         $(CC) -o testTextCollection testTextCollection.o $(TextCollection_obs) $(LIBS) $(TCDebug_obs) HeapProfiler.o
24
25 timeTextCollection: timeTextCollection.o $(TextCollection_obs) $(LIBS) $(TCDebug_obs)
26         $(CC) -o timeTextCollection timeTextCollection.o $(TextCollection_obs) $(TCDebug_obs)
27
28 test2dRange: test2dRange.o ${LIBCDSA}
29         $(CC) -o test2dRange test2dRange.o ${LIBCDSA}
30
31 incbwt/rlcsa.a:
32         @make -C incbwt
33
34 lzindex/lztrie.a:
35         @make -C lzindex
36
37 swcsa/swcsa.a:
38         @make -C swcsa
39
40 %o: %c
41         @echo [C] $@
42         $(HIDE) (gcc -c $(CPPFLAGS) $< -o $@
43
44 %o: %cpp
45         @echo [C++] $@
46         $(HIDE) $(CC) -c $(CPPFLAGS)  $< -o $@
47
48
49 $(TEXTCOLLECTION_A): $(TextCollection_obs) $(LIBS)
50         @echo [Link] $@
51         $(HIDE) rm -rf .objs
52         $(HIDE) mkdir .objs
53         $(HIDE) (cd .objs; ar x ../${LIBRLCSA};ar x ../${LIBLZTRIE}; ar x ../${LIBSWCSA})
54         $(HIDE) ar rcs $@ $(TextCollection_obs) .objs/*.o
55 #       $(HIDE) rm -rf .objs
56
57
58 clean:
59         @make clean -C incbwt
60         @make clean -C lzindex
61         @make clean -C swcsa
62         rm -f core *.o *~ testTextCollection timeTextCollection dcover/*.o dcover/*~
63
64 shallow_clean:
65         rm -f core *.o *~ testTextCollection timeTextCollection
66
67 depend:
68         @make depend -C incbwt
69         $(CC) -MM *.cpp > dependencies.mk
70
71 include dependencies.mk