forked from bwa-mem2/bwa-mem2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
149 lines (134 loc) · 6.13 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
##/*************************************************************************************
## The MIT License
##
## BWA-MEM2 (Sequence alignment using Burrows-Wheeler Transform),
## Copyright (C) 2019 Intel Corporation, Heng Li.
##
## Permission is hereby granted, free of charge, to any person obtaining
## a copy of this software and associated documentation files (the
## "Software"), to deal in the Software without restriction, including
## without limitation the rights to use, copy, modify, merge, publish,
## distribute, sublicense, and/or sell copies of the Software, and to
## permit persons to whom the Software is furnished to do so, subject to
## the following conditions:
##
## The above copyright notice and this permission notice shall be
## included in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
##Contacts: Vasimuddin Md <[email protected]>; Sanchit Misra <[email protected]>;
## Heng Li <[email protected]>
##*****************************************************************************************/
EXE= bwa-mem2
#CXX= icpc
ifeq ($(CXX), icpc)
CC= icc
else ifeq ($(CXX), g++)
CC=gcc
endif
ARCH_FLAGS= -msse4.1
MEM_FLAGS= -DSAIS=1
CPPFLAGS= -DENABLE_PREFETCH -DV17=1 $(MEM_FLAGS)
INCLUDES= -Isrc -Iext/safestringlib/include
LIBS= -lpthread -lm -lz -L. -lbwa -Lext/safestringlib -lsafestring
OBJS= src/fastmap.o src/bwtindex.o src/utils.o src/kthread.o \
src/kstring.o src/ksw.o src/bntseq.o src/bwamem.o src/profiling.o src/bandedSWA.o \
src/FMI_search.o src/read_index_ele.o src/bwamem_pair.o src/kswv.o src/bwa.o \
src/bwamem_extra.o src/kopen.o
BWA_LIB= libbwa.a
SAFE_STR_LIB= ext/safestringlib/libsafestring.a
ifneq ($(portable),)
LIBS+=-static-libgcc -static-libstdc++
endif
ifeq ($(arch),sse)
ARCH_FLAGS=-msse4.1
else ifeq ($(arch),avx2)
ifeq ($(CXX), icpc)
ARCH_FLAGS=-march=core-avx2 #-xCORE-AVX2
else
ARCH_FLAGS=-mavx2
endif
else ifeq ($(arch),avx512)
ifeq ($(CXX), icpc)
ARCH_FLAGS=-xCORE-AVX512
else
ARCH_FLAGS=-mavx512bw
endif
else ifeq ($(arch),native)
ARCH_FLAGS=-march=native
else ifneq ($(arch),)
# To provide a different architecture flag like -march=core-avx2.
ARCH_FLAGS=$(arch)
endif
CXXFLAGS= -g -O3 -fpermissive $(ARCH_FLAGS) #-Wall ##-xSSE2
.PHONY:all clean depend multi
.SUFFIXES:.cpp .o
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) $< -o $@
all:$(EXE)
multi:
rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
$(MAKE) arch=sse EXE=bwa-mem2.sse41 CXX=$(CXX) all
rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
$(MAKE) arch=avx2 EXE=bwa-mem2.avx2 CXX=$(CXX) all
rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
$(MAKE) arch=avx512 EXE=bwa-mem2.avx512bw CXX=$(CXX) all
$(CXX) -Wall -O3 src/runsimd.cpp -Iext/safestringlib/include -Lext/safestringlib/ -lsafestring -o bwa-mem2
$(EXE):$(BWA_LIB) $(SAFE_STR_LIB) src/main.o
$(CXX) $(CXXFLAGS) src/main.o $(BWA_LIB) $(LIBS) -o $@
$(BWA_LIB):$(OBJS)
ar rcs $(BWA_LIB) $(OBJS)
$(SAFE_STR_LIB):
cd ext/safestringlib/ && make clean && make CC=$(CC) directories libsafestring.a
clean:
rm -fr src/*.o $(BWA_LIB) $(EXE) bwa-mem2.sse41 bwa-mem2.avx2 bwa-mem2.avx512bw
cd ext/safestringlib/ && $(MAKE) clean
depend:
(LC_ALL=C; export LC_ALL; makedepend -Y -- $(CXXFLAGS) $(CPPFLAGS) -I. -- src/*.cpp)
# DO NOT DELETE
src/FMI_search.o: src/FMI_search.h src/bntseq.h src/read_index_ele.h
src/FMI_search.o: src/utils.h src/macro.h src/bwa.h src/bwt.h src/sais.h
src/bandedSWA.o: src/bandedSWA.h src/macro.h
src/bntseq.o: src/bntseq.h src/utils.h src/macro.h src/kseq.h src/khash.h
src/bwa.o: src/bntseq.h src/bwa.h src/bwt.h src/macro.h src/ksw.h src/utils.h
src/bwa.o: src/kstring.h src/kvec.h src/kseq.h
src/bwamem.o: src/bwamem.h src/bwt.h src/bntseq.h src/bwa.h src/macro.h
src/bwamem.o: src/kthread.h src/bandedSWA.h src/kstring.h src/ksw.h
src/bwamem.o: src/kvec.h src/ksort.h src/utils.h src/profiling.h
src/bwamem.o: src/FMI_search.h src/read_index_ele.h src/kbtree.h
src/bwamem_extra.o: src/bwa.h src/bntseq.h src/bwt.h src/macro.h src/bwamem.h
src/bwamem_extra.o: src/kthread.h src/bandedSWA.h src/kstring.h src/ksw.h
src/bwamem_extra.o: src/kvec.h src/ksort.h src/utils.h src/profiling.h
src/bwamem_extra.o: src/FMI_search.h src/read_index_ele.h
src/bwamem_pair.o: src/kstring.h src/bwamem.h src/bwt.h src/bntseq.h
src/bwamem_pair.o: src/bwa.h src/macro.h src/kthread.h src/bandedSWA.h
src/bwamem_pair.o: src/ksw.h src/kvec.h src/ksort.h src/utils.h
src/bwamem_pair.o: src/profiling.h src/FMI_search.h src/read_index_ele.h
src/bwamem_pair.o: src/kswv.h
src/bwtindex.o: src/bntseq.h src/bwa.h src/bwt.h src/macro.h src/utils.h
src/bwtindex.o: src/FMI_search.h src/read_index_ele.h
src/fastmap.o: src/fastmap.h src/bwa.h src/bntseq.h src/bwt.h src/macro.h
src/fastmap.o: src/bwamem.h src/kthread.h src/bandedSWA.h src/kstring.h
src/fastmap.o: src/ksw.h src/kvec.h src/ksort.h src/utils.h src/profiling.h
src/fastmap.o: src/FMI_search.h src/read_index_ele.h src/kseq.h
src/kstring.o: src/kstring.h
src/ksw.o: src/ksw.h src/macro.h
src/kswv.o: src/kswv.h src/macro.h src/ksw.h src/bandedSWA.h
src/kthread.o: src/kthread.h src/macro.h src/bwamem.h src/bwt.h src/bntseq.h
src/kthread.o: src/bwa.h src/bandedSWA.h src/kstring.h src/ksw.h src/kvec.h
src/kthread.o: src/ksort.h src/utils.h src/profiling.h src/FMI_search.h
src/kthread.o: src/read_index_ele.h
src/main.o: src/main.h src/kstring.h src/utils.h src/macro.h src/bandedSWA.h
src/main.o: src/profiling.h
src/profiling.o: src/macro.h
src/read_index_ele.o: src/read_index_ele.h src/utils.h src/bntseq.h
src/read_index_ele.o: src/macro.h
src/utils.o: src/utils.h src/ksort.h src/kseq.h