source: trunk/config/architecture.gmk

Last change on this file was 1349, checked in by garnier, 13 years ago

update

File size: 9.7 KB
Line 
1# $Id: architecture.gmk,v 1.125 2010/11/24 10:54:13 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/SCL5), gcc-4.1.2 (default)
17#
18#          Darwin-g++  MacOSX 10.6, gcc-4.2.1
19#
20#          WIN32-VC    Windows/XP and Microsoft Visual C++ 9.0
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) -lm
217  ifndef G4LIB_USE_ZLIB
218    LOADLIBS += -lz
219  endif
220endif
221
222# Graphic variables...
223#
224ifndef VISLIBS
225  VISLIBS :=
226endif
227#
228# ---------------- OpenGL --------------------
229# The user can define his own values of OGLFLAGS and OGLLIBS.
230# OGLFLAGS gives the directory containing include files.
231#   E.g.: OGLFLAGS  := -I$(OGLHOME)/include
232# OGLLIBS gives the libraries.
233#   E.g.: OGLLIBS   := -L$(OGLHOME)/lib -lGLU -lGL
234#   Or  : OGLLIBS   := -L$(OGLHOME)/lib -lMesaGLU -lMesaGL
235# OGLHOME is often /usr or /usr/local.  In such case, it is not necessary
236# to specify the path in OGLFLAGS, since added already by default by the
237# compiler.  OGLHOME can also point to a special installation.
238# If the user does not set his/her own values, system-dependent values
239# are set below.  Most system-dependent code assumes OGLHOME is set.
240
241# ------------- OpenInventor -----------------
242# The path to the installation of OpenInventor must be specified
243# if the package is installed in a location different
244# than default system directories (like... /usr or /usr/local).
245#
246ifndef OIVHOME
247  OIVHOME  := /usr/local/Inventor
248endif
249ifndef OIVFLAGS
250  OIVFLAGS  := -I$(OIVHOME)/include
251endif
252ifndef OIVLIBS
253  OIVLIBS   := -L$(OIVHOME)/lib -lInventorXt -lInventor
254endif
255
256# ----------------- GDML ---------------------
257# Setup path to XERCESC library if GDML plugin build is specified
258#
259ifneq ($(G4LIB_BUILD_GDML),)
260  G4LIB_USE_GDML = 1
261  ifndef XERCESCROOT
262    XERCESCROOT := /usr/local/xercesc
263  endif
264  ifndef GDMLFLAGS
265    GDMLFLAGS := -DG4LIB_USE_GDML -I$(XERCESCROOT)/include
266  endif
267  ifndef GDMLLIBS
268    ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
269      GDMLLIBS := $(LIB_PATH)$(XERCESCROOT)/lib xerces-c.lib
270    else
271      GDMLLIBS := -L$(XERCESCROOT)/lib -lxerces-c
272    endif
273  endif
274  CPPFLAGS  += $(GDMLFLAGS)
275endif
276
277# For cfront compilers the repository location is set to
278# $G4TMP/$G4SYSTEM/g4.ptrepository.
279#
280G4TEMPLATE_REPOSITORY := $(G4SYSTEM)/g4.ptrepository
281G4TEMPEXEC_REPOSITORY := $(G4TEMPLATE_REPOSITORY)/exec
282G4TREP := $(G4TMP)/$(G4TEMPLATE_REPOSITORY)
283
284# Default archive call. Changed for: SUN-CC.
285#
286AR := ar r
287
288# Default echo used with makedepend. Changed for SUN-CC, Linux-g++, WIN32.
289#
290ECHO:= echo
291
292# Default grep used with source/GNUmakefile.  Changed for SUN-CC.
293#
294GREP := grep
295
296# Default cut used with source/GNUmakefile.  Changed for WIN32.
297#
298CUT := cut
299
300# Default cat used with source/GNUmakefile.  Changed for WIN32.
301#
302CAT := cat
303
304# Default sed used with source/GNUmakefile.  Changed for WIN32.
305#
306SED := sed
307
308# Default find used with source/GNUmakefile.  Changed for WIN32.
309#
310FIND := find
311
312# Default sort used with source/GNUmakefile.  Changed for WIN32.
313#
314SORT := sort
315
316# Default touch used with source/GNUmakefile.  Changed for WIN32.
317#
318TOUCH := touch
319
320# Include architecture dependent setups...
321#
322include $(G4INSTALL)/config/sys/$(G4SYSTEM).gmk
323
324#  make certain that OGLFLAGS does NOT contain -I/usr/include
325#   caused by OGLHOME being /usr, as e.g. on Linux
326#
327ifdef OGLFLAGS
328  OGLFLAGS:= $(filter-out -I/usr/include,$(OGLFLAGS))
329  OGLFLAGS:= $(filter-out -I/usr//include,$(OGLFLAGS))
330endif
331
332# If there is no cbrt() function...
333#
334ifdef G4_NO_CBRT
335  CPPFLAGS += -DG4_NO_CBRT
336endif
337
338# Verbosity code can be left out (for better performance)
339# by defining G4_NO_VERBOSE.
340#
341ifndef G4_NO_VERBOSE
342  CPPFLAGS += -DG4VERBOSE
343endif
344
345# Trajectory related classes can be left out (for better performance)
346# by defining G4_NO_STORE_TRAJECTORY.
347#
348ifndef G4_NO_STORE_TRAJECTORY
349  CPPFLAGS += -DG4_STORE_TRAJECTORY
350endif
351
352# Template setup - repositories, special options etc
353#
354ifdef CFRONT_G4TEMPLATE_REPOSITORY
355  ifeq ($(findstring DEC,$(G4SYSTEM)),DEC)
356      ifdef G4EXEC_BUILD
357        CXXTEMPLATE_FLAGS := -ptr $(G4TREP)/exec -ptr $(G4TREP)
358      else
359        CXXTEMPLATE_FLAGS := -ptr $(G4TREP)
360      endif
361  else
362      ifdef G4EXEC_BUILD
363        CXXTEMPLATE_FLAGS := -ptr$(G4TREP)/exec -ptr$(G4TREP)
364      else
365        CXXTEMPLATE_FLAGS := -ptr$(G4TREP)
366      endif
367  endif
368  CXXFLAGS += $(CXXTEMPLATE_FLAGS)
369  CFRONT := true
370endif
371ifdef CFRONT
372  G4TEMPLATE_REPOSITORY_PARENT := $(shell echo $(G4TREP) | sed 's!/[^/][^/]*/*$$!!' )
373  G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TEMPLATE_REPOSITORY_PARENT) ] && mkdir -p $(G4TEMPLATE_REPOSITORY_PARENT) )
374  G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TREP) ] && mkdir -p $(G4TREP) )
375  G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TREP)/exec ] &&mkdir -p $(G4TREP)/exec )
376endif
377
378# If G4SYSTEM is not specified or not valid, issue an ERROR !
379#
380#$(G4INSTALL)/config/sys/$(G4SYSTEM).gmk:
381#       @echo "ERROR - G4SYSTEM is not defined in the environment"
382#       @echo "        or $(G4SYSTEM) architecture is not a valid one !"
383#       exit 1
Note: See TracBrowser for help on using the repository browser.