| 1 |
# Makefile for filterBam |
| 2 |
|
| 3 |
include ../../../common.mk |
| 4 |
|
| 5 |
# set to true if the SeqLib library should used to handle bam files |
| 6 |
#USE_SEQLIB ?= true |
| 7 |
# set to true if the seqlib library version is 1.1.1 (various bugs and api changes are taken into account) |
| 8 |
#SEQLIB_1_1_1 ?= true |
| 9 |
# set to true if the seqlib library version is 1.1.2 (various bugs and api changes are taken into account) |
| 10 |
#SEQLIB_1_1_2 ?= true |
| 11 |
|
| 12 |
CXX ?= g++ |
| 13 |
CXXFLAGS := -Wall -Wextra -Wpedantic -std=c++11 -O3 ${CXXFLAGS} |
| 14 |
|
| 15 |
SOURCES = filterBam.cc initOptions.cc printElapsedTime.cc MatePairs.cc PairednessCoverage.cc |
| 16 |
INCLS += -I./headers |
| 17 |
|
| 18 |
ifneq (,$(findstring $(USE_SEQLIB),1 true True TRUE)) # if USE_SEQLIB is defined and contains 1, true, True or TRUE |
| 19 |
# use SeqLib library |
| 20 |
SOURCES += BamSeqLibAccess.cc |
| 21 |
# default locations: |
| 22 |
INCLUDE_PATH_SEQLIB ?= -I /usr/include/SeqLib -I/usr/include/htslib -I/usr/include/jsoncpp -I/usr/local/include/SeqLib -I/usr/local/include/htslib -I/usr/include/jsoncpp |
| 23 |
INCLS += $(INCLUDE_PATH_SEQLIB) |
| 24 |
LDFLAGS += $(LIBRARY_PATH_SEQLIB) |
| 25 |
LDLIBS += -lseqlib -lfml -lbwa -lhts -lm -llzma -lpthread |
| 26 |
CPPFLAGS += -DUSE_SEQLIB |
| 27 |
|
| 28 |
ifneq (,$(findstring $(SEQLIB_1_1_1),1 true True TRUE)) # if SEQLIB_1_1_1 is defined and contains 1, true, True or TRUE |
| 29 |
LDLIBS += -lssw -ljsoncpp |
| 30 |
CPPFLAGS += -DSEQLIB_1_1_1 |
| 31 |
else ifneq (,$(findstring $(SEQLIB_1_1_2),1 true True TRUE)) # if SEQLIB_1_1_2 is defined and contains 1, true, True or TRUE |
| 32 |
LDLIBS += -lssw -ljsoncpp |
| 33 |
CPPFLAGS += -DSEQLIB_1_1_2 |
| 34 |
else |
| 35 |
LDLIBS += -lbz2 |
| 36 |
CPPFLAGS += -DSEQLIB_1_2 |
| 37 |
endif |
| 38 |
else # use BamTools library |
| 39 |
SOURCES += BamToolsAccess.cc |
| 40 |
# keep compatibility with old versions still using BAMTOOLS_INSTALL_DIR |
| 41 |
BAMTOOLS_INSTALL_DIR ?= /usr |
| 42 |
|
| 43 |
# sets the default locations if it has not already been set in common.mk |
| 44 |
INCLUDE_PATH_BAMTOOLS ?= -I$(BAMTOOLS_INSTALL_DIR)/include/bamtools |
| 45 |
LIBRARY_PATH_BAMTOOLS ?= -L$(BAMTOOLS_INSTALL_DIR)/lib -Wl,-rpath,$(BAMTOOLS_INSTALL_DIR)/lib |
| 46 |
|
| 47 |
INCLS += $(INCLUDE_PATH_BAMTOOLS) |
| 48 |
LDFLAGS += $(LIBRARY_PATH_BAMTOOLS) |
| 49 |
LDLIBS += -lbamtools |
| 50 |
endif |
| 51 |
|
| 52 |
OBJS = $(SOURCES:.cc=.o) |
| 53 |
INCLS += $(INCLUDE_PATH_ZLIB) |
| 54 |
LDFLAGS += $(LIBRARY_PATH_ZLIB) |
| 55 |
LDLIBS += -lz |
| 56 |
VPATH = functions |
| 57 |
|
| 58 |
.PHONY: all clean |
| 59 |
|
| 60 |
all: filterBam |
| 61 |
mkdir -p ../../../bin |
| 62 |
mv filterBam ../../../bin/filterBam |
| 63 |
|
| 64 |
filterBam: $(OBJS) |
| 65 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) |
| 66 |
|
| 67 |
$(OBJS): %.o: %.cc |
| 68 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLS) -c $^ |
| 69 |
|
| 70 |
|
| 71 |
clean: |
| 72 |
rm -f *~ $(OBJS) |
| 73 |
rm -f filterBam |
| 74 |
rm -f ../../../bin/filterBam |