| 1 | # $Id: architecture.gmk,v 1.116 2008/11/13 16:15:14 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/SCL4), gcc-3.4.6 (default)
|
|---|
| 17 | #
|
|---|
| 18 | # Darwin-g++ MacOSX 10.5, gcc-4.0.1
|
|---|
| 19 | #
|
|---|
| 20 | # WIN32-VC Windows/XP and Microsoft Visual C++ 9.0
|
|---|
| 21 | # Adding CYGWIN32 tools
|
|---|
| 22 | # -------------------------------------------------------------------------
|
|---|
| 23 |
|
|---|
| 24 | MAKEFLAGS= --no-print-directory
|
|---|
| 25 |
|
|---|
| 26 | # If not specified, the default path for G4 installation G4INSTALL is
|
|---|
| 27 | # set to $HOME/geant4 ...
|
|---|
| 28 | #
|
|---|
| 29 | ifndef G4INSTALL
|
|---|
| 30 | G4INSTALL := $(HOME)/geant4
|
|---|
| 31 | endif
|
|---|
| 32 |
|
|---|
| 33 | # If not specified, the default path for G4 source G4BASE is
|
|---|
| 34 | # set to $G4INSTALL/source ...
|
|---|
| 35 | #
|
|---|
| 36 | ifndef G4BASE
|
|---|
| 37 | G4BASE := $(G4INSTALL)/source
|
|---|
| 38 | endif
|
|---|
| 39 |
|
|---|
| 40 | # If not specified, the default path for the user's workdir is the same
|
|---|
| 41 | # as G4INSTALL ...
|
|---|
| 42 | #
|
|---|
| 43 | ifndef G4WORKDIR
|
|---|
| 44 | G4WORKDIR := $(G4INSTALL)
|
|---|
| 45 | endif
|
|---|
| 46 |
|
|---|
| 47 | # If not specified, the default path for temporary files G4TMP is
|
|---|
| 48 | # set to $G4WORKDIR/tmp/$G4SYSTEM ...
|
|---|
| 49 | #
|
|---|
| 50 | ifndef G4TMP
|
|---|
| 51 | G4TMP := $(G4WORKDIR)/tmp
|
|---|
| 52 | endif
|
|---|
| 53 | G4DUMMY_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 | #
|
|---|
| 58 | ifndef G4LIB
|
|---|
| 59 | G4LIB := $(G4INSTALL)/lib
|
|---|
| 60 | endif
|
|---|
| 61 | G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4LIB) ] && mkdir -p $(G4LIB) )
|
|---|
| 62 | G4DUMMY_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 | #
|
|---|
| 67 | ifndef G4INCLUDE
|
|---|
| 68 | G4INCLUDE := $(G4INSTALL)/include
|
|---|
| 69 | endif
|
|---|
| 70 | G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4INCLUDE) ] && mkdir -p $(G4INCLUDE) )
|
|---|
| 71 |
|
|---|
| 72 | # Backwards compatibility
|
|---|
| 73 | #
|
|---|
| 74 | ifneq ($(G4MAKESHLIB),)
|
|---|
| 75 | ifeq ($(G4LIB_NO_SHARED),)
|
|---|
| 76 | G4LIB_BUILD_SHARED = 1
|
|---|
| 77 | endif
|
|---|
| 78 | endif
|
|---|
| 79 |
|
|---|
| 80 | # Defaults for library BUILD. No default for USE, ie. take what is found.
|
|---|
| 81 | # Default is building static libraries.
|
|---|
| 82 | #
|
|---|
| 83 | ifeq ($(G4LIB_BUILD_SHARED),)
|
|---|
| 84 | ifeq ($(G4LIB_BUILD_STATIC),)
|
|---|
| 85 | G4LIB_BUILD_STATIC = 1
|
|---|
| 86 | endif
|
|---|
| 87 | endif
|
|---|
| 88 |
|
|---|
| 89 | # Specify if to build the DLL libraries on Windows. Default is NO.
|
|---|
| 90 | #
|
|---|
| 91 | ifneq ($(G4LIB_USE_DLL),)
|
|---|
| 92 | G4LIB_BUILD_DLL = 1
|
|---|
| 93 | CPPFLAGS += -DG4LIB_BUILD_DLL
|
|---|
| 94 | endif
|
|---|
| 95 | ifneq ($(G4LIB_BUILD_DLL),)
|
|---|
| 96 | G4LIB_BUILD_DLL = 1
|
|---|
| 97 | CPPFLAGS += -DG4LIB_BUILD_DLL
|
|---|
| 98 | G4LIB_USE_DLL = 1
|
|---|
| 99 | endif
|
|---|
| 100 |
|
|---|
| 101 | # Specify if to build the G3TOG4 module or not. Default is NO.
|
|---|
| 102 | #
|
|---|
| 103 | ifneq ($(G4LIB_BUILD_G3TOG4),)
|
|---|
| 104 | G4LIB_BUILD_G3TOG4 = 1
|
|---|
| 105 | G4LIB_USE_G3TOG4 = 1
|
|---|
| 106 | endif
|
|---|
| 107 |
|
|---|
| 108 | # Specify if to build the ZLIB module or not. Default is NO.
|
|---|
| 109 | #
|
|---|
| 110 | ifneq ($(G4LIB_BUILD_ZLIB),)
|
|---|
| 111 | G4LIB_BUILD_ZLIB = 1
|
|---|
| 112 | G4LIB_USE_ZLIB = 1
|
|---|
| 113 | endif
|
|---|
| 114 |
|
|---|
| 115 | # If not specified, the default path for G4 binaries G4BIN is
|
|---|
| 116 | # set to $G4WORKDIR/bin/$G4SYSTEM ...
|
|---|
| 117 | #
|
|---|
| 118 | ifndef G4BIN
|
|---|
| 119 | G4BIN := $(G4WORKDIR)/bin
|
|---|
| 120 | endif
|
|---|
| 121 | G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4BIN) ] && mkdir -p $(G4BIN) )
|
|---|
| 122 |
|
|---|
| 123 | # If G4DEBUG or G4NO_OPTIMISE are not specified,
|
|---|
| 124 | # the default compilation is optimised ...
|
|---|
| 125 | #
|
|---|
| 126 | ifdef G4DEBUG
|
|---|
| 127 | CPPFLAGS += -DG4DEBUG
|
|---|
| 128 | G4DEBUG := 1
|
|---|
| 129 | else
|
|---|
| 130 | ifndef G4NO_OPTIMISE
|
|---|
| 131 | CPPFLAGS += -DG4OPTIMISE
|
|---|
| 132 | G4OPTIMISE := 1
|
|---|
| 133 | endif
|
|---|
| 134 | endif
|
|---|
| 135 |
|
|---|
| 136 | # CLHEP path, etc.
|
|---|
| 137 | #
|
|---|
| 138 | ifndef CLHEP_BASE_DIR
|
|---|
| 139 | CLHEP_BASE_DIR := $(shell ls CLHEP_BASE_DIR--UNDEFINED)
|
|---|
| 140 | endif
|
|---|
| 141 | ifndef CLHEP_INCLUDE_DIR
|
|---|
| 142 | CLHEP_INCLUDE_DIR := $(CLHEP_BASE_DIR)/include
|
|---|
| 143 | endif
|
|---|
| 144 | ifndef CLHEP_LIB_DIR
|
|---|
| 145 | CLHEP_LIB_DIR := $(CLHEP_BASE_DIR)/lib
|
|---|
| 146 | endif
|
|---|
| 147 | ifndef 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
|
|---|
| 157 | endif
|
|---|
| 158 |
|
|---|
| 159 | # Paths for G4 data
|
|---|
| 160 | #
|
|---|
| 161 | ifndef G4DATA
|
|---|
| 162 | G4DATA := $(G4INSTALL)/data
|
|---|
| 163 | endif
|
|---|
| 164 |
|
|---|
| 165 | # Photon evaporation data
|
|---|
| 166 | #
|
|---|
| 167 | ifndef G4LEVELGAMMADATA
|
|---|
| 168 | G4LEVELGAMMADATA := $(G4DATA)/PhotonEvaporation
|
|---|
| 169 | endif
|
|---|
| 170 |
|
|---|
| 171 | # Toggle variables (positional qualifiers) between WIN32-VC and UNIX...
|
|---|
| 172 | #
|
|---|
| 173 | ifneq (,$(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
|
|---|
| 186 | else
|
|---|
| 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)
|
|---|
| 199 | endif
|
|---|
| 200 |
|
|---|
| 201 | # Variables for implicit rules, etc., as suggested in GNU Make manual...
|
|---|
| 202 | #
|
|---|
| 203 | CPPFLAGS += -Iinclude
|
|---|
| 204 | CPPFLAGS += -I$(CLHEP_INCLUDE_DIR)
|
|---|
| 205 |
|
|---|
| 206 | # Positional qualifiers in action...
|
|---|
| 207 | #
|
|---|
| 208 | ifndef LDFLAGS
|
|---|
| 209 | LDFLAGS :=
|
|---|
| 210 | endif
|
|---|
| 211 | ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
|---|
| 212 | LDFLAGS += -link $(LIB_PATH)$(CLHEP_LIB_DIR)
|
|---|
| 213 | LOADLIBS := $(CLHEP_LIB)
|
|---|
| 214 | else
|
|---|
| 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
|
|---|
| 223 | endif
|
|---|
| 224 |
|
|---|
| 225 | # Graphic variables...
|
|---|
| 226 | #
|
|---|
| 227 | ifndef VISLIBS
|
|---|
| 228 | VISLIBS :=
|
|---|
| 229 | endif
|
|---|
| 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 | #
|
|---|
| 249 | ifndef OIVHOME
|
|---|
| 250 | OIVHOME := /usr/local/Inventor
|
|---|
| 251 | endif
|
|---|
| 252 | ifndef OIVFLAGS
|
|---|
| 253 | OIVFLAGS := -I$(OIVHOME)/include
|
|---|
| 254 | endif
|
|---|
| 255 | ifndef OIVLIBS
|
|---|
| 256 | OIVLIBS := -L$(OIVHOME)/lib -lInventorXt -lInventor
|
|---|
| 257 | endif
|
|---|
| 258 |
|
|---|
| 259 | # ----------------- GDML ---------------------
|
|---|
| 260 | # Setup path to XERCESC library if GDML plugin build is specified
|
|---|
| 261 | #
|
|---|
| 262 | ifneq ($(G4LIB_BUILD_GDML),)
|
|---|
| 263 | G4LIB_USE_GDML = 1
|
|---|
| 264 | ifndef XERCESCROOT
|
|---|
| 265 | XERCESCROOT := /usr/local/xercesc
|
|---|
| 266 | endif
|
|---|
| 267 | ifndef GDMLFLAGS
|
|---|
| 268 | GDMLFLAGS := -DG4LIB_USE_GDML -I$(XERCESCROOT)/include
|
|---|
| 269 | endif
|
|---|
| 270 | ifndef GDMLLIBS
|
|---|
| 271 | ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
|---|
| 272 | GDMLLIBS := $(LIB_PATH)$(XERCESCROOT)/lib xerces-c_2.lib
|
|---|
| 273 | else
|
|---|
| 274 | GDMLLIBS := -L$(XERCESCROOT)/lib -lxerces-c
|
|---|
| 275 | endif
|
|---|
| 276 | endif
|
|---|
| 277 | CPPFLAGS += $(GDMLFLAGS)
|
|---|
| 278 | endif
|
|---|
| 279 |
|
|---|
| 280 | # For cfront compilers the repository location is set to
|
|---|
| 281 | # $G4TMP/$G4SYSTEM/g4.ptrepository.
|
|---|
| 282 | #
|
|---|
| 283 | G4TEMPLATE_REPOSITORY := $(G4SYSTEM)/g4.ptrepository
|
|---|
| 284 | G4TEMPEXEC_REPOSITORY := $(G4TEMPLATE_REPOSITORY)/exec
|
|---|
| 285 | G4TREP := $(G4TMP)/$(G4TEMPLATE_REPOSITORY)
|
|---|
| 286 |
|
|---|
| 287 | # Default archive call. Changed for: SUN-CC.
|
|---|
| 288 | #
|
|---|
| 289 | AR := ar r
|
|---|
| 290 |
|
|---|
| 291 | # Default echo used with makedepend. Changed for SUN-CC, Linux-g++, WIN32.
|
|---|
| 292 | #
|
|---|
| 293 | ECHO:= echo
|
|---|
| 294 |
|
|---|
| 295 | # Default grep used with source/GNUmakefile. Changed for SUN-CC.
|
|---|
| 296 | #
|
|---|
| 297 | GREP := grep
|
|---|
| 298 |
|
|---|
| 299 | # Default cut used with source/GNUmakefile. Changed for WIN32.
|
|---|
| 300 | #
|
|---|
| 301 | CUT := cut
|
|---|
| 302 |
|
|---|
| 303 | # Default cat used with source/GNUmakefile. Changed for WIN32.
|
|---|
| 304 | #
|
|---|
| 305 | CAT := cat
|
|---|
| 306 |
|
|---|
| 307 | # Default sed used with source/GNUmakefile. Changed for WIN32.
|
|---|
| 308 | #
|
|---|
| 309 | SED := sed
|
|---|
| 310 |
|
|---|
| 311 | # Include architecture dependent setups...
|
|---|
| 312 | #
|
|---|
| 313 | include $(G4INSTALL)/config/sys/$(G4SYSTEM).gmk
|
|---|
| 314 |
|
|---|
| 315 | # make certain that OGLFLAGS does NOT contain -I/usr/include
|
|---|
| 316 | # caused by OGLHOME being /usr, as e.g. on Linux
|
|---|
| 317 | #
|
|---|
| 318 | ifdef OGLFLAGS
|
|---|
| 319 | OGLFLAGS:= $(filter-out -I/usr/include,$(OGLFLAGS))
|
|---|
| 320 | OGLFLAGS:= $(filter-out -I/usr//include,$(OGLFLAGS))
|
|---|
| 321 | endif
|
|---|
| 322 |
|
|---|
| 323 | # If there is no cbrt() function...
|
|---|
| 324 | #
|
|---|
| 325 | ifdef G4_NO_CBRT
|
|---|
| 326 | CPPFLAGS += -DG4_NO_CBRT
|
|---|
| 327 | endif
|
|---|
| 328 |
|
|---|
| 329 | # Verbosity code can be left out (for better performance)
|
|---|
| 330 | # by defining G4_NO_VERBOSE.
|
|---|
| 331 | #
|
|---|
| 332 | ifndef G4_NO_VERBOSE
|
|---|
| 333 | CPPFLAGS += -DG4VERBOSE
|
|---|
| 334 | endif
|
|---|
| 335 |
|
|---|
| 336 | # Trajectory related classes can be left out (for better performance)
|
|---|
| 337 | # by defining G4_NO_STORE_TRAJECTORY.
|
|---|
| 338 | #
|
|---|
| 339 | ifndef G4_NO_STORE_TRAJECTORY
|
|---|
| 340 | CPPFLAGS += -DG4_STORE_TRAJECTORY
|
|---|
| 341 | endif
|
|---|
| 342 |
|
|---|
| 343 | # Template setup - repositories, special options etc
|
|---|
| 344 | #
|
|---|
| 345 | ifdef CFRONT_G4TEMPLATE_REPOSITORY
|
|---|
| 346 | ifeq ($(findstring DEC,$(G4SYSTEM)),DEC)
|
|---|
| 347 | ifdef G4EXEC_BUILD
|
|---|
| 348 | CXXTEMPLATE_FLAGS := -ptr $(G4TREP)/exec -ptr $(G4TREP)
|
|---|
| 349 | else
|
|---|
| 350 | CXXTEMPLATE_FLAGS := -ptr $(G4TREP)
|
|---|
| 351 | endif
|
|---|
| 352 | else
|
|---|
| 353 | ifdef G4EXEC_BUILD
|
|---|
| 354 | CXXTEMPLATE_FLAGS := -ptr$(G4TREP)/exec -ptr$(G4TREP)
|
|---|
| 355 | else
|
|---|
| 356 | CXXTEMPLATE_FLAGS := -ptr$(G4TREP)
|
|---|
| 357 | endif
|
|---|
| 358 | endif
|
|---|
| 359 | CXXFLAGS += $(CXXTEMPLATE_FLAGS)
|
|---|
| 360 | CFRONT := true
|
|---|
| 361 | endif
|
|---|
| 362 | ifdef CFRONT
|
|---|
| 363 | G4TEMPLATE_REPOSITORY_PARENT := $(shell echo $(G4TREP) | sed 's!/[^/][^/]*/*$$!!' )
|
|---|
| 364 | G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TEMPLATE_REPOSITORY_PARENT) ] && mkdir -p $(G4TEMPLATE_REPOSITORY_PARENT) )
|
|---|
| 365 | G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TREP) ] && mkdir -p $(G4TREP) )
|
|---|
| 366 | G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4TREP)/exec ] &&mkdir -p $(G4TREP)/exec )
|
|---|
| 367 | endif
|
|---|
| 368 |
|
|---|
| 369 | # If G4SYSTEM is not specified or not valid, issue an ERROR !
|
|---|
| 370 | #
|
|---|
| 371 | #$(G4INSTALL)/config/sys/$(G4SYSTEM).gmk:
|
|---|
| 372 | # @echo "ERROR - G4SYSTEM is not defined in the environment"
|
|---|
| 373 | # @echo " or $(G4SYSTEM) architecture is not a valid one !"
|
|---|
| 374 | # exit 1
|
|---|