source: trunk/geant4/config/architecture.gmk @ 473

Last change on this file since 473 was 472, checked in by garnier, 17 years ago

r549@wl-72148: laurentgarnier | 2007-05-15 10:37:42 +0200
import de geant4

File size: 8.7 KB
Line 
1# $Id: architecture.gmk,v 1.105 2006/06/13 15:36:30 gcosmo Exp $
2# ------------------------------------------------------------------------
3#       GEANT 4 - Architecture configuration script for GNU Make
4#
5#       First implementation: July 7th 1995
6#
7# Description
8# -----------
9# to override variables defined in this script, use "gmake -e", this will
10# cause environment variables to take precedence. In this case watch for
11# inadvertant overrides!
12#
13# List of the supported architectures/compilers and related flavors for
14# the environment variable G4SYSTEM:
15#
16#          Linux-g++   Linux (Red Hat Enterprise/SCL3), gcc-3.2.3 (default)
17#
18#          SUN-CC      SunOS 5.8, CC 5.4
19#
20#          WIN32-VC    Windows/XP and Microsoft Visual C++ 7.1 .NET
21#                      Adding CYGWIN32 tools
22# -------------------------------------------------------------------------
23
24MAKEFLAGS= --no-print-directory
25
26# If not specified, the default path for G4 installation G4INSTALL is
27# set to $HOME/geant4 ...
28#
29ifndef G4INSTALL
30  G4INSTALL := $(HOME)/geant4
31endif
32
33# If not specified, the default path for G4 source G4BASE is
34# set to $G4INSTALL/source ...
35#
36ifndef G4BASE
37  G4BASE := $(G4INSTALL)/source
38endif
39
40# If not specified, the default path for the user's workdir is the same
41# as G4INSTALL ...
42#
43ifndef G4WORKDIR
44  G4WORKDIR := $(G4INSTALL)
45endif
46
47# If not specified, the default path for temporary files G4TMP is
48# set to $G4WORKDIR/tmp/$G4SYSTEM ...
49#
50ifndef G4TMP
51  G4TMP := $(G4WORKDIR)/tmp
52endif
53G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TMP) ] && mkdir -p $(G4TMP) )
54       
55# If not specified, the default path for G4 libraries G4LIB is
56# set to $G4INSTALL/lib/$G4SYSTEM ...
57#
58ifndef G4LIB
59  G4LIB := $(G4INSTALL)/lib
60endif
61G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4LIB) ] && mkdir -p $(G4LIB) )
62G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4LIB)/$(G4SYSTEM) ] && mkdir -p $(G4LIB)/$(G4SYSTEM) )
63
64# If not specified, the default path to install G4 include files is G4INCLUDE
65# set to $G4INSTALL/include ...
66#
67ifndef G4INCLUDE
68  G4INCLUDE := $(G4INSTALL)/include
69endif
70G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4INCLUDE) ] && mkdir -p $(G4INCLUDE) )
71
72# Backwards compatibility
73#
74ifneq ($(G4MAKESHLIB),)
75  ifeq ($(G4LIB_NO_SHARED),)
76    G4LIB_BUILD_SHARED = 1
77  endif
78endif
79
80# Defaults for library BUILD. No default for USE, ie. take what is found.
81# Default is building static libraries.
82#
83ifeq ($(G4LIB_BUILD_SHARED),)
84  ifeq ($(G4LIB_BUILD_STATIC),)
85    G4LIB_BUILD_STATIC = 1
86  endif 
87endif
88
89# Specify if to build the DLL libraries on Windows. Default is NO.
90#
91ifneq ($(G4LIB_USE_DLL),)
92  G4LIB_BUILD_DLL = 1
93  CPPFLAGS += -DG4LIB_BUILD_DLL
94endif
95ifneq ($(G4LIB_BUILD_DLL),)
96  G4LIB_BUILD_DLL = 1
97  CPPFLAGS += -DG4LIB_BUILD_DLL
98  G4LIB_USE_DLL = 1
99endif
100
101# Specify if to build the G3TOG4 module or not. Default is NO.
102#
103ifneq ($(G4LIB_BUILD_G3TOG4),)
104  G4LIB_BUILD_G3TOG4 = 1
105  G4LIB_USE_G3TOG4 = 1
106endif
107
108# Specify if to build the ZLIB module or not. Default is NO.
109#
110ifneq ($(G4LIB_BUILD_ZLIB),)
111  G4LIB_BUILD_ZLIB = 1
112  G4LIB_USE_ZLIB = 1
113endif
114
115# If not specified, the default path for G4 binaries G4BIN is
116# set to $G4WORKDIR/bin/$G4SYSTEM ...
117#
118ifndef G4BIN
119  G4BIN := $(G4WORKDIR)/bin
120endif
121G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4BIN) ] && mkdir -p $(G4BIN) )
122
123# If G4DEBUG or G4NO_OPTIMISE are not specified,
124# the default compilation is optimised ...
125#
126ifdef G4DEBUG
127  CPPFLAGS += -DG4DEBUG
128  G4DEBUG := 1
129else
130  ifndef G4NO_OPTIMISE
131    CPPFLAGS += -DG4OPTIMISE
132    G4OPTIMISE := 1
133  endif
134endif
135
136# CLHEP path, etc.
137#
138ifndef CLHEP_BASE_DIR
139  CLHEP_BASE_DIR    := $(shell ls CLHEP_BASE_DIR--UNDEFINED)
140endif
141ifndef CLHEP_INCLUDE_DIR
142  CLHEP_INCLUDE_DIR := $(CLHEP_BASE_DIR)/include
143endif
144ifndef CLHEP_LIB_DIR
145  CLHEP_LIB_DIR     := $(CLHEP_BASE_DIR)/lib
146endif
147ifndef CLHEP_LIB
148  ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
149    CLHEP_LIB := CLHEP.lib
150  else
151    CLHEP_LIB := CLHEP
152#
153# If using the "granular" libraries of CLHEP, uncomment below
154#
155#   CLHEP_LIB := CLHEP-HepMC -l CLHEP-Geometry -l CLHEP-Random -l CLHEP-Vector
156  endif
157endif
158
159# Paths for G4 data
160#
161ifndef G4DATA
162  G4DATA := $(G4INSTALL)/data
163endif
164
165# Photon evaporation data
166#
167ifndef G4LEVELGAMMADATA
168  G4LEVELGAMMADATA := $(G4DATA)/PhotonEvaporation
169endif
170
171# Toggle variables (positional qualifiers) between WIN32-VC and UNIX...
172#
173ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
174  OUT_OBJ := -TP '-Fo'
175  FOR_OBJ := '-Fo'
176  OUT_LIB := '-out:'
177  OUT_EXE := '-Fe'
178  LIB_PATH := '-libpath:'
179  CERNLIB_PATH := "c:\cern\pro\lib"
180  PATH_DEL := \\
181  #
182  # pattern for next substitution
183  #
184  LIB_PATT  := lib(LibName).a
185  FLIB_PATT := (LibName).lib
186else
187  OUT_OBJ := -o
188  FOR_OBJ := -o
189  OUT_LIB :=
190  OUT_EXE := -o
191  LIB_PATH := -L
192  CERNLIB_PATH := /cern/pro/lib
193  PATH_DEL := /
194  #
195  # pattern for next substitution
196  #
197  LIB_PATT  := -l(LibName)
198  FLIB_PATT := $(LIB_PATT)
199endif
200
201# Variables for implicit rules, etc., as suggested in GNU Make manual...
202#
203CPPFLAGS  += -Iinclude
204CPPFLAGS  += -I$(CLHEP_INCLUDE_DIR)
205
206# Positional qualifiers in action...
207#
208ifndef LDFLAGS
209  LDFLAGS :=
210endif
211ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
212  LDFLAGS   += -link $(LIB_PATH)$(CLHEP_LIB_DIR)
213  LOADLIBS  := $(CLHEP_LIB)
214else
215  LDFLAGS   += -L$(CLHEP_LIB_DIR)
216  LOADLIBS  := -l$(CLHEP_LIB)
217  LOADLIBS  += -lm
218  ifdef G4LIB_USE_ZLIB
219    ifndef G4LIB_BUILD_ZLIB
220      LOADLIBS += -lz
221    endif
222  endif
223endif
224
225# Graphic variables...
226#
227ifndef VISLIBS
228  VISLIBS :=
229endif
230#
231# ---------------- OpenGL --------------------
232# The user can define his own values of OGLFLAGS and OGLLIBS.
233# OGLFLAGS gives the directory containing include files.
234#   E.g.: OGLFLAGS  := -I$(OGLHOME)/include
235# OGLLIBS gives the libraries.
236#   E.g.: OGLLIBS   := -L$(OGLHOME)/lib -lGLU -lGL
237#   Or  : OGLLIBS   := -L$(OGLHOME)/lib -lMesaGLU -lMesaGL
238# OGLHOME is often /usr or /usr/local.  In such case, it is not necessary
239# to specify the path in OGLFLAGS, since added already by default by the
240# compiler.  OGLHOME can also point to a special installation.
241# If the user does not set his/her own values, system-dependent values
242# are set below.  Most system-dependent code assumes OGLHOME is set.
243#
244# ------------- OpenInventor -----------------
245# The path to the installation of OpenInventor must be specified
246# if the package is installed in a location different
247# than default system directories (like... /usr or /usr/local).
248#
249ifndef OIVHOME
250  OIVHOME  := /usr/local/Inventor
251endif
252ifndef OIVFLAGS
253  OIVFLAGS  := -I$(OIVHOME)/include
254endif
255ifndef OIVLIBS
256  OIVLIBS   := -L$(OIVHOME)/lib -lInventorXt -lInventor
257endif
258
259# For cfront compilers the repository location is set to
260# $G4TMP/$G4SYSTEM/g4.ptrepository.
261#
262G4TEMPLATE_REPOSITORY := $(G4SYSTEM)/g4.ptrepository
263G4TEMPEXEC_REPOSITORY := $(G4TEMPLATE_REPOSITORY)/exec
264G4TREP := $(G4TMP)/$(G4TEMPLATE_REPOSITORY)
265
266# Default archive call. Changed for: SUN-CC.
267#
268AR := ar r
269
270# Default echo used with makedepend. Changed for SUN-CC, Linux-g++.
271#
272ECHO:= echo
273
274# Default grep used with source/GNUmakfile.  Changed for SUN-CC.
275#
276GREP := grep
277
278# Include architecture dependent setups...
279#
280include $(G4INSTALL)/config/sys/$(G4SYSTEM).gmk
281
282#  make certain that OGLFLAGS does NOT contain -I/usr/include
283#   caused by OGLHOME being /usr, as e.g. on Linux
284#
285ifdef OGLFLAGS
286  OGLFLAGS:= $(filter-out -I/usr/include,$(OGLFLAGS))
287  OGLFLAGS:= $(filter-out -I/usr//include,$(OGLFLAGS))
288endif
289       
290       
291# If there is no cbrt() function...
292#
293ifdef G4_NO_CBRT
294  CPPFLAGS += -DG4_NO_CBRT
295endif
296
297# Verbosity code can be left out (for better performance)
298# by defining G4_NO_VERBOSE.
299#
300ifndef G4_NO_VERBOSE
301  CPPFLAGS += -DG4VERBOSE
302endif
303
304# Trajectory related classes can be left out (for better performance)
305# by defining G4_NO_STORE_TRAJECTORY.
306#
307ifndef G4_NO_STORE_TRAJECTORY
308  CPPFLAGS += -DG4_STORE_TRAJECTORY
309endif
310
311# Template setup - repositories, special options etc
312#
313ifdef CFRONT_G4TEMPLATE_REPOSITORY
314  ifeq ($(findstring DEC,$(G4SYSTEM)),DEC)
315      ifdef G4EXEC_BUILD
316        CXXTEMPLATE_FLAGS := -ptr $(G4TREP)/exec -ptr $(G4TREP)
317      else
318        CXXTEMPLATE_FLAGS := -ptr $(G4TREP)
319      endif
320  else
321      ifdef G4EXEC_BUILD
322        CXXTEMPLATE_FLAGS := -ptr$(G4TREP)/exec -ptr$(G4TREP)
323      else
324        CXXTEMPLATE_FLAGS := -ptr$(G4TREP)
325      endif
326  endif
327  CXXFLAGS += $(CXXTEMPLATE_FLAGS)
328  CFRONT := true
329endif
330ifdef CFRONT
331  G4TEMPLATE_REPOSITORY_PARENT := $(shell echo $(G4TREP) | sed 's!/[^/][^/]*/*$$!!' )
332  G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TEMPLATE_REPOSITORY_PARENT) ] && mkdir -p $(G4TEMPLATE_REPOSITORY_PARENT) )
333  G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TREP) ] && mkdir -p $(G4TREP) )
334  G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TREP)/exec ] &&mkdir -p $(G4TREP)/exec )
335endif
336
337# If G4SYSTEM is not specified or not valid, issue an ERROR !
338#
339#$(G4INSTALL)/config/sys/$(G4SYSTEM).gmk:
340#       @echo "ERROR - G4SYSTEM is not defined in the environment"
341#       @echo "        or $(G4SYSTEM) architecture is not a valid one !"
342#       exit 1
Note: See TracBrowser for help on using the repository browser.