forked from zkutalik/ssimp_software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbin.stu
executable file
·210 lines (189 loc) · 5.43 KB
/
bin.stu
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
@all: @tags bin/ssimp;
bin/ssimp
:
@report_the_compiler_version
$[LINKER=bin/o/LINKER]
$[LD_FLAGS=bin/o/LD_FLAGS]
bin/o/ssimp.o
bin/o/options.o
bin/o/logging.o
bin/o/file.reading.o
bin/o/file.reading.vcfgztbi.o
bin/o/mvn/mvn.o
bin/o/gz/gzstream/gzstream.o
bin/o/usage_special.o
src/libStatGen/libStatGen.a # 'libStatGen' code now included, with permission
{
echo LINKER:"${LINKER}" | tr '\n' ' '; echo
echo LD_FLAGS:"${LD_FLAGS}" | tr '\n' ' '; echo
${LINKER} \
bin/o/options.o \
bin/o/ssimp.o \
bin/o/logging.o \
bin/o/file.reading.o \
bin/o/file.reading.vcfgztbi.o \
bin/o/mvn/mvn.o \
bin/o/gz/gzstream/gzstream.o \
bin/o/usage_special.o \
src/libStatGen/libStatGen.a \
${LD_FLAGS} \
-o bin/ssimp
}
# This next rule makes a statically-compiled executable, which we copy into the 'compiled/' folder.
# It can't be built on every machine, but it should run on every machine on the same platform (Mac or Linux).
# The binary will be a little bigger.
bin/ssimp-static
: $[LINKER=bin/o/LINKER]
$[LD_FLAGS=bin/o/LD_FLAGS]
bin/o/ssimp.o
bin/o/options.o
bin/o/logging.o
bin/o/file.reading.o
bin/o/file.reading.vcfgztbi.o
bin/o/mvn/mvn.o
bin/o/gz/gzstream/gzstream.o
bin/o/usage_special.o
src/libStatGen/libStatGen.a # I need to think of a rule to automatically build this - must talk to the author about including her code
{
echo LINKER:"${LINKER}" | tr '\n' ' '; echo
echo LD_FLAGS:"${LD_FLAGS}" | tr '\n' ' '; echo
${LINKER} \
-static \
-static-libgcc \
bin/o/options.o \
bin/o/ssimp.o \
bin/o/logging.o \
bin/o/file.reading.o \
bin/o/file.reading.vcfgztbi.o \
bin/o/mvn/mvn.o \
bin/o/gz/gzstream/gzstream.o \
bin/o/usage_special.o \
src/libStatGen/libStatGen.a \
${LD_FLAGS} \
-L /home/dalco/src/gsl-2.4/.libs \
-L /home/dalco/src/gsl-2.4/cblas/.libs \
-o bin/ssimp-static
# The last two -L lines ('...dalco...') are needed to compile the static binary on 'hpc1'
}
> bin/LIST_OF_HH_FILES
: -p bin/o
@unconditional
{
sleep 1 # for a timestamp problem on our NFS
find src -name '*.hh'
}
> src/usage_special.cc : bin.stu doc/usage.txt {
sleep 1
echo "// This file is automatically generated from 'doc/usage.txt'"
echo "#include \"usage_special.hh\""
echo "char const * usage_text = "
echo "R\"--(" | tr -d '\n'
cat doc/usage.txt
echo ")--\";"
}
bin/o/${name}.o
: src/${name}.cc
$[CXX_WITH_FLAGS=bin/o/CXX_WITH_FLAGS]
[bin/LIST_OF_HH_FILES]
src/libStatGen/include/VcfFileReader.h
{
mkdir -p "$(dirname "bin/o/${name}.o")"
${CXX_WITH_FLAGS} -c "src/${name}.cc" -o "bin/o/${name}.o"
}
# special rule for gzstream.o # http://www.cs.unc.edu/Research/compgeom/gzstream/#src
bin/o/gz/gzstream/gzstream.o
: src/gz/gzstream/gzstream.C
$[CXX_WITH_FLAGS=bin/o/CXX_WITH_FLAGS]
[bin/LIST_OF_HH_FILES]
{
mkdir -p bin/o/gz/gzstream
${CXX_WITH_FLAGS} -c "src/gz/gzstream/gzstream.C" -o "bin/o/gz/gzstream/gzstream.o"
}
> bin/o/GCC_OR_CLANG
: -p bin/o
@all.stu.files
{
which g++ g++ c++ clang | head -n1 # find one of these compilers
sleep 1 # for a timestamp problem on our NFS
# Also, include some general args we want to always pass,
# regardless of whether we're compiling or linking
echo " -O3"
echo " -Wall -Wextra -std=c++14"
}
@report_the_compiler_version
: $[CXX_WITH_FLAGS=bin/o/CXX_WITH_FLAGS]
{
echo ============
echo We have found the following C++ compiler on your system.
echo This will be used to compile 'ssimp':
echo
${CXX_WITH_FLAGS} --version
echo ============
}
> bin/o/LINKER
: bin/o/GCC_OR_CLANG
{
sleep 1 # for a timestamp problem on our NFS
cat bin/o/GCC_OR_CLANG
echo " -lstdc++"
}
> bin/o/LD_FLAGS
: bin/local/gsl_libs
bin.stu
{
sleep 1
cat bin/local/gsl_libs
echo " -lz "
}
> bin/o/CXX_WITH_FLAGS
: bin/o/GCC_OR_CLANG
bin/local/gsl_cflags
{
cat bin/o/GCC_OR_CLANG;
echo " -isystem src/gz/gzstream "
echo " -DGZSTREAM_NAMESPACE=gz "
cat bin/local/gsl_cflags
}
bin/local { mkdir -p bin/local }
bin/o { mkdir -p bin/o }
> bin/local/gsl_cflags
: -p bin/local
{
sleep 1 # for a timestamp problem on our NFS
gsl-config --cflags # For example: "-I/usr/include"
}
> bin/local/gsl_libs
: -p bin/local
{
sleep 1 # for a timestamp problem on our NFS
gsl-config --libs # For example: "-lgsl -lgslcblas -lm"
}
@all.stu.files
: main.stu
bin.stu
;
src/libStatGen/libStatGen.a
src/libStatGen/include/VcfFileReader.h
{
# This builds 'libStatGen', used by 'ssimp' to read '.vcf.gz' files, and their '.tbi' indices.
# We've copied the relevant code into this project, minus a few subdirectories.
#
# More info on 'libStatGen' http://genome.sph.umich.edu/wiki/C%2B%2B_Library:_libStatGen#Clone_.28get_your_own_copy.29
#
# It's GPL, as is 'ssimp'
cd src/libStatGen
make all -j
}
@unconditional {}
@clean
{
rm bin/ssimp || :
rm bin/o/CXX_WITH_FLAGS || :
rm bin/LIST_OF_HH_FILES || :
find bin/o -name '*.o' -exec rm {} \;
cd src/libStatGen
make clean
}
@tags {
ctags src/*.??
}