-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.intel
218 lines (165 loc) · 7.04 KB
/
Makefile.intel
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
.PHONY: all clean test get-deps
#TODO we need a way to manage paths
## perhaps a target fix_paths
## or make install_local / make install
## Compilers and compiler flags
#CC:=icc
#CFLAGS:="-O3 -xHost -xSSE4.1 -openmp"
#CXX:=icpc
#CXXFLAGS:="-O3 -xHost -openmp -xSSE4.1"
CXX:=g++
CXXFLAGS:=-O0 -msse4 -fopenmp -std=c++11
## Build directories for dependencies
VG_DIR:=vg
VCFLIB_DIR:=vcflib
PROTOBUF_DIR:=protobuf
ROCKS_DIR:=rocksdb
HTSLIB_DIR:=htslib
SPARSEHASH_DIR:=sparsehash
GCSA_DIR:=gcsa2
GSSW_DIR:=gssw
XG_DIR:=xg
SDSL_DIR:=sdsl-lite
SNAPPY_DIR:=snappy
FASTHACK_DIR:=fastahack
LRU_CACHE_DIR:=lru_cache
SHA1_DIR:=sha1
PROGRESS_BAR_DIR:=progress_bar
## Options
ROCKSDB_PORTABLE:=
## Copy all deps into this dir once built
DEP_DIR:=./deps
SRC_DIR:=src
BIN_DIR:=bin
OBJ_DIR:=obj
LIB_DIR:=lib
INC_DIR:=include
## Test dir
TEST_DIR:=test
## Place protobuf output here
PROTO_OUT_DIR:=cpp
## Vars for Object files
VG_SRC:=$(wildcard $(VG_DIR)/*.c)
VG_OBJ:=$(patsubst %.cpp, %.o, $(VG_SRC))
## Vars for lib files
LIB_VCFLIB:=libvcflib.a
LIB_GSSW:=libgssw.a
LIB_PROTOBUF:=libprotobuf.a
LIB_SNAPPY:=libsnappy.a
LIB_ROCKS:=librocksdb.a
LIB_SPARSEHASH:=sparsehash/build/include/sparsehash/sparse_hash_map
LIB_HTSLIB:=ibhts.a
LIB_GCSA:=libgcsa2.a
LIB_XG:=libxg.a
LIB_SDSLLITE:=build/include/sdsl
LIB_FASTAHACK:=
## Vars for Executable files
EXE:=vg
## Linker flags
#LD_INCLUDE_FLAGS:= -I./ -I$(PROTOBUF_OUT_DIR) -I$(VCFLIB_DIR) -I$(FASTAHACK_DIR) -I$(GSSW_DIR)/src -I$(PROTOBUF_DIR)/build/include -I$(ROCKS_DIR)/include -I$(LRU_CACHE_DIR) -I$(SHA1_DIR) -I$(XG_DIR) -I$(SDSL_DIR)/install/include -I$(GCSA_DIR) -I$(HTSLIB_DIR)
LD_INCLUDE_FLAGS:=-I$(INC_DIR)
LD_LIB_FLAGS:= -L$(LIB_DIR) -lvcflib -lgssw -lprotobuf -lhts -lpthread -ljansson -lncurses -lrocksdb -lsnappy -lz -lbz2 -lgcsa2 -lxg -lsdsl -ldivsufsort -ldivsufsort64 -lvg
OBJ:=gssw_aligner.o vg.o cpp/vg.pb.o main.o index.o mapper.o region.o progress_bar/progress_bar.o vg_set.o utility.o path.o alignment.o edit.o sha1/sha1.o json2pb.o entropy.o pileup.o caller.o
## Switch for building on OS X
SYS=$(shell uname -s)
#ifeq ($(SYS),Darwin)
#
#else
#
#endif
all: vg libvg.a
test: vg $(LIB_DIR)/libvg.a build_graph
cd $(TEST_DIR) && $(MAKE)
build_graph: $(TEST_DIR)/build_graph.cpp $(LIB_DIR)/libvg.a
cd $(TEST_DIR) && $(CXX) $(CXXFLAGS) build_graph.cpp $(LD_INCLUDE_FLAGS) -lvg $(LDFLAGS) -o $(TEST_DIR)/build_graph
## Install fresh jq and link into path
## try ports for other dependencies
get-deps-mac:
sudo port install bison bzip2 zlibc protobufcompiler cmake gcc4.9
get-deps:
sudo apt-get install -y protobuf-compiler libprotoc-dev libjansson-dev libbz2-dev libncurses5-dev libtool curl unzip cmake pkg-config wget bc
deps: $(LIB_ROCKS) $(LIB_SNAPPY) $(LIB_GCSA) $(LIB_SDSLLITE) $(LIB_XG) $(LIB_HTSLIB)
mv $(VCFLIB_DIR)/$(LIB_VCFLIB) $(DEP_DIR)
mv $(SPARSEHASH_DIR)/$(LIB_SPARSEHASH) $(DEP_DIR)
mv $(HTSLIB_DIR)/$(LIB_HTSLIB) $(DEP_DIR)
mv $(PROTOBUF_DIR)/$(LIB_PROTOBUF) $(DEP_DIR)
mv $(SNAPPY_DIR)/$(LIB_SNAPPY) $(DEP_DIR)
mv $(HTSLIB_DIR)/$(LIB_HTSLIB) $(DEP_DIR)
$(LIB_HTSLIB):
cd $(HTSLIB_DIR) && $(MAKE) lib-static
protobuf:
c_dir="`pwd`" && cd deps/$(PROTOBUF_DIR) && ./autogen.sh && ./configure --prefix=`${c_dir}` && $(MAKE) && $(MAKE) install
$(LIB_ROCKS): $(ROCKS_DIR)/include/rocksdb/*.h $(ROCKS_DIR)/db/*.c $(ROCKS_DIR)/db/*.cc $(ROCKS_DIR)/db/*.h
cd rocksdb && $(ROCKSDB_PORTABLE) $(MAKE) static_lib
$(LIB_XG): $(LIB_SDSLLITE) $(LIB_PROTOBUF) $(PROTO_OUT_DIR)/vg.pb.h
cd $(XG_DIR) && $(CXX) $(CXXFLAGS) -I$(PROTO_OUT_DIR) -c -o xg.o xg.cpp
ar rs $(LIB_XG) xg.o
$(LIB_SNAPPY): $(SNAPPY_DIR)/*cc $(SNAPPY_DIR)/*h
cd $(SNAPPY_DIR) && ./autogen.sh && ./configure --prefix=`pwd` && $(MAKE) && $(MAKE) install
$(LIB_SDSLLITE):
cd $(SDSL_DIR) && ./install.sh `pwd`
touch $(SDSL_DIR)/$(LIB_SDSLLITE)
$(LIB_GCSA): $(LIB_SDSLLITE)
cd $(GCSA_DIR) && $(MAKE) $(LIB_GCSA)
touch $(LIB_GCSA)
$(LIB_FASTAHACK): fastahack/Fasta.h fastahack/Fasta.cpp
cd $(FASTAHACK_DIR) && $(MAKE)
$(PROGRESS_BAR_DIR)/progress_bar.o:
cd $(PROGRESS_BAR_DIR) && $(MAKE)
$(PROTO_OUT_DIR)/vg.pb.cc: $(PROTO_OUT_DIR)/vg.pb.h
$(PROTO_OUT_DIR)/vg.pb.h: $(LIB_PROTOBUF)
mkdir -p cpp
$(PROTOBUF_DIR)/bin/protoc $(VG_DIR)/vg.proto --cpp_out=cpp
vg.o: $(PROTO_OUT_DIR)/vg.pb.h $(LIB_VCFLIB) $(FASTAHACK_DIR)/Fasta.o $(LIB_GSSW) $(LIB_SPARSEHASH) $(LRU_CACHE_DIR)/lru_cache.h stream.hpp $(LIB_PROTOBUF) $(LIB_SDSLLITE)
$(CXX) $(CXXFLAGS) -c -o vg.o vg.cpp $(LD_INCLUDE_FLAGS)
gssw_aligner.o: gssw_aligner.cpp gssw_aligner.hpp cpp/vg.pb.h $(LIB_GSSW) $(LIB_PROTOBUF) $(LIB_SPARSEHASH)
$(CXX) $(CXXFLAGS) -c -o gssw_aligner.o gssw_aligner.cpp $(LD_INCLUDE_FLAGS)
vg_set.o: vg_set.cpp vg_set.hpp vg.hpp index.hpp cpp/vg.pb.h $(LIBGSSW) $(LIBPROTOBUF) $(SPARSEHASH) $(SDSLLITE)
$(CXX) $(CXXFLAGS) -c -o vg_set.o vg_set.cpp $(LD_INCLUDE_FLAGS)
mapper.o: mapper.cpp mapper.hpp cpp/vg.pb.h $(LIBPROTOBUF) $(SPARSEHASH) $(SDSLLITE)
$(CXX) $(CXXFLAGS) -c -o mapper.o mapper.cpp $(LD_INCLUDE_FLAGS)
main.o: main.cpp $(LIBVCFLIB) $(fastahack/Fasta.o) $(LIBGSSW) stream.hpp $(LIBPROTOBUF) $(SPARSEHASH) $(SDSLLITE)
$(CXX) $(CXXFLAGS) -c -o main.o main.cpp $(LD_INCLUDE_FLAGS)
region.o: region.cpp region.hpp $(LIBPROTOBUF) $(SPARSEHASH)
$(CXX) $(CXXFLAGS) -c -o region.o region.cpp $(LD_INCLUDE_FLAGS)
index.o: index.cpp index.hpp $(LIBPROTOBUF) $(SPARSEHASH)
$(CXX) $(CXXFLAGS) -c -o index.o index.cpp $(LD_INCLUDE_FLAGS)
utility.o: utility.cpp utility.hpp $(LIBPROTOBUF) $(SPARSEHASH)
$(CXX) $(CXXFLAGS) -c -o utility.o utility.cpp $(LD_INCLUDE_FLAGS)
path.o: path.cpp path.hpp $(LIBPROTOBUF) $(SPARSEHASH)
$(CXX) $(CXXFLAGS) -c -o path.o path.cpp $(LD_INCLUDE_FLAGS)
edit.o: edit.cpp edit.hpp $(LIBPROTOBUF)
$(CXX) $(CXXFLAGS) -c -o edit.o edit.cpp $(LD_INCLUDE_FLAGS)
alignment.o: alignment.cpp alignment.hpp $(LIBHTS) $(LIBPROTOBUF) $(SPARSEHASH) edit.hpp edit.cpp
$(CXX) $(CXXFLAGS) -c -o alignment.o alignment.cpp $(LD_INCLUDE_FLAGS)
sha1/sha1.o: sha1/sha1.cpp sha1/sha1.hpp
$(CXX) $(CXXFLAGS) -c -o sha1/sha1.o sha1/sha1.cpp $(LD_INCLUDE_FLAGS)
json2pb.o: json2pb.cpp json2pb.h bin2ascii.h $(LIBPROTOBUF)
$(CXX) $(CXXFLAGS) -c -o json2pb.o json2pb.cpp $(LD_INCLUDE_FLAGS)
entropy.o: entropy.cpp entropy.hpp
$(CXX) $(CXXFLAGS) -c -o entropy.o entropy.cpp $(LD_INCLUDE_FLAGS)
pileup.o: pileup.cpp pileup.hpp cpp/vg.pb.h vg.hpp stream.hpp json2pb.h $(LIBPROTOBUF) $(SPARSEHASH)
$(CXX) $(CXXFLAGS) -c -o pileup.o pileup.cpp $(LD_INCLUDE_FLAGS)
caller.o: caller.cpp caller.hpp cpp/vg.pb.h vg.hpp stream.hpp json2pb.h pileup.hpp $(LIBPROTOBUF) $(SPARSEHASH)
$(CXX) $(CXXFLAGS) -c -o caller.o caller.cpp $(LD_INCLUDE_FLAGS)
vg: deps
cd $(VG_DIR) && $(CXX) $(CXXFLAGS) -o $(VG_EXE) $(LD_INCLUDE_FLAGS) $(LIBS) $(STATIC_FLAGS) && mv $(VG_EXE) ../
clean:
$(RM) $(DEP_DIR)
cd $(VCFLIB_DIR) && $(MAKE) clean
cd $(SNAPPY_DIR) && $(MAKE) clean
cd $(PROTOBUF_DIR) && $(MAKE) clean
cd $(GCSA_DIR) && $(MAKE) clean
cd $(SPARSEHASH_DIR) && $(MAKE) clean
cd $(ROCKS_DIR) && $(MAKE) clean
cd $(SDSL_DIR) && ./uninstall.sh `pwd`
pre:
mkdir -p $(BIN_DIR)
mkdir -p $(LIB_DIR)
mkdir -p $(OBJ_DIR)
mkdir -p $(INC_DIR)
clobber-vg:
$(RM) $(VG_OBJ)
$(RM) $(VG_EXE)
$(RM) $(VG_LB)
$(RM) $(PROTO_OUT_DIR)/*