-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
203 lines (172 loc) · 7.52 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
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
#COMPILER MODE C++11
CXX=g++ -std=c++17
#create folders
dummy_build_folder_bin := $(shell mkdir -p bin)
dummy_build_folder_obj := $(shell mkdir -p obj)
#COMPILER & LINKER FLAGS
CXXFLAG=-O3 -Wno-ignored-attributes
LDFLAG=-O3
#CXXFLAG=-O0 -g -Wno-ignored-attributes
#LDFLAG=-O0
#DYNAMIC LIBRARIES
DYN_LIBS=-lz -lpthread -lbz2 -llzma -lcurl -lcrypto -ldeflate
HFILE=$(shell find src -name *.h)
CFILE=$(shell find src -name *.cpp)
OFILE=$(shell for file in `find src -name *.cpp`; do echo obj/$$(basename $$file .cpp).o; done)
VPATH=$(shell for file in `find src -name *.cpp`; do echo $$(dirname $$file); done)
NAME=$(shell basename $(CURDIR))
BFILE=bin/thorin_v1.2
EXEFILE=bin/thorin_v1.2_static
#COMMIT_VERS=$(shell git rev-parse --short HEAD)
#COMMIT_DATE=$(shell git log -1 --format=%cd --date=short)
#CXXFLAG+= -D__COMMIT_ID__=\"$(COMMIT_VERS)\"
#CXXFLAG+= -D__COMMIT_DATE__=\"$(COMMIT_DATE)\"
ifeq ($(NAME),phase)
CXXFLAG+=-mavx2 -mfma
endif
COMMIT_VERS=3bed6d9
COMMIT_DATE=2023-04-24
ifneq ($(MAKECMDGOALS),clean)
ifneq (, $(shell which git))
COMMIT_VERS_GIT=$(shell git rev-parse --short HEAD 2>/dev/null)
COMMIT_DATE_GIT=$(shell git log -1 --format=%cd --date=short 2>/dev/null)
ifneq (, $(COMMIT_VERS_GIT))
COMMIT_VERS=$(COMMIT_VERS_GIT)
else
$(info Cannot set commit version with git. Using default (last release) $(COMMIT_VERS))
endif
ifneq (, $(COMMIT_DATE_GIT))
COMMIT_DATE=$(COMMIT_DATE_GIT)
else
$(info Cannot set commit date with git. Using default (last release) $(COMMIT_DATE))
endif
else
$(info Git not available, cannot set commit date with git. Using default (last release) $(COMMIT_VERS)/$(COMMIT_DATE))
endif
$(info Commit version $(COMMIT_VERS))
CXXFLAG+= -D__COMMIT_ID__=\"$(COMMIT_VERS)\"
$(info Commit date $(COMMIT_DATE))
CXXFLAG+= -D__COMMIT_DATE__=\"$(COMMIT_DATE)\"
endif
# xSqueezeIt Support [YES/NO]
ifeq ($(XSI_SUPPORT),)
XSI_SUPPORT=NO
endif
ifeq ($(XSI_SUPPORT),YES)
XSI_INC=xsqueezeit/include
XSI_LIB=xsqueezeit/libxsqueezeit.a
DYN_LIBS+= -lzstd -lhts
CXXFLAG+= -D__XSI__ -I$(XSI_INC)
endif
# BGEN Support [YES/NO]
ifeq ($(BGEN_SUPPORT),)
BGEN_SUPPORT=NO
endif
ifeq ($(BGEN_SUPPORT),)
BGEN_SUPPORT=NO
BGEN_LIB=""
endif
ifeq ($(BGEN_SUPPORT),YES)
BGEN_INC=../3rd_party/bgen/genfile/include/
BGEN_LIB=../3rd_party/bgen/build/libbgen.a ../3rd_party/zstd/lib/libzstd.a
#DYN_LIBS+=../3rd_party/zstd/lib/libzstd.a
CXXFLAG+= -D__BGEN__ -I$(BGEN_INC)
endif
#CONDITIONAL PATH DEFINITON
system: DYN_LIBS=-lz -lpthread -lbz2 -llzma
system: HTSSRC=/home/srubinac/git
system: HTSLIB_INC=$(HTSSRC)/htslib-1.17
system: HTSLIB_LIB=$(HTSSRC)/htslib-1.17/libhts.a
system: BOOST_INC=/usr/include
system: BOOST_LIB_IO=/usr/lib/x86_64-linux-gnu/libboost_iostreams.a
system: BOOST_LIB_PO=/usr/lib/x86_64-linux-gnu/libboost_program_options.a
system: BOOST_LIB_SE=/usr/lib/x86_64-linux-gnu/libboost_serialization.a
system: $(BFILE)
desktop: HTSSRC=/home/srubinac/git
desktop: HTSLIB_INC=$(HTSSRC)/htslib-1.17
desktop: HTSLIB_LIB=$(HTSSRC)/htslib-1.17/libhts.a
desktop: BOOST_INC=/usr/include
desktop: BOOST_LIB_IO=/usr/lib/x86_64-linux-gnu/libboost_iostreams.a
desktop: BOOST_LIB_PO=/usr/lib/x86_64-linux-gnu/libboost_program_options.a
desktop: BOOST_LIB_SE=/usr/lib/x86_64-linux-gnu/libboost_serialization.a
desktop: $(BFILE)
olivier: HTSSRC=$(HOME)/Tools
olivier: HTSLIB_INC=$(HTSSRC)/htslib-1.15
olivier: HTSLIB_LIB=$(HTSSRC)/htslib-1.15/libhts.a
olivier: BOOST_INC=/usr/include
olivier: BOOST_LIB_IO=/usr/lib/x86_64-linux-gnu/libboost_iostreams.a
olivier: BOOST_LIB_PO=/usr/lib/x86_64-linux-gnu/libboost_program_options.a
olivier: BOOST_LIB_SE=/usr/lib/x86_64-linux-gnu/libboost_serialization.a
olivier: $(BFILE)
docker: HTSSRC=/usr/local
docker: HTSLIB_INC=$(HTSSRC)/include/htslib
docker: HTSLIB_LIB=$(HTSSRC)/lib/libhts.a
docker: BOOST_INC=/usr/include
docker: BOOST_LIB_IO=/usr/local/lib/libboost_iostreams.a
docker: BOOST_LIB_PO=/usr/local/lib/libboost_program_options.a
docker: BOOST_LIB_SE=/usr/local/lib/libboost_serialization.a
docker: $(BFILE)
unil-dcsr: DYN_LIBS=-lz -lpthread -lcrypto $(XZ_ROOT)/lib/liblzma.so $(BZIP2_ROOT)/lib/libbz2.so $(CURL_ROOT)/lib/libcurl.so /dcsrsoft/spack/arolle/v1.0/spack/opt/spack/linux-rhel8-zen2/gcc-10.4.0/libdeflate-1.10-c5y7elzscnxjeh75hignyp23u5iprhl3/lib/libdeflate.a
unil-dcsr: HTSSRC=$(HTSLIB_ROOT)
unil-dcsr: HTSLIB_INC=$(HTSSRC)/include
unil-dcsr: HTSLIB_LIB=$(HTSSRC)/lib/libhts.a
unil-dcsr: BOOST_INC=$(BOOST_ROOT)/include
unil-dcsr: BOOST_LIB_IO=$(BOOST_ROOT)/lib/libboost_iostreams.a
unil-dcsr: BOOST_LIB_PO=$(BOOST_ROOT)/lib/libboost_program_options.a
unil-dcsr: BOOST_LIB_SE=$(BOOST_ROOT)/lib/libboost_serialization.a
unil-dcsr: $(BFILE)
theoule: HTSSRC=$(HOME)/commands
theoule: HTSLIB_INC=$(HTSSRC)/htslib-1.18
theoule: HTSLIB_LIB=$(HTSSRC)/htslib-1.18/libhts.a
theoule: BOOST_INC=/usr/include
theoule: BOOST_LIB_IO=/usr/lib/x86_64-linux-gnu/libboost_iostreams.a
theoule: BOOST_LIB_PO=/usr/lib/x86_64-linux-gnu/libboost_program_options.a
theoule: $(BFILE)
debug: CXXFLAG=-O0 -g
debug: LDFLAG=-O0
debug: HTSSRC=$(HOME)/commands
debug: HTSLIB_INC=$(HTSSRC)/htslib-1.18
debug: HTSLIB_LIB=$(HTSSRC)/htslib-1.18/libhts.a
debug: BOOST_INC=/usr/include
debug: BOOST_LIB_IO=/usr/lib/x86_64-linux-gnu/libboost_iostreams.a
debug: BOOST_LIB_PO=/usr/lib/x86_64-linux-gnu/libboost_program_options.a
debug: $(BFILE)
static_exe: HTSSRC=/home/srubinac/git
static_exe: HTSLIB_INC=$(HTSSRC)/htslib_minimal
static_exe: HTSLIB_LIB=$(HTSSRC)/htslib_minimal/libhts.a
static_exe: BOOST_INC=/usr/include
static_exe: BOOST_LIB_IO=/usr/local/lib/libboost_iostreams.a
static_exe: BOOST_LIB_PO=/usr/local/lib/libboost_program_options.a
static_exe: BOOST_LIB_SE=/usr/local/lib/libboost_serialization.a
static_exe: $(EXEFILE)
# static desktop Robin
static_exe_robin_desktop: CXXFLAG=-O2 -mavx2 -mfma -D__COMMIT_ID__=\"$(COMMIT_VERS)\" -D__COMMIT_DATE__=\"$(COMMIT_DATE)\"
static_exe_robin_desktop: LDFLAG=-O2
static_exe_robin_desktop: HTSSRC=/home/robin/Dropbox/LIB
static_exe_robin_desktop: HTSLIB_INC=$(HTSSRC)/htslib_minimal
static_exe_robin_desktop: HTSLIB_LIB=$(HTSSRC)/htslib_minimal/libhts.a
static_exe_robin_desktop: BOOST_INC=/usr/include
static_exe_robin_desktop: BOOST_LIB_IO=$(HTSSRC)/boost/lib/libboost_iostreams.a
static_exe_robin_desktop: BOOST_LIB_PO=$(HTSSRC)/boost/lib/libboost_program_options.a
static_exe_robin_desktop: $(EXEFILE)
# static Robin VM
static_exe_robin_desktop: CXXFLAG=-O2 -mavx2 -mfma -D__COMMIT_ID__=\"$(COMMIT_VERS)\" -D__COMMIT_DATE__=\"$(COMMIT_DATE)\"
static_exe_robin_VM: LDFLAG=-O2
static_exe_robin_VM: HTSSRC=/home/rhofmeis/Dropbox/LIB
static_exe_robin_VM: HTSLIB_INC=$(HTSSRC)/htslib_minimal
static_exe_robin_VM: HTSLIB_LIB=$(HTSSRC)/htslib_minimal/libhts.a
static_exe_robin_VM: BOOST_INC=/home/rhofmeis/Dropbox/LIB/boost/include
static_exe_robin_VM: BOOST_LIB_IO=$(HTSSRC)/boost/lib/libboost_iostreams.a
static_exe_robin_VM: BOOST_LIB_PO=$(HTSSRC)/boost/lib/libboost_program_options.a
static_exe_robin_VM: DYN_LIBS=/usr/lib/x86_64-linux-gnu/libz.a /usr/lib/x86_64-linux-gnu/libbz2.a /usr/lib/x86_64-linux-gnu/liblzma.a /usr/lib/x86_64-linux-gnu/libm.a /usr/lib/x86_64-linux-gnu/libpthread.a /usr/local/lib/libcurl.a
static_exe_robin_VM: $(EXEFILE)
#COMPILATION RULES
all: desktop
$(BFILE): $(OFILE)
$(CXX) $(LDFLAG) $^ $(HTSLIB_LIB) $(BOOST_LIB_IO) $(BOOST_LIB_PO) $(BOOST_LIB_SE) $(BGEN_LIB) -o $@ $(DYN_LIBS)
$(EXEFILE): $(OFILE)
$(CXX) $(LDFLAG) -static -static-libgcc -static-libstdc++ -pthread -o $(EXEFILE) $^ $(HTSLIB_LIB) $(BOOST_LIB_IO) $(BOOST_LIB_PO) $(BOOST_LIB_SE) -Wl,-Bstatic $(DYN_LIBS)
obj/%.o: %.cpp $(HFILE)
$(CXX) $(CXXFLAG) -c $< -o $@ -Isrc -I$(HTSLIB_INC) -I$(BOOST_INC)
clean:
rm -f obj/*.o $(BFILE)