| 1 |
DEBUG ?= 0 |
| 2 |
PARALLEL ?= 0 |
| 3 |
STATIC ?= 0 |
| 4 |
|
| 5 |
|
| 6 |
PWD = $(shell pwd) |
| •7 |
EBROOTHTSLIB ?= /usr/include/htslib/ |
| 8 |
|
| 9 |
|
| 10 |
prefix = ${PWD} |
| 11 |
exec_prefix = $(prefix) |
| 12 |
bindir ?= $(exec_prefix)/bin |
| 13 |
|
| 14 |
|
| 15 |
CXX ?= g++ |
| 16 |
CXXFLAGS += -std=c++17 -isystem ${EBROOTHTSLIB} -pedantic -W -Wall -Wno-unknown-pragmas -D__STDC_LIMIT_MACROS -fno-strict-aliasing -fpermissive -pthread |
| 17 |
LDFLAGS += -L${EBROOTHTSLIB} -lboost_iostreams -lboost_filesystem -lboost_program_options -lboost_date_time -pthread |
| 18 |
|
| 19 |
|
| 20 |
ifeq (${STATIC}, 1) |
| 21 |
LDFLAGS += -static -static-libgcc -lhts -lz -llzma -lbz2 -ldeflate |
| 22 |
else |
| 23 |
LDFLAGS += -lhts -lz -llzma -lbz2 -Wl,-rpath,${EBROOTHTSLIB} |
| 24 |
endif |
| 25 |
|
| 26 |
|
| 27 |
ifeq (${DEBUG}, 1) |
| 28 |
CXXFLAGS += -g -O0 -fno-inline -DDEBUG |
| 29 |
else ifeq (${DEBUG}, 2) |
| 30 |
CXXFLAGS += -g -O0 -fno-inline -DPROFILE |
| 31 |
LDFLAGS += -lprofiler -ltcmalloc |
| 32 |
else |
| 33 |
CXXFLAGS += -O3 -fno-tree-vectorize -DNDEBUG |
| 34 |
endif |
| 35 |
ifeq (${EBROOTHTSLIB}, ${PWD}/src/htslib/) |
| 36 |
SUBMODULES += .htslib |
| 37 |
endif |
| 38 |
|
| 39 |
|
| 40 |
HTSLIBSOURCES = $(wildcard src/htslib/*.c) $(wildcard src/htslib/*.h) |
| 41 |
SOURCES = $(wildcard src/*.h) $(wildcard src/*.cpp) |
| 42 |
|
| 43 |
|
| 44 |
BUILT_PROGRAMS = src/delly |
| 45 |
TARGETS = ${SUBMODULES} ${BUILT_PROGRAMS} |
| 46 |
|
| 47 |
all: $(TARGETS) |
| 48 |
|
| 49 |
.htslib: $(HTSLIBSOURCES) |
| 50 |
if [ -r src/htslib/Makefile ]; then cd src/htslib && autoreconf -i && ./configure --disable-s3 --disable-gcs --disable-libcurl --disable-plugins && $(MAKE) && $(MAKE) lib-static && cd ../../ && touch .htslib; fi |
| 51 |
|
| 52 |
src/delly: ${SUBMODULES} $(SOURCES) |
| 53 |
$(CXX) $(CXXFLAGS) [email protected] src/edlib.cpp -o $@ $(LDFLAGS) |
| 54 |
|
| 55 |
install: ${BUILT_PROGRAMS} |
| 56 |
mkdir -p ${bindir} |
| 57 |
install -p ${BUILT_PROGRAMS} ${bindir} |
| 58 |
|
| 59 |
clean: |
| 60 |
if [ -r src/htslib/Makefile ]; then cd src/htslib && $(MAKE) clean; fi |
| 61 |
rm -f $(TARGETS) $(TARGETS:=.o) ${SUBMODULES} |
| 62 |
|
| 63 |
distclean: clean |
| 64 |
rm -f ${BUILT_PROGRAMS} |
| 65 |
|
| 66 |
.PHONY: clean distclean install all |