-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
248 lines (208 loc) · 6.04 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#
# Copyright 2018, Christopher Bennett <[email protected]> and Daehwan Kim <[email protected]>
#
# This file is part of fast-samtools-sort.
#
# CMA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# CMA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with HISAT. If not, see <http://www.gnu.org/licenses/>.
#
#
# Makefile for fast-samtools-sort
#
INC =
GCC_PREFIX = $(shell dirname `which gcc`)
GCC_SUFFIX =
CC = $(GCC_PREFIX)/gcc$(GCC_SUFFIX)
CPP = $(GCC_PREFIX)/g++$(GCC_SUFFIX)
CXX = $(CPP)
HEADERS = $(wildcard *.h)
FAST_SAMTOOLS_SORT_MM = 1
LINUX = 1
# Detect Cygwin or MinGW
WINDOWS = 0
CYGWIN = 0
MINGW = 0
ifneq (,$(findstring CYGWIN,$(shell uname)))
WINDOWS = 1
CYGWIN = 1
LINUX = 0
else
ifneq (,$(findstring MINGW,$(shell uname)))
WINDOWS = 1
MINGW = 1
LINUX = 0
endif
endif
MACOS = 0
ifneq (,$(findstring Darwin,$(shell uname)))
MACOS = 1
LINUX = 0
endif
PTHREAD_PKG =
PTHREAD_LIB =
ifeq (1,$(MINGW))
PTHREAD_LIB =
else
PTHREAD_LIB = -lpthread
endif
LIBS = $(PTHREAD_LIB)
SHARED_CPPS = tinythread.cpp
VERSION = $(shell cat VERSION)
# Convert BITS=?? to a -m flag
BITS=32
ifeq (x86_64,$(shell uname -m))
BITS=64
endif
# msys will always be 32 bit so look at the cpu arch instead.
ifneq (,$(findstring AMD64,$(PROCESSOR_ARCHITEW6432)))
ifeq (1,$(MINGW))
BITS=64
endif
endif
BITS_FLAG =
ifeq (32,$(BITS))
BITS_FLAG = -m32
endif
ifeq (64,$(BITS))
BITS_FLAG = -m64
endif
SSE_FLAG=-msse2
DEBUG_FLAGS = -O0 -g3 $(BIToS_FLAG) $(SSE_FLAG) -std=c++11
DEBUG_DEFS = -DCOMPILER_OPTIONS="\"$(DEBUG_FLAGS) $(EXTRA_FLAGS)\""
RELEASE_FLAGS = -O3 $(BITS_FLAG) $(SSE_FLAG) -funroll-loops -g3 -std=c++11
RELEASE_DEFS = -DCOMPILER_OPTIONS="\"$(RELEASE_FLAGS) $(EXTRA_FLAGS)\""
NOASSERT_FLAGS = -DNDEBUG
FILE_FLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
CMA_BIN_LIST = fast-samtools-sort
CMA_BIN_LIST_AUX = fast-samtools-sort-debug
GENERAL_LIST = $(wildcard scripts/*.sh) \
$(wildcard scripts/*.pl) \
$(wildcard *.py) \
$(wildcard hisatgenotype_modules/*.py) \
$(wildcard hisatgenotype_scripts/*.py) \
doc/manual.inc.html \
doc/README \
doc/style.css \
$(wildcard example/index/*.ht2) \
$(wildcard example/reads/*.fa) \
example/reference/22_20-21M.fa \
example/reference/22_20-21M.snp \
$(PTHREAD_PKG) \
cma \
cma-bin \
AUTHORS \
LICENSE \
NEWS \
MANUAL \
MANUAL.markdown \
TUTORIAL \
VERSION
ifeq (1,$(WINDOWS))
CMA_BIN_LIST := $(CMA_BIN_LIST) hisat2.bat hisat2-build.bat hisat2-inspect.bat
endif
# This is helpful on Windows under MinGW/MSYS, where Make might go for
# the Windows FIND tool instead.
FIND=$(shell which find)
SRC_PKG_LIST = $(wildcard *.h) \
$(wildcard *.hh) \
$(wildcard *.c) \
$(wildcard *.cpp) \
doc/strip_markdown.pl \
Makefile \
$(GENERAL_LIST)
BIN_PKG_LIST = $(GENERAL_LIST)
.PHONY: all allall both both-debug
all: $(CMA_BIN_LIST)
allall: $(CMA_BIN_LIST) $(CMA_BIN_LIST_AUX)
both: fast-samtools-sort
both-debug: fast-samtools-sort-debug
DEFS=-fno-strict-aliasing \
-DFAST_SAMTOOLS_SORT_VERSION="\"`cat VERSION`\"" \
-DBUILD_HOST="\"`hostname`\"" \
-DBUILD_TIME="\"`date`\"" \
-DCOMPILER_VERSION="\"`$(CXX) -v 2>&1 | tail -1`\"" \
$(FILE_FLAGS) \
$(PREF_DEF) \
$(MM_DEF) \
$(SHMEM_DEF)
fast-samtools-sort: fast_samtools_sort.cpp $(SHARED_CPPS) $(HEADERS)
$(CXX) $(RELEASE_FLAGS) $(RELEASE_DEFS) $(EXTRA_FLAGS) \
$(DEFS) $(NOASSERT_FLAGS) -Wall \
$(INC) \
-o $@ $< \
$(SHARED_CPPS) $(HISAT_CPPS_MAIN) \
$(LIBS) $(SEARCH_LIBS)
fast-samtools-sort-debug: fast_samtools_sort.cpp $(SHARED_CPPS) $(HEADERS)
$(CXX) $(DEBUG_FLAGS) \
$(DEBUG_DEFS) $(EXTRA_FLAGS) \
$(DEFS) -Wall \
$(INC) \
-o $@ $< \
$(SHARED_CPPS) $(HISAT_CPPS_MAIN) \
$(LIBS) $(SEARCH_LIBS)
cma: ;
cma.bat:
echo "@echo off" > hisat2.bat
echo "perl %~dp0/cma %*" >> hisat2.bat
hisat2-build.bat:
echo "@echo off" > hisat2-build.bat
echo "python %~dp0/hisat2-build %*" >> hisat2-build.bat
hisat2-inspect.bat:
echo "@echo off" > hisat2-inspect.bat
echo "python %~dp0/hisat2-inspect %*" >> hisat2-inspect.bat
.PHONY: cma-src
cma-src-pkg: $(SRC_PKG_LIST)
chmod a+x scripts/*.sh scripts/*.pl
mkdir .src.tmp
mkdir .src.tmp/hisat2-$(VERSION)
zip tmp.zip $(SRC_PKG_LIST)
mv tmp.zip .src.tmp/hisat2-$(VERSION)
cd .src.tmp/hisat2-$(VERSION) ; unzip tmp.zip ; rm -f tmp.zip
cd .src.tmp ; zip -r hisat2-$(VERSION)-source.zip hisat2-$(VERSION)
cp .src.tmp/hisat2-$(VERSION)-source.zip .
rm -rf .src.tmp
.PHONY: cma-bin
cma-bin-pkg: $(BIN_PKG_LIST) $(HISAT2_BIN_LIST) $(HISAT2_BIN_LIST_AUX)
chmod a+x scripts/*.sh scripts/*.pl
rm -rf .bin.tmp
mkdir .bin.tmp
mkdir .bin.tmp/hisat2-$(VERSION)
if [ -f hisat2.exe ] ; then \
zip tmp.zip $(BIN_PKG_LIST) $(addsuffix .exe,$(HISAT2_BIN_LIST) $(HISAT2_BIN_LIST_AUX)) ; \
else \
zip tmp.zip $(BIN_PKG_LIST) $(HISAT2_BIN_LIST) $(HISAT2_BIN_LIST_AUX) ; \
fi
mv tmp.zip .bin.tmp/hisat2-$(VERSION)
cd .bin.tmp/hisat2-$(VERSION) ; unzip tmp.zip ; rm -f tmp.zip
cd .bin.tmp ; zip -r hisat2-$(VERSION)-$(BITS).zip hisat2-$(VERSION)
cp .bin.tmp/hisat2-$(VERSION)-$(BITS).zip .
rm -rf .bin.tmp
.PHONY: doc
doc: doc/manual.inc.html MANUAL
doc/manual.inc.html: MANUAL.markdown
pandoc -T "HISAT2 Manual" -o $@ \
--from markdown --to HTML --toc $^
perl -i -ne \
'$$w=0 if m|^</body>|;print if $$w;$$w=1 if m|^<body>|;' $@
MANUAL: MANUAL.markdown
perl doc/strip_markdown.pl < $^ > $@
.PHONY: clean
clean:
rm -f $(CMA_BIN_LIST) $(CMA_BIN_LIST_AUX) \
$(addsuffix .exe,$(CMA_BIN_LIST) $(CMA_BIN_LIST_AUX)) \
cma-src.zip cma-bin.zip
rm -f core.* .tmp.head
rm -rf *.dSYM
.PHONY: push-doc
push-doc: doc/manual.inc.html
scp doc/*.*html doc/indexes.txt salz-dmz:/ccb/salz7-data/www/ccb.jhu.edu/html/software/hisat2/