ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gclib/Makefile
(Generate patch)
# Line 3 | Line 3
3  
4   SYSTYPE :=     $(shell uname)
5  
6 < MACHTYPE :=     $(shell uname -m)
7 < ifeq ($(MACHTYPE), i686)
8 <    MARCH = -march=i686
6 > # A simple hack to check if we are on Windows or not (i.e. are we using mingw32-make?)
7 > ifeq ($(findstring mingw32, $(MAKE)), mingw32)
8 > WINDOWS=1
9 > endif
10 >
11 >
12 > # Compiler settings
13 > TLIBS =
14 > LDFLAGS =
15 > # Non-windows systems need pthread
16 > ifndef WINDOWS
17 > TLIBS += -lpthread
18 > endif
19 >
20 > # MinGW32 GCC 4.5 link problem fix
21 > ifdef WINDOWS
22 > ifeq ($(findstring 4.5.,$(shell g++ -dumpversion)), 4.5.)
23 > LDFLAGS += -static-libstdc++ -static-libgcc
24 > endif
25 > endif
26 >
27 > # Misc. system commands
28 > ifdef WINDOWS
29 > RM = del /Q
30 > else
31 > RM = rm -f
32 > endif
33 >
34 > # File endings
35 > ifdef WINDOWS
36 > EXE = .exe
37   else
38 <    MARCH =
39 < endif    
38 > EXE =
39 > endif
40  
41   CC      := g++
42  
43 < BASEFLAGS  := -Wall -Wextra ${SEARCHDIRS} $(MARCH) -D_FILE_OFFSET_BITS=64 \
44 < -D_LARGEFILE_SOURCE -D_REENTRANT -fno-exceptions -fno-rtti
43 > BASEFLAGS  := -Wall -Wextra ${SEARCHDIRS} $(MARCH) \
44 > -D_REENTRANT -fno-exceptions -fno-rtti
45  
46   #add the link-time optimization flag if gcc version > 4.5
47   GCC_VERSION:=$(subst ., ,$(shell gcc -dumpversion))
# Line 27 | Line 55
55  
56   ifeq ($(findstring debug,$(MAKECMDGOALS)),)
57    CFLAGS := -O2 -DNDEBUG $(BASEFLAGS)
30  LDFLAGS :=
58    ifeq ($(shell expr $(GCC_MAJOR).$(GCC_MINOR) '>=' 4.5),1)
59      CFLAGS += -flto
60      GCC45OPTS := -flto
# Line 35 | Line 62
62    endif
63   else
64    CFLAGS := -g -DDEBUG $(BASEFLAGS)
65 <  LDFLAGS := -g
65 >  LDFLAGS += -g
66   endif
67  
68   %.o : %.cpp
# Line 48 | Line 75
75   OBJS := GBase.o GStr.o GArgs.o
76  
77   .PHONY : all
78 < all:    gtest
78 > all:    gtest threads
79  
80   version: ; @echo "GCC Version is: "$(GCC_MAJOR)":"$(GCC_MINOR)":"$(GCC_SUB)
81          @echo "> GCC Opt. string is: "$(GCC45OPTS)
82 < debug:  gtest
82 > debug:  gtest threads
83   $(OBJS) : GBase.h GArgs.h
84   gtest.o : GBase.h GArgs.h
85   GArgs.o : GArgs.h
86   gtest: $(OBJS) gtest.o
87          ${LINKER} ${LDFLAGS} $(GCC45OPTS) $(GCC45OPTMAIN) -o $@ ${filter-out %.a %.so, $^} ${LIBS}
88 <
88 > threads: GThreads.o threads.o
89 >        ${LINKER} ${LDFLAGS} $(GCC45OPTS) $(GCC45OPTMAIN) -o $@ ${filter-out %.a %.so, $^} ${TLIBS} ${LIBS}
90 > GThreads.o: GThreads.h GThreads.cpp
91 > threads.o : GThreads.h GThreads.cpp
92   # target for removing all object files
93  
94   .PHONY : clean
95   clean::
96 <        @${RM} gtest gtest.o gtest.exe $(OBJS)
96 >        @${RM} $(OBJS) gtest.o GThreads.o threads.o threads$(EXE) gtest$(EXE)
97          @${RM} core.*
98  
99  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines