-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
74 lines (58 loc) · 1.46 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
######
# 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)
# Common C and C++ flags
CCXXFLAGS:=-O3 -DNDEBUG -march=native -Wall -pthread
# C-only flags
CFLAGS+= $(CCXXFLAGS)
# C++-only flags
CXXFLAGS+= $(CCXXFLAGS) -std=c++1z
# Linker flags
LDFLAGS+=-pthread
######
#
# 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))
########################################################################
######
#
# 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