-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
166 lines (134 loc) · 3.89 KB
/
Makefile
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
######
# Makefile (GNU make is assumed!)
#
# Based on the idea/skeleton presented at
# http://mad-scientist.net/make/multi-arch.html
######
export OBJ_DIR := obj
ifneq ($(OBJ_DIR),$(notdir $(CURDIR)))
include target.mk
else
.DEFAULT: all
VPATH = $(SRC_DIR)
INCLUDE_FLAGS:= -I$(BASE_DIR)/lemon/compiled/include/ \
-I$(BASE_DIR)/sdsl-lite/compiled/include
#-I$(LOC_DIR)/include/ \
#-I$(LOC_DIR)/include/glib-core/ \
# Pre-processor flags
CPPFLAGS= $(INCLUDE_FLAGS)
# Common C and C++ flags
CCXXFLAGS:=-std=c++11 -Wall -O3 -DNDEBUG -march=native -Wno-deprecated -ffunction-sections -fdata-sections -fopenmp
# C-only flags
CFLAGS+= $(CCXXFLAGS)
# C++-only flags
CXXFLAGS+= $(CCXXFLAGS)
# Linker flags
LDFLAGS+=-Wl,--gc-sections -fopenmp
# Define libraries
LIBS:= -L$(BASE_DIR)/lemon/compiled/lib/ \
-L$(BASE_DIR)/sdsl-lite/compiled/lib
######
#
# LIST OF THE PROGRAMS
# For each listed program 'xxx', two variables must be defined:
# - OBJS_xxx = the object files that compose the program
# - LIBS_xxx = the libraries which must be linked
#
PROGRAMS:=SpliceAwareAligner
OBJS_SpliceAwareAligner = \
utils.o \
bMEM.o \
SplicingGraph.o \
MEMsGraph.o \
SpliceAwareAligner.o
LIBS_SpliceAwareAligner= $(LIBS) -lrt -lsdsl -ldivsufsort -ldivsufsort64 -lemon -lz
#
# END List of programs
######
.PHONY: all
all: $(addprefix $(BIN_DIR)/, $(PROGRAMS))
##########################
# 3RD PART PREREQUISITES #
##########################
.PHONY: prerequisites
prerequisites: lemon sdsl salmon
.PHONY: clean-prerequisites
clean-prerequisites: clean-lemon clean-sdsl clean-salmon
# LEMON ################################################################
.PHONY: lemon
lemon: $(BASE_DIR)/lemon/
LEMON_NAME:=lemon-1.3.1
$(BASE_DIR)/lemon/:
@echo "* Lemon Library" ; \
cd $(BASE_DIR) ; \
wget http://lemon.cs.elte.hu/pub/sources/$(LEMON_NAME).tar.gz ; \
tar -xvf $(LEMON_NAME).tar.gz ; \
rm $(LEMON_NAME).tar.gz ; \
mv $(LEMON_NAME) lemon ; \
if [ -d lemon/ ] ; then \
cd lemon/ && mkdir build && cd build ; \
sed '3d' ../CMakeLists.txt > tmp ; \
mv tmp ../CMakeLists.txt ; \
cmake -DCMAKE_INSTALL_PREFIX=../compiled/ .. ; \
make ; \
make install ; \
else \
echo "! lemon folder not found !" ; \
exit 1 ; \
fi
.PHONY: clean-lemon
clean-lemon:
@echo "* Cleaning lemon library..." ; \
rm -rf $(BASE_DIR)/lemon/
########################################################################
# SDSL-LITE ############################################################
.PHONY: sdsl
sdsl: $(BASE_DIR)/sdsl-lite/compiled
$(BASE_DIR)/sdsl-lite/compiled:
@echo "* SDSL-lite Library" ; \
cd $(BASE_DIR)/sdsl-lite ; \
mkdir compiled ; \
./install.sh ./compiled
.PHONY: clean-sdsl
clean-sdsl:
@echo "* Cleaning SDSL library..." ; \
rm -rf $(BASE_DIR)/sdsl-lite/compiled
########################################################################
# SALMON ###############################################################
.PHONY: salmon
salmon: $(BASE_DIR)/salmon/bin/salmon
SALMON_NAME:=salmon
$(BASE_DIR)/salmon/bin/salmon:
@echo "* Salmon" ; \
cd $(BASE_DIR)/salmon ; \
mkdir -p build ; \
cd build ; \
cmake .. ; \
make ; \
make install
.PHONY: clean-salmon
clean-salmon:
@echo "* Cleaning salmon binary..." ; \
rm -f $(BASE_DIR)/salmon/bin/salmon ; \
rm -rf $(BASE_DIR)/salmon/build ; \
rm -rf $(BASE_DIR)/salmon/external ; \
rm -rf $(BASE_DIR)/salmon/lib ; \
rm -rf $(BASE_DIR)/salmon/tests/unitTests
########################################################################
######
#
# Pattern rules.
# 1. build a .o file from a .cpp file with the same name (via CXX)
# 2. build a BIN_DIR/xxx file from OBJS_xxx and LIBS_xxx
#
######
.PRECIOUS: %.o
%.o: %.cpp
@echo '* CXX $<'; \
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
.SECONDEXPANSION:
$(BIN_DIR)/%: $$(OBJS_%)
@echo '* LD $@'; \
[ -d $(BIN_DIR) ] || mkdir -p "$(BIN_DIR)" ; \
$(CXX) $(LDFLAGS) -o $@ $(OBJS_$(notdir $@)) $(LIBS_$(notdir $@))
endif