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

Last change on this file since 1035 was 1030, checked in by garnier, 15 years ago

update

File size: 4.4 KB
RevLine 
[472]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
[865]33  ifdef G4OPTDEBUG
34    CXXFLAGS  += -O2 -g
35    FCFLAGS   += -O2 -g
36    CCFLAGS   += -O2 -g
37  endif
[472]38  ifdef G4LIB_BUILD_SHARED
39    CXXFLAGS  += -fPIC
40    FCFLAGS   += -fPIC
41    CCFLAGS   += -fPIC
42  endif
43  G4RUNPATHOPTION := -Wl,-rpath
44  CC := gcc
[758]45  FC := gfortran
[472]46  FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
47  FCLIBS := -lg2c -lnsl
[921]48  ECHO   := /bin/echo -e
49  SHEXT  := so
50  ARCH   := $(shell uname -m | cut -s -d "_" -f 2)
51
[472]52  ifndef X11FLAGS
53    X11FLAGS  := -I/usr/include/X11/extensions -I/usr/include/X11
54  endif
55  ifndef X11LIBS
[994]56    X11LIBS   := -L/usr/X11R6/lib$(ARCH)  -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
[472]57  endif
58  ifndef XMFLAGS
59    XMFLAGS   := -I/usr/X11R6/include
60  endif
61  ifndef XMLIBS
62    XMLIBS    := -lXm -lXpm
63  endif
[921]64  ifndef XAWFLAGS
65    XAWFLAGS   := -I/usr/X11R6/include
66  endif
67  ifndef XAWLIBS
68    XAWLIBS    := -lXaw
69  endif
70  DLDLIBS   := -ldl
71  ifndef OGLFLAGS
72    OGLFLAGS  := -I$(OGLHOME)/include
73  endif
74  ifndef OGLLIBS
75    OGLLIBS   := -L$(OGLHOME)/lib$(ARCH) -lGLU -lGL
76  endif
[893]77
78# ---- QT Setup block -------------------------------------------------------
[606]79  ifndef QTHOME
[865]80    QTHOME     := /usr
[606]81  endif
[726]82  ifndef QTMOC
[758]83    QTMOC      := $(QTHOME)/bin/moc
[726]84  endif
[865]85
[875]86  QT_VERSION := $(shell $(QTMOC) 2>&1 -v | sed 's/.* .Qt \([0-9]\)\..*/\1/' )
[865]87
[875]88  ifndef QTFLAGS
89    ifeq ($(QT_VERSION),4)
[1030]90      QTFLAGS   += -I$(QTHOME)/include
91      QTFLAGS   += -I $(QTHOME)/include/QtCore
92      QTFLAGS   += -I $(QTHOME)/include/QtGui
93      QTFLAGS   += -I $(QTHOME)/include/QtOpenGL
[865]94    else
[1030]95      QTFLAGS := -I$(QTHOME)/include/Qt -I$(QTHOME)/include
[994]96
97      # If Qt is not located in the STANDARD path, try to find it in some
98      # other places.(Ex: for ubuntu 8.10)
[1030]99      QT_ALT1 := $(shell ls  $(QTHOME)/include/qt$(QT_VERSION)/*.h 2>/dev/null | wc -l )
100      QT_ALT2 := $(shell ls  $(QTHOME)/include/qt$(QT_VERSION)/Qt/*.h 2>/dev/null | wc -l )
[994]101      ifneq ($(QT_ALT1),0)
[1030]102        QTFLAGS := -I$(QTHOME)/include/qt$(QT_VERSION)
[994]103      endif
[1030]104      ifneq ($(QT_ALT2),0)
105        QTFLAGS := -I$(QTHOME)/include/qt$(QT_VERSION)/Qt
106      endif
[865]107    endif
[606]108  endif
[875]109  ifndef QTLIBPATH
110    QT_SEARCH_LIB1 := $(shell ls  $(QTHOME)/lib/qt$(QT_VERSION)/libq* 2>/dev/null | wc -l )
111    QT_SEARCH_LIB2 := $(shell ls  $(QTHOME)/lib/libq*  2>/dev/null | wc -l )
112    ifneq ($(QT_SEARCH_LIB1),0)
[994]113      QTLIBPATH   := $(QTHOME)/lib/qt$(QT_VERSION)
[875]114    endif
115    ifneq ($(QT_SEARCH_LIB2),0)
[994]116      QTLIBPATH   := $(QTHOME)/lib
[875]117    endif
118  endif
[790]119  ifndef QTLIBS
[994]120    QTLIBS   := -L$(QTLIBPATH)
[875]121    ifeq ($(QT_VERSION),3)
[994]122      QT3_MT  := $(shell ls  $(QTLIBPATH)/libqt-mt.* 2>/dev/null | wc -l )
[875]123      ifneq ($(QT3_MT),0)
124        QTLIBS  += -lqt-mt
125      else
126        QTLIBS  += -lqt
127      endif
128      QTLIBS   += -lqui
[865]129    else
[875]130      QTLIBS    += -lQtCore -lQtGui
[865]131    endif
[790]132  endif
[875]133  ifndef GLQTLIBS
134    ifeq ($(QT_VERSION),3)
135        # already done in QTLIBS
136        #      GLQTLIBS    := $(QTLIBS)
137    else
[994]138      GLQTLIBS    := -L$(QTLIBPATH) -lQtCore -lQtGui -lQtOpenGL
[875]139    endif
140  endif
[893]141#----------------------------------------------------------------------------
[875]142
[472]143  define build-granular-shared-lib
144    @libdir=`(cd $(@D);/bin/pwd)`; \
145     cd $(G4TMPDIR); \
146     $(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) *.o
147  endef
148  define build-global-shared-lib
149    @libdir=`(cd $(@D);/bin/pwd)`; \
150     cd $(G4TMP)/$(G4SYSTEM); \
151     $(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) $(INTYLIBS) \
152                    $(foreach dir,$(SUBLIBS),$(dir)/*.o);
153  endef
154
155endif
Note: See TracBrowser for help on using the repository browser.