Delete cruft.
[SXSI/XMLTree.git] / Makefile
1 POPCOUNT=$(shell grep -q popcnt /proc/cpuinfo && echo 1)
2
3 ifeq ($(POPCOUNT), 1)
4         POPCOUNT_FLAG=-DHAS_NATIVE_POPCOUNT
5 else
6         POPCOUNT_FLAG=-DPOPCOUNT_TABLE
7 endif
8
9 ifeq ($(VERBOSE), true)
10         HIDE=
11 else
12         HIDE=@
13 endif
14
15 OPT_FLAGS=-O4 $(POPCOUNT_FLAG) -fno-PIC -static
16 INC_FLAGS=-I./libcds/includes/ -I.
17 CFLAGS= $(INC_FLAGS) $(OPT_FLAGS)
18 CXXFLAGS= -std=c++0x $(INC_FLAGS) $(OPT_FLAGS)
19 CC=g++
20
21 LIBCDS_A=libcds/lib/libcds.a 
22 OBJECTS_TCO= TextCollection/TextCollection.o \
23              TextCollection/TextCollectionBuilder.o \
24              TextCollection/RLCSABuilder.o \
25              TextCollection/FMIndex.o \
26              TextCollection/FMIndexBuilder.o \
27              TextCollection/Tools.o \
28              TextCollection/TextStorage.o \
29              TextCollection/Query.o \
30              TextCollection/EditDistance.o \
31              TextCollection/ResultSet.o
32
33 OBJECTS_XMLTREE=XMLTree.o XMLTreeBuilder.o bp.o darray.o bpcore.o
34
35 LIBRLCSA_TCA=TextCollection/incbwt/rlcsa.a
36 LIBLZTRIE_TCA=TextCollection/lzindex/lztrie.a
37 LIBSWCSA_TCA=TextCollection/swcsa/swcsa.a
38
39
40
41
42 all: depend libcds text_collection XMLTree
43
44 XMLTree: $(OBJECTS_XMLTREE) $(LIBCDS_A) $(OBJECTS_TCO) \
45          $(LIBRLCSA_TCA) $(LIBLZTRIE_TCA) $(LIBSWCSA_TCA)
46         @echo [XMLTree]
47         $(HIDE) cp libcds/lib/libcds.a libXMLTree.a
48         $(HIDE) rm -rf .objs
49         $(HIDE) mkdir .objs
50         $(HIDE) (cd .objs; ar x ../$(LIBRLCSA_TCA); ar x ../$(LIBLZTRIE_TCA); ar x ../$(LIBSWCSA_TCA))
51         $(HIDE) ar rcs libXMLTree.a $(OBJECTS_XMLTREE) $(OBJECTS_TCO) .objs/*.o
52         $(HIDE) rm -rf .objs
53
54 %o: %c
55         @echo [C] $@
56         $(HIDE) $(CC) -c $(CFLAGS) $< -o $@
57
58 %o: %cpp
59         @echo [C++] $@
60         $(HIDE) $(CC) -c $(CXXFLAGS)  $< -o $@
61
62 text_collection:
63         @echo [DEPENDENCY] $@
64         $(HIDE) make -s -C TextCollection/
65
66 libcds:
67         @echo [DEPENDENCY] $@
68         $(HIDE) make -s -C libcds/
69
70 depend:
71         @echo [DEPEND]
72         $(HIDE) (gcc -MM *.c; g++ -MM -std=c++0x *.cpp) > $@
73
74 clean:
75         @echo [CLEAN]
76         $(HIDE) rm -f *.[oa] depend
77
78 -include depend
79