forked from gpertea/stringtie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
125 lines (97 loc) · 2.69 KB
/
Makefile
File metadata and controls
125 lines (97 loc) · 2.69 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
BAM := ./samtools-0.1.18
#path to the directory where the samtools package was built (in place)
#so libbam.a and *.h files MUST be in here
GDIR :=./gclib
SEARCHDIRS := -I. -I${GDIR} -I${BAM}
#CC := clang++
CC := g++
ifneq (,$(findstring nothreads,$(MAKECMDGOALS)))
NOTHREADS=1
endif
#detect MinGW (Windows environment)
ifneq (,$(findstring mingw,$(shell ${CC} -dumpmachine)))
WINDOWS=1
endif
LFLAGS =
# MinGW32 GCC 4.5 link problem fix
#ifdef WINDOWS
ifneq (,$(findstring 4.5.,$(shell g++ -dumpversion)))
LFLAGS += -static-libstdc++ -static-libgcc
endif
#endif
# Misc. system commands
#ifdef WINDOWS
#RM = del /Q
#else
RM = rm -f
#endif
# File endings
ifdef WINDOWS
EXE = .exe
else
EXE =
endif
BASEFLAGS := -Wall -Wextra ${SEARCHDIRS} $(MARCH) -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE_SOURCE -fno-strict-aliasing -fno-exceptions -fno-rtti
# C/C++ linker
#LINKER := clang++
LINKER := g++
LIBS := -lbam -lz
# Non-windows systems need pthread
ifndef WINDOWS
ifndef NOTHREADS
LIBS += -lpthread
endif
ifdef GDEBUG
OBJS += ${GDIR}/proc_mem.o
BASEFLAGS += -DGMEMTRACE
endif
endif
ifdef NOTHREADS
BASEFLAGS += -DNOTHREADS
endif
###----- generic build rule
ifneq (,$(findstring release,$(MAKECMDGOALS)))
CFLAGS := -O2 -DNDEBUG -g $(BASEFLAGS)
LDFLAGS := -g -L${BAM} ${LFLAGS}
else
#make memcheck : use the statically linked address sanitizer in gcc 4.9.x
ifneq (,$(findstring mem,$(MAKECMDGOALS)))
CFLAGS := -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address $(BASEFLAGS)
CFLAGS := -g -DDEBUG -D_DEBUG -DGDEBUG -fno-common -fstack-protector $(CFLAGS)
LDFLAGS := -g -L${BAM}
LIBS := -Wl,-Bstatic -lasan -lubsan -Wl,-Bdynamic -ldl $(LIBS)
else
CFLAGS := -g -DDEBUG -D_DEBUG -DGDEBUG $(BASEFLAGS)
LDFLAGS := -g -L${BAM}
endif
GDEBUG = 1
endif
%.o : %.cpp
${CC} ${CFLAGS} -c $< -o $@
OBJS := ${GDIR}/GBase.o ${GDIR}/GArgs.o ${GDIR}/GStr.o ${GDIR}/GBam.o \
${GDIR}/gdna.o ${GDIR}/codons.o ${GDIR}/GFaSeqGet.o ${GDIR}/gff.o
ifndef NOTHREADS
OBJS += ${GDIR}/GThreads.o
endif
OBJS += rlink.o tablemaker.o
.PHONY : all debug clean release nothreads
all: stringtie
release: stringtie
debug: stringtie
memcheck: stringtie
memdebug: stringtie
nothreads: stringtie
${GDIR}/GBam.o : $(GDIR)/GBam.h
stringtie.o : $(GDIR)/GBitVec.h $(GDIR)/GHash.hh $(GDIR)/GBam.h
rlink.o : rlink.h tablemaker.h $(GDIR)/GBam.h $(GDIR)/GBitVec.h
tablemaker.o : tablemaker.h rlink.h
${BAM}/libbam.a:
cd ${BAM} && make lib
stringtie: ${BAM}/libbam.a $(OBJS) stringtie.o
${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LIBS}
# target for removing all object files
clean:
cd ${BAM} && make clean
@${RM} stringtie stringtie.o* stringtie.exe $(OBJS)
@${RM} core.*