ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/bamread/Makefile
Revision: 123
Committed: Mon Dec 5 22:21:21 2011 UTC (8 years ago) by gpertea
File size: 1970 byte(s)
Log Message:
bamread files

Line File contents
1 GCLDIR := ../gclib
2 #if you just built samtools (using `make`) in a local directory
3 #you can point both BAM_INCDIR and BAM_LIBDIR to that directory
4 #(libbam.a file should be there)
5 BAM_INCDIR := /opt/geo/include/bam
6 BAM_LIBDIR := /opt/geo/lib
7
8 SEARCHDIRS := -I. -I${GCLDIR} -I${BAM_INCDIR}
9
10 SYSTYPE := $(shell uname)
11
12 MACHTYPE := $(shell uname -m)
13 ifeq ($(MACHTYPE), i686)
14 MARCH = -march=i686
15 else
16 MARCH =
17 endif
18
19 CC := g++
20
21 BASEFLAGS := -Wall -Wextra ${SEARCHDIRS} $(MARCH) \
22 -D_REENTRANT -fno-strict-aliasing -fno-exceptions -fno-rtti
23
24 #add the link-time optimization flag if gcc version > 4.5
25 GCC_VERSION:=$(subst ., ,$(shell gcc -dumpversion))
26 GCC_MAJOR:=$(word 1,$(GCC_VERSION))
27 GCC_MINOR:=$(word 2,$(GCC_VERSION))
28 #GCC_SUB:=$(word 3,$(GCC_VERSION))
29 GCC_SUB:=x
30
31 GCC45OPTS :=
32 GCC45OPTMAIN :=
33
34 ifeq ($(findstring debug,$(MAKECMDGOALS)),)
35 CFLAGS := -O2 -DNDEBUG $(BASEFLAGS)
36 LDFLAGS := -L${BAM_LIBDIR}
37 ifeq ($(shell expr $(GCC_MAJOR).$(GCC_MINOR) '>=' 4.5),1)
38 CFLAGS += -flto
39 GCC45OPTS := -flto
40 GCC45OPTMAIN := -fwhole-program
41 endif
42 else
43 CFLAGS := -g -DDEBUG $(BASEFLAGS)
44 LDFLAGS := -g -L${BAM_LIBDIR}
45 endif
46
47 %.o : %.cpp
48 ${CC} ${CFLAGS} -c $< -o $@
49
50 # C/C++ linker
51
52 LINKER := g++
53 LIBS := -lz -lbam
54 OBJS := ${GCLDIR}/GBase.o ${GCLDIR}/GArgs.o ${GCLDIR}/GStr.o \
55 ${GCLDIR}/GBam.o
56 # ${GCLDIR}/gdna.o ${GCLDIR}/codons.o ${GCLDIR}/gff.o ${GCLDIR}/GStr.o \
57 # ${GCLDIR}/GFastaIndex.o gff_utils.o
58
59 .PHONY : all
60 all: bamread
61 debug: bamread
62 version: ; @echo "GCC Version is: "$(GCC_MAJOR)":"$(GCC_MINOR)":"$(GCC_SUB)
63 @echo "> GCC Opt. string is: "$(GCC45OPTS)
64 $(OBJS) : $(GCLDIR)/GBase.h $(GCLDIR)/GBase.h
65 bamread.o : $(GCLDIR)/GBam.h
66 GBam.o : $(GCLDIR)/GBam.h
67
68 bamread: $(OBJS) bamread.o
69 ${LINKER} ${LDFLAGS} $(GCC45OPTS) $(GCC45OPTMAIN) -o $@ ${filter-out %.a %.so, $^} ${LIBS}
70
71 # target for removing all object files
72
73 .PHONY : clean
74 clean::
75 @${RM} bamread bamread.o* bamread.exe $(OBJS)
76 @${RM} core.*