source: trunk/config/sys/Linux-g++.gmk @ 886

Last change on this file since 886 was 886, checked in by garnier, 16 years ago

change and better Leopard check on Mac OSX

File size: 3.8 KB
Line 
1#
2# ------ GNU/LINUX ------ gcc 3.2 and higher
3#
4ifeq ($(G4SYSTEM),Linux-g++)
5  CXX       := g++
6  CXXFLAGS  := -W -Wall -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
7  CXXFLAGS  += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
8#
9# Uncomment the following options to activate Pentium4 chip specific
10# floating-point operations on the SSE unit. It will allow for more stable
11# results (no output differences between debug/optimised runs) and little
12# performance improvement (in the order of 2%).
13# NOTE: binaries built using these options will NOT be portable cross
14#       platforms. Will only run on Pentium4-based architectures !
15#
16# CXXFLAGS  += -march=pentium4 -mfpmath=sse
17  ifdef G4OPTIMISE
18    CXXFLAGS  += -O2
19    FCFLAGS   := -O2
20    CCFLAGS   := -O2
21  else
22    ifdef G4DEBUG
23      CXXFLAGS  += -g
24      FCFLAGS   := -g
25      CCFLAGS   := -g
26    endif
27  endif
28  ifdef G4PROFILE
29    CXXFLAGS  += -pg
30    FCFLAGS   += -pg
31    CCFLAGS   += -pg
32  endif
33  ifdef G4OPTDEBUG
34    CXXFLAGS  += -O2 -g
35    FCFLAGS   += -O2 -g
36    CCFLAGS   += -O2 -g
37  endif
38  ifdef G4LIB_BUILD_SHARED
39    CXXFLAGS  += -fPIC
40    FCFLAGS   += -fPIC
41    CCFLAGS   += -fPIC
42  endif
43  G4RUNPATHOPTION := -Wl,-rpath
44  CC := gcc
45  FC := gfortran
46  FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
47  FCLIBS := -lg2c -lnsl
48  ECHO    := /bin/echo -e
49  SHEXT   := so
50  ifndef X11FLAGS
51    X11FLAGS  := -I/usr/include/X11/extensions -I/usr/include/X11
52  endif
53  ifndef X11LIBS
54    X11LIBS   := -L/usr/X11R6/lib  -lXmu -lXt -lXext -lX11 -lSM -lICE
55  endif
56  ifndef XMFLAGS
57    XMFLAGS   := -I/usr/X11R6/include
58  endif
59  ifndef XMLIBS
60    XMLIBS    := -lXm -lXpm
61  endif
62  ifndef QTHOME
63    QTHOME     := /usr
64  endif
65
66  ifndef QTMOC
67    QTMOC      := $(QTHOME)/bin/moc
68  endif
69
70  QT_VERSION := $(shell $(QTMOC) 2>&1 -v | sed 's/.* .Qt \([0-9]\)\..*/\1/' )
71
72  ifndef QTFLAGS
73    ifeq ($(QT_VERSION),4)
74      QTFLAGS   += -I$(QTHOME)/include/qt$(QT_VERSION)
75      QTFLAGS   += -I $(QTHOME)/include/qt$(QT_VERSION)/QtCore
76      QTFLAGS   += -I $(QTHOME)/include/qt$(QT_VERSION)/QtGui
77      QTFLAGS   += -I $(QTHOME)/include/qt$(QT_VERSION)/QtOpenGL
78    else
79      QTFLAGS    := -I$(QTHOME)/include/qt$(QT_VERSION)/Qt
80      QTFLAGS    += -I$(QTHOME)/include/qt$(QT_VERSION)
81    endif
82  endif
83
84
85  ifndef QTLIBPATH
86    QT_SEARCH_LIB1 := $(shell ls  $(QTHOME)/lib/qt$(QT_VERSION)/libq* 2>/dev/null | wc -l )
87    QT_SEARCH_LIB2 := $(shell ls  $(QTHOME)/lib/libq*  2>/dev/null | wc -l )
88    ifneq ($(QT_SEARCH_LIB1),0)
89      QTLIBPATH   := /lib/qt$(QT_VERSION)
90    endif
91    ifneq ($(QT_SEARCH_LIB2),0)
92      QTLIBPATH   := /lib
93    endif
94  endif
95
96  ifndef QTLIBS
97    QTLIBS   := -L$(QTHOME)$(QTLIBPATH)
98    ifeq ($(QT_VERSION),3)
99      QT3_MT  := $(shell ls  $(QTHOME)$(QTLIBPATH)/libqt-mt.* | wc -l )
100      ifneq ($(QT3_MT),0)
101        QTLIBS  += -lqt-mt
102      else
103        QTLIBS  += -lqt
104      endif
105      QTLIBS   += -lqui
106    else
107      QTLIBS    += -lQtCore -lQtGui
108    endif
109  endif
110
111  ifndef GLQTLIBS
112    ifeq ($(QT_VERSION),3)
113        # already done in QTLIBS
114        #      GLQTLIBS    := $(QTLIBS)
115    else
116      GLQTLIBS    := -L$(QTHOME)$(QTLIBPATH) -lQtCore -lQtGui -lQtOpenGL
117    endif
118  endif
119
120  ifndef XAWFLAGS
121    XAWFLAGS   := -I/usr/X11R6/include
122  endif
123  ifndef XAWLIBS
124    XAWLIBS    := -lXaw
125  endif
126  DLDLIBS   := -ldl
127  ifndef OGLFLAGS
128    OGLFLAGS  := -I$(OGLHOME)/include
129  endif
130  ifndef OGLLIBS
131    OGLLIBS   := -L$(OGLHOME)/lib -lGLU -lGL
132  endif
133  define build-granular-shared-lib
134    @libdir=`(cd $(@D);/bin/pwd)`; \
135     cd $(G4TMPDIR); \
136     $(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) *.o
137  endef
138  define build-global-shared-lib
139    @libdir=`(cd $(@D);/bin/pwd)`; \
140     cd $(G4TMP)/$(G4SYSTEM); \
141     $(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) \
142                    $(foreach dir,$(SUBLIBS),$(dir)/*.o);
143  endef
144
145endif
Note: See TracBrowser for help on using the repository browser.