forked from biod/sambamba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.docker
79 lines (59 loc) · 2.09 KB
/
Makefile.docker
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
# Docker makefile
#
# To build sambamba using a Docker image
#
# make -f Makefile.docker
#
# To run with the DMD compiler instead:
#
# make DRUN="dlanguage/dmd dmd" -f Makefile.docker
#
# run with
#
# ./build/sambamba
#
# Note: you'll need to set the correct LIB_PATHS for libz and libz4 your system
DRUN=dlanguage/ldc ldc2
# Mount the lib search paths on Docker for libz and libz4
LIBZ_LIB_PATH=/gnu/store/yd7bplsvf9nj72wn2z6n38rq9hfmjgd9-zlib-1.2.11/lib
LIBZ4_LIB_PATH=/gnu/store/2n80sdqh39y3sgrfyd97ag0sjx5bx9dl-lz4-1.8.0/lib
CWD=$(shell pwd)
D_COMPILER=docker run -v $(LIBZ_LIB_PATH):$(LIBZ_LIB_PATH) -v $(LIBZ4_LIB_PATH):$(LIBZ4_LIB_PATH) -v $(CWD):/src $(DRUN)
DFLAGS = -wi -I. -IBioD -IundeaD/src
LIBS = htslib/libhts.a -L-L$(LIBZ4_LIB_PATH) -L-L$(LIBZ_LIB_PATH) -L-L$(LDC_LIB_PATH) -L-L$(CWD)/lib -L-lrt -L-lpthread -L-lm -L-lz -L-llz4
SRC = $(wildcard main.d utils/*.d thirdparty/*.d cram/*.d) $(wildcard undeaD/src/undead/*.d) $(wildcard BioD/bio/*/*.d BioD/bio/*/*/*.d) $(wildcard sambamba/*.d sambamba/*/*.d sambamba/*/*/*.d)
OBJ = $(SRC:.d=.o) utils/ldc_version_info_.o
OUT = build/sambamba
.PHONY: all
debug: DFLAGS += -O0 -g -d-debug -link-debuglib
all: debug
htslib-static:
cd htslib && $(MAKE)
ldc-version-info:
./gen_ldc_version_info.py $(shell which ldmd2) > utils/ldc_version_info_.d
utils/ldc_version_info_.o: ldc-version-info
$(D_COMPILER) $(DFLAGS) -c utils/ldc_version_info_.d -od=$(dir $@)
build-setup: htslib-static ldc-version-info
mkdir -p build/
guix guix-debug default debug release static profile: $(OUT)
# ---- Compile step
%.o: %.d
$(D_COMPILER) $(DFLAGS) -c $< -od=$(dir $@)
# ---- Link step
$(OUT): build-setup $(OBJ)
$(D_COMPILER) $(DFLAGS) -of=build/sambamba $(OBJ) $(LIBS)
test:
./run_tests.sh
check: test
debug-strip: debug
objcopy --only-keep-debug build/sambamba sambamba.debug
objcopy --strip-debug build/sambamba
objcopy --add-gnu-debuglink=sambamba.debug build/sambamba
mv sambamba.debug build/
clean-d:
rm -rf build/*
rm -f $(OBJ) $(OUT) trace.{def,log}
install:
install -m 0755 build/sambamba $(prefix)/bin
clean: clean-d
cd htslib ; make clean