ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gffread/Makefile
(Generate patch)
# Line 1 | Line 1
1 # Useful directories
2
3 THISCODEDIR := .
1   GCLDIR := ../gclib
2 < SEARCHDIRS := -I${THISCODEDIR} -I${GCLDIR}
2 > SEARCHDIRS := -I. -I${GCLDIR}
3  
4   SYSTYPE :=     $(shell uname)
5  
# Line 13 | Line 10
10      MARCH =
11   endif    
12  
16
13   CC      := g++
18 BASEFLAGS  = -Wall ${SEARCHDIRS} $(MARCH) -D_FILE_OFFSET_BITS=64 \
19 -D_LARGEFILE_SOURCE -fno-exceptions -fno-rtti -fno-strict-aliasing \
20 -D_REENTRANT
14  
15 + BASEFLAGS  := -Wall -Wextra ${SEARCHDIRS} $(MARCH) -D_FILE_OFFSET_BITS=64 \
16 + -D_LARGEFILE_SOURCE -D_REENTRANT -fno-exceptions -fno-rtti
17 +
18 + #add the link-time optimization flag if gcc version > 4.5
19 + GCC_VERSION:=$(subst ., ,$(shell gcc -dumpversion))
20 + GCC_MAJOR:=$(word 1,$(GCC_VERSION))
21 + GCC_MINOR:=$(word 2,$(GCC_VERSION))
22 + #GCC_SUB:=$(word 3,$(GCC_VERSION))
23 + GCC_SUB:=x
24 +
25 + GCC45OPTS :=
26 + GCC45OPTMAIN :=
27  
28   ifeq ($(findstring debug,$(MAKECMDGOALS)),)
29 <  CFLAGS = -O2 -DNDEBUG $(BASEFLAGS)
30 <  LDFLAGS =
29 >  CFLAGS := -O2 -DNDEBUG $(BASEFLAGS)
30 >  LDFLAGS :=
31 >  ifeq ($(shell expr $(GCC_MAJOR).$(GCC_MINOR) '>=' 4.5),1)
32 >    CFLAGS += -flto
33 >    GCC45OPTS := -flto
34 >    GCC45OPTMAIN := -fwhole-program
35 >  endif
36   else
37 <  CFLAGS = -g -DDEBUG $(BASEFLAGS)
38 <  LDFLAGS = -g
37 >  CFLAGS := -g -DDEBUG $(BASEFLAGS)
38 >  LDFLAGS := -g
39   endif
40  
31 %.o : %.c
32        ${CC} ${CFLAGS} -c $< -o $@
33
34 %.o : %.cc
35        ${CC} ${CFLAGS} -c $< -o $@
36
37 %.o : %.C
38        ${CC} ${CFLAGS} -c $< -o $@
39
41   %.o : %.cpp
42          ${CC} ${CFLAGS} -c $< -o $@
43  
43 %.o : %.cxx
44        ${CC} ${CFLAGS} -c $< -o $@
45
44   # C/C++ linker
45  
46 < LINKER    := g++
47 < LIBS =
48 < OBJS = ${GCLDIR}/gff.o ${GCLDIR}/gdna.o ${GCLDIR}/codons.o \
49 < ${GCLDIR}/GBase.o ${GCLDIR}/GFaSeqGet.o ${GCLDIR}/GStr.o \
50 < ${GCLDIR}/GArgs.o ${GCLDIR}/gcdb.o ${GCLDIR}/GCdbYank.o ./gffread.o
46 > LINKER  := g++
47 > LIBS :=
48 > OBJS := ${GCLDIR}/GBase.o ${GCLDIR}/GArgs.o ${GCLDIR}/GFaSeqGet.o \
49 > ${GCLDIR}/gdna.o ${GCLDIR}/codons.o ${GCLDIR}/gff.o ${GCLDIR}/GStr.o \
50 > ${GCLDIR}/GFastaIndex.o gff_utils.o
51 > # ${GCLDIR}/gcdb.o ${GCLDIR}/GCdbYank.o
52  
53   .PHONY : all
54   all:    gffread
55 +
56 + version: ; @echo "GCC Version is: "$(GCC_MAJOR)":"$(GCC_MINOR)":"$(GCC_SUB)
57 +        @echo "> GCC Opt. string is: "$(GCC45OPTS)
58   debug:  gffread
59 < gffread: ${OBJS}
60 <        ${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LIBS}
59 > $(OBJS) : $(GCLDIR)/GBase.h $(GCLDIR)/gff.h
60 > gffread.o : gff_utils.h $(GCLDIR)/GBase.h $(GCLDIR)/gff.h
61 > gff_utils.o : gff_utils.h $(GCLDIR)/gff.h
62 > ${GCLDIR}/gff.o : ${GCLDIR}/gff.h ${GCLDIR}/GFaSeqGet.h ${GCLDIR}/GList.hh ${GCLDIR}/GHash.hh
63 > ${GCLDIR}/GFaSeqGet.o : ${GCLDIR}/GFaSeqGet.h
64 > gffread: $(OBJS) gffread.o
65 >        ${LINKER} ${LDFLAGS} $(GCC45OPTS) $(GCC45OPTMAIN) -o $@ ${filter-out %.a %.so, $^} ${LIBS}
66  
67   # target for removing all object files
68  
69   .PHONY : clean
70   clean::
71 <        @${RM} core core.* gffread gffread.exe *.o* ${OBJS}
71 >        @${RM} gffread gffread.o* gffread.exe $(OBJS)
72 >        @${RM} core.*
73  
74  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines