-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
79 lines (63 loc) · 2.17 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
#PLEASE SPECIFY THE R path here where you built the R math library standalone
RMATH=/gscmnt/gc2719/halllab/src/R-3.2.0/src
#compiler
CXX=g++
#internal paths
VPATH=$(shell for file in `find src -name *.cpp`; do echo $$(dirname $$file); done)
PATH_TABX=lib/Tabix
PATH_EIGN=lib/Eigen
#compiler flags
CXXFLAG_OPTI=-O3 -D_FAST_CORRELATION
CXXFLAG_DEBG=-g
CXXFLAG_WARN=-Wall -Wextra -Wno-sign-compare
CXXFLAG_MACX=-mmacosx-version-min=10.7 -stdlib=libc++
#linker flags
LDFLAG_OPTI=-O3
LDFLAG_DEBG=-g
LDFLAG_MACX=-mmacosx-version-min=10.7 -stdlib=libc++
#includes
INC_BASE=-Isrc -I$(PATH_TABX) -I$(PATH_EIGN)
INC_MATH=-I$(RMATH)/include/
INC_MACX=-I/usr/local/include/
#libraries
#LIB_BASE=-lm -lboost_iostreams -lboost_program_options -lz -lgsl -lblas
LIB_BASE=-lm -lz -lboost_iostreams -lboost_program_options -lgsl -lblas -I/gscmnt/gc2719/halllab/src/boost_1_57_0/include -L/gscmnt/gc2719/halllab/src/boost_1_57_0/lib
LIB_MATH=$(RMATH)/nmath/standalone/libRmath.a
LIB_TABX=$(PATH_TABX)/libtabix.a
LIB_MACX=-L/usr/local/lib/
#files (binary, objects, headers & sources)
FILE_BIN=bin/fastQTL
FILE_O=$(shell for file in `find src -name *.cpp`; do echo obj/$$(basename $$file .cpp).o; done)
FILE_H=$(shell find src -name *.h)
FILE_CPP=$(shell find src -name *.cpp)
#default
all: linux
#linux release
linux: CXXFLAG=$(CXXFLAG_OPTI) $(CXXFLAG_WARN)
linux: IFLAG=$(INC_BASE) $(INC_MATH)
linux: LIB=$(LIB_MATH) $(LIB_TABX) $(LIB_BASE)
linux: LDFLAG=$(LDFLAG_OPTI)
linux: $(FILE_BIN)
#macos release
macos: CXXFLAG=$(CXXFLAG_OPTI) $(CXXFLAG_WARN) $(CXXFLAG_MACX)
macos: IFLAG=$(INC_BASE) $(INC_MACX) $(INC_MATH)
macos: LIB=$(LIB_MACX) $(LIB_MATH) $(LIB_TABX) $(LIB_BASE)
macos: LDFLAG=$(LDFLAG_OPTI) $(LDFLAG_MACX)
macos: $(FILE_BIN)
#debug release
debug: CXXFLAG=$(CXXFLAG_DEBG) $(CXXFLAG_WARN)
debug: IFLAG=$(INC_BASE) $(INC_MATH)
debug: LIB=$(LIB_MATH) $(LIB_TABX) $(LIB_BASE)
debug: LDFLAG=$(LDFLAG_DEBG)
debug: $(FILE_BIN)
#compilation
$(LIB_TABX):
cd $(PATH_TABX) && make && cd ../..
$(FILE_BIN): $(FILE_O) $(LIB_TABX)
$(CXX) $(LDFLAG) $^ $(LIB) -o $@
obj/%.o: %.cpp $(FILE_H)
$(CXX) $(CXXFLAG) -o $@ -c $< $(IFLAG)
clean:
rm -f obj/*.o $(FILE_BIN)
cleanall: clean
cd $(PATH_TABX) && make clean && cd ../..