@@ -5,30 +5,37 @@ HTSLIB_PATH=-Lhtslib
5
5
HTSLIB_SUBCMD =$(HTSLIB_PATH ) -Wl,-Bstatic -lhts -Wl,-Bdynamic
6
6
RDMD_FLAGS =--force --build-only --compiler=$(D_COMPILER ) $(D_FLAGS )
7
7
8
+ # Linux & DMD only - this goal is used because of fast compilation speed, during development
8
9
all : htslib-static
9
10
mkdir -p build/
10
11
rdmd --force --build-only $(D_FLAGS ) -c -ofbuild/sambamba.o main.d
11
12
gcc -Wl,--gc-sections -o build/sambamba build/sambamba.o $(HTSLIB_SUBCMD ) -l:libphobos2.a -lrt -lpthread -lm
12
13
14
+ PLATFORM := $(shell uname -s)
15
+
16
+ ifeq "$(PLATFORM ) " "Darwin"
17
+ LINK_CMD =gcc -dead_strip -lphobos2-ldc -ldruntime-ldc -lm -lpthread htslib/libhts.a build/sambamba.o -o build/sambamba
18
+ else
19
+ LINK_CMD =gcc -Wl,--gc-sections -o build/sambamba build/sambamba.o $(HTSLIB_SUBCMD ) -l:libphobos2-ldc.a -l:libdruntime-ldc.a -lrt -lpthread -lm
20
+ endif
21
+
22
+ # This is the main Makefile goal, used for building releases (best performance)
13
23
sambamba-ldmd2-64 : htslib-static
14
24
mkdir -p build/
15
25
ldmd2 @sambamba-ldmd-release.rsp
16
- gcc -Wl,--gc-sections -o build/sambamba build/sambamba.o $( HTSLIB_SUBCMD ) -l:libphobos2-ldc.a -l:libdruntime-ldc.a -lrt -lpthread -lm
26
+ $( LINK_CMD )
17
27
28
+ # For debugging; GDB & Valgrind are more friendly to executables created using LDC/GDC than DMD
18
29
sambamba-ldmd2-debug : htslib-static
19
30
mkdir -p build/
20
31
ldmd2 @sambamba-ldmd-debug.rsp
21
- gcc -Wl,--gc-sections -o build/sambamba build/sambamba.o $( HTSLIB_SUBCMD ) -l:libphobos2-ldc.a -l:libdruntime-ldc.a -lrt -lpthread -lm
32
+ $( LINK_CMD )
22
33
23
34
htslib-static :
24
35
cd htslib && $(MAKE )
25
36
26
37
# all below link to libhts dynamically for simplicity
27
38
28
- sambamba-ldmd2-64-osx :
29
- mkdir -p build/
30
- rdmd --force --build-only --compiler=ldmd2 -IBioD -O -L-lhts -release -inline -noboundscheck -ofbuild/sambamba main.d
31
-
32
39
sambamba-flagstat :
33
40
mkdir -p build/
34
41
rdmd $(RDMD_FLAGS ) -L-lhts -version=standalone -ofbuild/sambamba-flagstat sambamba/flagstat.d
0 commit comments