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

Last change on this file since 1171 was 1030, checked in by garnier, 17 years ago

update

File size: 4.4 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 ARCH := $(shell uname -m | cut -s -d "_" -f 2)
51
52 ifndef X11FLAGS
53 X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
54 endif
55 ifndef X11LIBS
56 X11LIBS := -L/usr/X11R6/lib$(ARCH) -lXmu -lXt -lXext -lX11 -lXi -lSM -lICE
57 endif
58 ifndef XMFLAGS
59 XMFLAGS := -I/usr/X11R6/include
60 endif
61 ifndef XMLIBS
62 XMLIBS := -lXm -lXpm
63 endif
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
77
78# ---- QT Setup block -------------------------------------------------------
79 ifndef QTHOME
80 QTHOME := /usr
81 endif
82 ifndef QTMOC
83 QTMOC := $(QTHOME)/bin/moc
84 endif
85
86 QT_VERSION := $(shell $(QTMOC) 2>&1 -v | sed 's/.* .Qt \([0-9]\)\..*/\1/' )
87
88 ifndef QTFLAGS
89 ifeq ($(QT_VERSION),4)
90 QTFLAGS += -I$(QTHOME)/include
91 QTFLAGS += -I $(QTHOME)/include/QtCore
92 QTFLAGS += -I $(QTHOME)/include/QtGui
93 QTFLAGS += -I $(QTHOME)/include/QtOpenGL
94 else
95 QTFLAGS := -I$(QTHOME)/include/Qt -I$(QTHOME)/include
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)
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 )
101 ifneq ($(QT_ALT1),0)
102 QTFLAGS := -I$(QTHOME)/include/qt$(QT_VERSION)
103 endif
104 ifneq ($(QT_ALT2),0)
105 QTFLAGS := -I$(QTHOME)/include/qt$(QT_VERSION)/Qt
106 endif
107 endif
108 endif
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)
113 QTLIBPATH := $(QTHOME)/lib/qt$(QT_VERSION)
114 endif
115 ifneq ($(QT_SEARCH_LIB2),0)
116 QTLIBPATH := $(QTHOME)/lib
117 endif
118 endif
119 ifndef QTLIBS
120 QTLIBS := -L$(QTLIBPATH)
121 ifeq ($(QT_VERSION),3)
122 QT3_MT := $(shell ls $(QTLIBPATH)/libqt-mt.* 2>/dev/null | wc -l )
123 ifneq ($(QT3_MT),0)
124 QTLIBS += -lqt-mt
125 else
126 QTLIBS += -lqt
127 endif
128 QTLIBS += -lqui
129 else
130 QTLIBS += -lQtCore -lQtGui
131 endif
132 endif
133 ifndef GLQTLIBS
134 ifeq ($(QT_VERSION),3)
135 # already done in QTLIBS
136 # GLQTLIBS := $(QTLIBS)
137 else
138 GLQTLIBS := -L$(QTLIBPATH) -lQtCore -lQtGui -lQtOpenGL
139 endif
140 endif
141#----------------------------------------------------------------------------
142
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.