forked from rrwick/Porechop
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
executable file
·101 lines (75 loc) · 2.99 KB
/
Makefile
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
# This makefile will build the C++ components of Porechop.
# EDIT: qbonenfant
# Modified the makefile so it also build approx_counter tool
# Example commands:
# make (build in release mode)
# make debug (build in debug mode)
# make clean (deletes *.o files, which aren't required to run the aligner)
# make distclean (deletes *.o files and the *.so file, which is required to run the aligner)
# make CXX=g++-5 (build with a particular compiler)
# make CXXFLAGS="-Werror -g3" (build with particular compiler flags)
# CXX and CXXFLAGS can be overridden by the user.
CXX ?= g++
CXXFLAGS ?= -Wall -Wextra -pedantic -mtune=native
# These flags are required for the build to work.
FLAGS = -std=c++17 -Iporechop_abi/include -fPIC
SHARED = -shared # trying to fix LDFLAG issues by splitting shared / not shared
LDFLAGS ?= -Lporechop_abi/include
# Different debug/optimisation levels for debug/release builds.
DEBUGFLAGS = -DSEQAN_ENABLE_DEBUG=1 -g
RELEASEFLAGS = -O3 -D NDEBUG
TARGET = porechop_abi/cpp_functions.so
SHELL = /bin/sh
# modified SOURCES / HEADER to only search cpp/h file in src folder
SOURCES = $(shell find porechop_abi/src -name "*.cpp")
HEADERS = $(shell find porechop_abi/src -name "*.h")
OBJECTS = $(SOURCES:.cpp=.o)
# Adapt finder (k-mer approximate counter)
APPROXCOUNTER_TGT = porechop_abi/approx_counter
APPROXCOUNTER_SRC = porechop_abi/ab_initio_src/approx_counter.cpp
APPROXCOUNTER_FLAG = -DSEQAN_HAS_ZLIB=1
# Compatibility flag library
COMPAT_TGT = porechop_abi/compatibility.so
COMPAT_SRC = porechop_abi/ab_initio_src/compatibility.cpp
COMPAT_HDR = porechop_abi/ab_initio_src/compatibility.h
COMPAT_OBJ = $(COMPAT_SRC:.cpp=.o)
# Adding Compatibility library header to headers list
HEADERS+=$(COMPAT_HDR)
# MSA consensus
MSA_TGT = porechop_abi/msa_consensus
MSA_SRC = porechop_abi/ab_initio_src/msa_consensus.cpp
# Linux needs '-soname' while Mac needs '-install_name'
PLATFORM = $(shell uname)
ifeq ($(PLATFORM), Darwin)
SONAME = -install_name
OMP =
LRT =
LZ = -lz
FLAGS += -D_LIBCPP_DISABLE_AVAILABILITY
else
SONAME = -soname
OMP = -fopenmp
LRT = -lrt
LZ = -lz
endif
all: $(TARGET) $(COMPAT_TGT) $(MSA_TGT) $(APPROXCOUNTER_TGT)
.PHONY: release
release: FLAGS+=$(RELEASEFLAGS)
release: all
.PHONY: debug
debug: FLAGS+=$(DEBUGFLAGS)
debug: all
$(TARGET): $(OBJECTS)
$(CXX) $(FLAGS) $(CXXFLAGS) $(SHARED) $(LDFLAGS) -Wl,$(SONAME),$(TARGET) -o $(TARGET) $(OBJECTS)
$(APPROXCOUNTER_TGT):
$(CXX) $(FLAGS) $(APPROXCOUNTER_FLAG) $(OMP) $(CXXFLAGS) $(LDFLAGS) $(APPROXCOUNTER_SRC) $(LRT) $(LZ) -o $(APPROXCOUNTER_TGT)
$(COMPAT_TGT): $(COMPAT_OBJ)
$(CXX) $(FLAGS) $(CXXFLAGS) $(SHARED) $(LDFLAGS) -Wl,$(SONAME),$(COMPAT_TGT) -o $(COMPAT_TGT) $(COMPAT_OBJ)
$(MSA_TGT):
$(CXX) $(FLAGS) $(OMP) $(CXXFLAGS) $(LDFLAGS) $(MSA_SRC) $(LRT) -o $(MSA_TGT)
clean:
$(RM) $(OBJECTS) $(COMPAT_OBJ)
distclean: clean
$(RM) $(TARGET) $(APPROXCOUNTER_TGT) $(COMPAT_TGT) $(MSA_TGT)
%.o: %.cpp $(HEADERS)
$(CXX) $(FLAGS) $(CXXFLAGS) -c -o $@ $<