source: trunk/Documentation/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas05.html@ 901

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

Add Geant4 Documentation at 8.12.2008

File size: 31.2 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>5.  Makefiles and Environment Variables</title><link rel="stylesheet" href="../xml/XSLCustomizationLayer/G4HTMLStylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="Geant4 User's Guide for Application Developers"><link rel="up" href="apa.html" title="Appendix .  Appendix"><link rel="prev" href="apas04.html" title="4.  C++ Standard Template Library"><link rel="next" href="apas06.html" title="6.  Step-by-Step Installation Guides"><script language="JavaScript">
2function remote_win(fName)
3{
4 var url = "AllResources/Detector/geometry.src/" + fName;
5 RemoteWin=window.open(url,"","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=520,height=520")
6 RemoteWin.creator=self
7}
8</script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5. 
9Makefiles and Environment Variables
10</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apas04.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center">Appendix . 
11Appendix
12</th><td width="20%" align="right"> <a accesskey="n" href="apas06.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.MkflEnvVar"></a>5. 
13Makefiles and Environment Variables
14</h2></div></div></div><p>
15This section describes how the GNUmake infrastructure is
16implemented in Geant4 and provides a quick reference guide for the
17user/installer about the most important environment variables
18defined.
19</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.MkflEnvVar.GNUG4"></a>5.1. 
20The GNUmake system in Geant4
21</h3></div></div></div><p>
22As described in <a href="ch02.html#sect.HowToDefMain" title="2.1. 
23How to Define the main() Program
24">Section 2.1</a> of the
25Installation Guide, the GNUmake process in
26Geant4 is mainly controlled by the following GNUmake script files
27(<code class="literal">*.gmk</code> scripts are placed in
28<code class="literal">$G4INSTALL/config</code>):
29
30</p><div class="itemizedlist"><ul type="disc" compact><li><p>
31 <code class="literal">architecture.gmk</code>: defining all the architecture
32 specific settings and paths. System settings are stored in
33 <code class="literal">$G4INSTALL/config/sys</code> in separate files.
34 </p></li><li><p>
35 <code class="literal">common.gmk</code>: defining all general GNUmake rules for
36 building objects and libraries.
37 </p></li><li><p>
38 <code class="literal">globlib.gmk</code>: defining all general GNUmake rules for
39 building compound libraries.
40 </p></li><li><p>
41 <code class="literal">binmake.gmk</code>: defining the general GNUmake rules for
42 building executables.
43 </p></li><li><p>
44 <code class="literal">GNUmake</code> scripts: placed inside each directory in the
45 G4 distribution and defining directives specific to build a library
46 (or a set of sub-libraries) or and executable.
47 </p></li></ul></div><p>
48</p><p>
49To build a single library (or a set of sub-libraries) or an
50executable, you must explicitly change your current directory to
51the one you're interested in and invoke the "<code class="literal">gmake</code>"
52command from there ("<code class="literal">gmake global</code>" for building a
53compound library). Here is a list of the basic commands or GNUmake
54"targets" one can invoke to build libraries and/or executables:
55
56</p><div class="itemizedlist"><ul type="disc" compact><li><p>
57 <code class="literal">gmake</code>
58 </p><p>
59 starts the compilation process for building a kernel library or a
60 library associated with an example. Kernel libraries are built with
61 maximum granularity, i.e. if a category is a compound, this command
62 will build all the related sub-libraries,
63 <span class="bold"><strong>not</strong></span> the compound one.
64 The top level <code class="literal">GNUmakefile</code> in
65 <code class="literal">$G4INSTALL/source</code> will also build in this case a
66 dependency map <code class="literal">libname.map</code> of each library to establish
67 the linking order automatically at the <code class="literal">bin</code> step. The map
68 will be placed in <code class="literal">$G4LIB/$G4SYSTEM</code>.
69 </p><p>
70 </p></li><li><p>
71 <code class="literal">gmake global</code>
72 </p><p>
73 starts the compilation process to build a single compound kernel
74 library per category. If issued after "gmake", both 'granular' and
75 'compound' libraries will be available (NOTE: this will
76 consistently increase the disk space required. Compound libraries
77 will then be selected by default at link time, unless
78 G4LIB_USE_GRANULAR is specified).
79 </p><p>
80 </p></li><li><p>
81 <code class="literal">gmake bin</code> or <code class="literal">gmake</code> (only for
82 examples/)
83 </p><p>
84 starts the compilation process to build an executable. This command
85 will build implicitly the library associated with the example and
86 link the final application. It assumes <span class="bold"><strong>all</strong></span>
87 kernel libraries are already generated and placed in the correct
88 <code class="literal">$G4INSTALL</code> path defined for them.
89 </p><p>
90
91 </p><p>
92 The linking order is controlled automatically in case libraries
93 have been built with maximum granularity, and the link list is
94 generated on the fly.
95 </p><p>
96 </p></li><li><p>
97 <code class="literal">make dll</code>
98 </p><p>
99 On Windows systems this will start the compilation process to build
100 single compound kernel library per category and generate Dynamic
101 Link Libraries (DLLs). Once the libraries are generated, the
102 process will imply also the deletion of all temporary files
103 generated during the compilation.
104 </p><p>
105 </p></li></ul></div><p>
106</p><h5><a name="id558943"></a>
107<code class="literal">lib/ bin/</code> and <code class="literal">tmp/</code> directories
108</h5><p>
109The <code class="literal">$G4INSTALL</code> environment variable specifies where
110the installation of the Geant4 toolkit should take place, therefore
111kernel libraries will be placed in <code class="literal">$G4INSTALL/lib</code>. The
112<code class="literal">$G4WORKDIR</code> environment variable is set by the user and
113specifies the path to the user working directory; temporary files
114(object-files and data products of the installation process of
115Geant4) will be placed in <code class="literal">$G4WORKDIR/tmp</code>, according to
116the system architecture used. Binaries will be placed in
117<code class="literal">$G4WORKDIR/bin</code>, according to the system architecture
118used. The path to <code class="literal">$G4WORKDIR/bin/$G4SYSTEM</code> should be
119added to <code class="literal">$PATH</code> in the user environment.
120</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.MkflEnvVar.EnvVar"></a>5.2. 
121Environment variables
122</h3></div></div></div><p>
123Here is a list of the most important environment variables defined
124within the Geant4 <code class="literal">GNUmake</code> infrastructure, with a short
125explanation of their use.
126</p><p>
127<span class="bold"><strong>We recommend that those environment variables listed here and
128marked with (*) NOT be overriden or set (explicitly or by
129accident). They are already set and used internally in the default
130setup !</strong></span>
131</p><h5><a name="id559047"></a>
132System configuration
133</h5><p>
134</p><div class="variablelist"><dl><dt><span class="term">
135 $CLHEP_BASE_DIR
136 </span></dt><dd>
137 Specifies the path where the CLHEP package is installed in your system.
138 </dd><dt><span class="term">
139 $G4SYSTEM
140 </span></dt><dd><p>
141 Defines the architecture and compiler currently used.
142 </p><p>
143 <span class="bold"><strong>NOTE</strong></span>: This variable is set automatically
144 if the <code class="literal">Configure</code> script is adopted for the
145 installation. This will result in the proper settings also for
146 configuring the environment with the generated shell scripts
147 <code class="literal">env.[c]sh</code>.
148 </p></dd></dl></div><p>
149</p><h5><a name="id559109"></a>
150Installation paths
151</h5><p>
152</p><div class="variablelist"><dl><dt><span class="term">
153 $G4INSTALL
154 </span></dt><dd>
155 Defines the path where the Geant4 toolkit should be installed. It
156 should be set by the system installer. By default, it sets to
157 <code class="literal">$HOME/geant4</code>, assuming the Geant4 distribution
158 is placed in <code class="literal">$HOME</code>.
159 </dd><dt><span class="term">
160 $G4BASE <span class="bold"><strong>(*)</strong></span>
161 </span></dt><dd>
162 Defines the path to the source code. Internally used to define
163 <code class="literal">$CPPFLAGS</code> and <code class="literal">$LDFLAGS</code> for
164 -I and -L directives. It has to be set to
165 <code class="literal">$G4INSTALL/src</code>.
166 </dd><dt><span class="term">
167 $G4WORKDIR
168 </span></dt><dd>
169 Defines the path for the user's workdir for Geant4. It is set by
170 default to <code class="literal">$HOME/geant4</code>, assuming the user's
171 working directory for Geant4 is placed in <code class="literal">$HOME</code>.
172 </dd><dt><span class="term">
173 $G4INCLUDE
174 </span></dt><dd>
175 Defines the path where source header files may be mirrored at
176 installation by issuing <code class="literal">gmake includes</code> (default
177 is set to <code class="literal">$G4INSTALL/include</code>)
178 </dd><dt><span class="term">
179 $G4BIN, $G4BINDIR <span class="bold"><strong>(*)</strong></span>
180 </span></dt><dd>
181 Used by the system to specify the place where to store executables.
182 By default they're set to <code class="literal">$G4WORKDIR/bin</code> and
183 <code class="literal">$G4BIN/$G4SYSTEM</code> respectively. The path to
184 <code class="literal">$G4WORKDIR/bin/$G4SYSTEM</code> should be added to
185 <code class="literal">$PATH</code> in the user environment.
186 <code class="literal">$G4BIN</code> can be overridden.
187 </dd><dt><span class="term">
188 $G4TMP, $G4TMPDIR <span class="bold"><strong>(*)</strong></span>
189 </span></dt><dd>
190 Used by the system to specify the place where to store temporary
191 files products of the compilation/build of a user application or
192 test. By default they're set to <code class="literal">$G4WORKDIR/tmp</code>
193 and <code class="literal">$G4TMP/$G4SYSTEM</code> respectively.
194 <code class="literal">$G4TMP</code> can be overridden.
195 </dd><dt><span class="term">
196 $G4LIB, $G4LIBDIR <span class="bold"><strong>(*)</strong></span>
197 </span></dt><dd>
198 Used by the system to specify the place where to store libraries.
199 By default they're set to <code class="literal">$G4INSTALL/lib</code> and
200 <code class="literal">$G4LIB/$G4SYSTEM</code> respectively.
201 <code class="literal">$G4LIB</code> can be overridden.
202 </dd></dl></div><p>
203</p><h5><a name="id559345"></a>
204Build specific
205</h5><p>
206</p><div class="variablelist"><dl><dt><span class="term">
207 $G4TARGET
208 </span></dt><dd>
209 Specifies the target (name of the source file defining the main())
210 of the application/example to be built. This variable is set
211 automatically for the examples and tests placed in
212 <code class="literal">$G4INSTALL/examples</code>.
213 </dd><dt><span class="term">
214 $G4EXEC_BUILD
215 </span></dt><dd>
216 Flag specifying if to use a secondary template repository or not
217 for handling template instantiations at the time of building a user
218 application/example. For internal category tests in Geant4, this
219 variable is already in the related GNUmakefile. It's however not
220 needed for examples and tests in <code class="literal">$G4INSTALL/examples</code>,
221 where class names are already mangled and different each other. It
222 applies only on those compilers which make use of template
223 repositories (see Appendix A.2 of this Guide). The secondary
224 template repository is set to <code class="literal">$G4TREP/exec</code>.
225 </dd><dt><span class="term">
226 $G4DEBUG
227 </span></dt><dd>
228 Specifies to compile the code (libraries or examples) including
229 symbolic information in the object code for debugging. The size of
230 the generated object code can increase considerably. By default,
231 code is compiled in optimised mode (<code class="literal">$G4OPTIMISE</code> set).
232 </dd><dt><span class="term">
233 $G4NO_OPTIMISE
234 </span></dt><dd>
235 Specifies to compile the code (libraries or examples) without
236 compiler optimisation.
237 </dd><dt><span class="term">
238 $G4_NO_VERBOSE
239 </span></dt><dd>
240 Geant4 code is compiled by default in high verbosity mode
241 (<code class="literal">$G4VERBOSE</code> flag set). For better performance,
242 verbosity code can be left out by defining <code class="literal">$G4_NO_VERBOSE</code>.
243 </dd><dt><span class="term">
244 $G4LIB_BUILD_SHARED
245 </span></dt><dd>
246 Flag specifying if to build kernel libraries as shared libraries
247 (libraries will be then used by default). If not set, static
248 archive libraries are built by default.
249 </dd><dt><span class="term">
250 $G4LIB_BUILD_STATIC
251 </span></dt><dd>
252 Flag specifying if to build kernel libraries as static archive
253 libraries in addition to shared libraries (in case
254 <code class="literal">$G4LIB_BUILD_SHARED</code> is set as well).
255 </dd><dt><span class="term">
256 $G4LIB_BUILD_DLL <span class="bold"><strong>(*)</strong></span>
257 </span></dt><dd>
258 Internal flag for specifying to build DLL kernel libraries for
259 Windows systems. The flag is automatically set when requested to
260 build DLLs.
261 </dd><dt><span class="term">
262 $G4LIB_USE_DLL
263 </span></dt><dd>
264 For Windows systems only. Flag to specify to build an application
265 using the installed DLL kernel libraries for Windows systems. It is
266 required to have this flag set in the environment in order to
267 successfully build an application if the DLL libraries have been
268 installed.
269 </dd><dt><span class="term">
270 $G4LIB_USE_GRANULAR
271 </span></dt><dd>
272 To force usage of "granular" libraries against "compound" libraries
273 at link time in case both have been installed. The Geant4 building
274 system chooses "compound" libraries by default, if installed.
275 </dd><dt><span class="term">
276
277 </span></dt><dd></dd></dl></div><p>
278</p><h5><a name="id559537"></a>
279UI specific
280</h5><p>
281The most relevant flags for User Interface drivers are just
282listed here. A more detailed description is given also in section
2832. of this User's Guide.
284</p><p>
285</p><div class="variablelist"><dl><dt><span class="term">
286 G4UI_USE_TERMINAL
287 </span></dt><dd>
288 Specifies to use dumb terminal interface in the application to be
289 built (default).
290 </dd><dt><span class="term">
291 G4UI_USE_TCSH
292 </span></dt><dd>
293 Specifies to use the tcsh-shell like interface in the application
294 to be built.
295 </dd><dt><span class="term">
296 G4UI_BUILD_XM_SESSION, G4UI_BUILD_XAW_SESSION
297 </span></dt><dd>
298 Specifies to include in kernel library the <span class="emphasis"><em>XM</em></span> or
299 <span class="emphasis"><em>XAW</em></span> Motif-based user interfaces.
300 </dd><dt><span class="term">
301 G4UI_USE_XM, G4UI_USE_XAW
302 </span></dt><dd>
303 Specifies to use the <span class="emphasis"><em>XM</em></span> or <span class="emphasis"><em>XAW</em></span>
304 interfaces in the application to be built.
305 </dd><dt><span class="term">
306 G4UI_BUILD_WIN32_SESSION
307 </span></dt><dd>
308 Specifies to include in kernel library the WIN32 terminal interface
309 for Windows systems.
310 </dd><dt><span class="term">
311 G4UI_USE_WIN32
312 </span></dt><dd>
313 Specifies to use the WIN32 interfaces in the application to be
314 built on Windows systems.
315 </dd><dt><span class="term">
316 G4UI_BUILD_QT_SESSION
317 </span></dt><dd>
318 Specifies to include in kernel library the Qt terminal interface.
319 <code class="literal">$QTHOME</code> should specify the path where Qt libraries
320 and headers are installed
321 </dd><dt><span class="term">
322 G4UI_USE_QT
323 </span></dt><dd>
324 Specifies to use the Qt interfaces in the application to be
325 built.
326 </dd><dt><span class="term">
327 G4UI_NONE
328 </span></dt><dd>
329 If set, no UI sessions nor any UI libraries are built. This can be
330 useful when running a pure batch job or in a user framework having
331 its own UI system.
332 </dd></dl></div><p>
333</p><h5><a name="id559675"></a>
334Visualization specific
335</h5><p>
336The most relevant flags for visualization graphics drivers are
337just listed here. A description of these variables is given also in
338section 2. of this User's Guide.
339</p><p>
340</p><div class="variablelist"><dl><dt><span class="term">
341 $G4VIS_BUILD_OPENGLX_DRIVER
342 </span></dt><dd>
343 Specifies to build kernel library for visualization including the
344 OpenGL driver with X11 extension. It requires <code class="literal">$OGLHOME</code>
345 set (path to OpenGL installation).
346 </dd><dt><span class="term">
347 $G4VIS_USE_OPENGLX
348 </span></dt><dd>
349 Specifies to use OpenGL graphics with X11 extension in the
350 application to be built.
351 </dd><dt><span class="term">
352 $G4VIS_BUILD_OPENGLXM_DRIVER
353 </span></dt><dd>
354 Specifies to build kernel library for visualization including the
355 OpenGL driver with XM extension. It requires <code class="literal">$OGLHOME</code>
356 set (path to OpenGL installation).
357 </dd><dt><span class="term">
358 $G4VIS_USE_OPENGLXM
359 </span></dt><dd>
360 Specifies to use OpenGL graphics with XM extension in the
361 application to be built.
362 </dd><dt><span class="term">
363 G4VIS_BUILD_OPENGLQT_DRIVER
364 </span></dt><dd>
365 Specifies to build kernel library for visualization including the
366 OpenGL driver with Qt extension. It requires <code class="literal">$QTHOME</code>
367 set to specify the path where Qt libraries and headers are installed.
368 </dd><dt><span class="term">
369 G4VIS_USE_OPENGLQT
370 </span></dt><dd>
371 Specifies to use OpenGL graphics with Qt extension in the
372 application to be built.
373 </dd><dt><span class="term">
374 $G4VIS_BUILD_OI_DRIVER
375 </span></dt><dd>
376 Specifies to build kernel library for visualization including the
377 OpenInventor driver. It requires <code class="literal">$OIHOME</code> set
378 (paths to the <code class="literal">OpenInventor</code> installation).
379 </dd><dt><span class="term">
380 $G4VIS_USE_OI
381 </span></dt><dd>
382 Specifies to use OpenInventor graphics in the application to be
383 built.
384 </dd><dt><span class="term">
385 $G4VIS_BUILD_OIX_DRIVER
386 </span></dt><dd>
387 Specifies to build the driver for the free X11 version of
388 OpenInventor.
389 </dd><dt><span class="term">
390 $G4VIS_USE_OIX
391 </span></dt><dd>
392 Specifies to use the free X11 version of OpenInventor.
393 </dd><dt><span class="term">
394 $G4VIS_BUILD_RAYTRACERX_DRIVER
395 </span></dt><dd>
396 Specifies to build kernel library for visualization including the
397 Ray-Tracer driver with X11 extension. It requires <code class="literal">X11</code>
398 installed in the system.
399 </dd><dt><span class="term">
400 $G4VIS_USE_RAYTRACERX
401 </span></dt><dd>
402 Specifies to use the X11 version of the Ray-Tracer driver.
403 </dd><dt><span class="term">
404 $G4VIS_BUILD_OIWIN32_DRIVER
405 </span></dt><dd>
406 Specifies to build the driver for the free X11 version of
407 OpenInventor on Windows systems.
408 </dd><dt><span class="term">
409 $G4VIS_USE_OIWIN32
410 </span></dt><dd>
411 Specifies to use the free X11 version of OpenInventor on Windows
412 systems.
413 </dd><dt><span class="term">
414 $G4VIS_BUILD_DAWN_DRIVER
415 </span></dt><dd>
416 Specifies to build kernel library for visualization including the
417 driver for DAWN.
418 </dd><dt><span class="term">
419 $G4VIS_USE_DAWN
420 </span></dt><dd>
421 Specifies to use DAWN as a possible graphics renderer in the
422 application to be built.
423 </dd><dt><span class="term">
424 $G4DAWN_HOST_NAME
425 </span></dt><dd>
426 To specify the hostname for use with the DAWN-network driver.
427 </dd><dt><span class="term">
428 $G4VIS_NONE
429 </span></dt><dd>
430 If specified, no visualization drivers will be built or used.
431 </dd></dl></div><p>
432</p><h5><a name="id559930"></a>
433Hadronic physics specific
434</h5><p>
435</p><div class="variablelist"><dl><dt><span class="term">
436 $G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION
437 </span></dt><dd>
438 When using high precision neutron code, user may choose to force the
439 use of Photon Evaporation model instead of using the neutron capture
440 final state data.
441 </dd><dt><span class="term">
442 $G4NEUTRONHP_SKIP_MISSING_ISOTOPES
443 </span></dt><dd>
444 User can force high precison neutron code to use only exact isotope
445 data files instead of allowing nearby isotope files to be used. If the
446 exact file is not available, the cross section will be set to zero and a
447 warning message will be printed.
448 </dd><dt><span class="term">
449 $G4NEUTRONHP_NEGLECT_DOPPLER
450 </span></dt><dd>
451 Sets neglecting doppler broadening mode for boosting performance.
452 </dd></dl></div><p>
453</p><h5><a name="id559980"></a>
454<code class="literal">GDML</code>, <code class="literal">zlib</code> and <code class="literal">g3tog4</code> modules
455</h5><p>
456</p><div class="variablelist"><dl><dt><span class="term">
457 $G4LIB_BUILD_GDML
458 </span></dt><dd>
459 If set, triggers compilation of a plugin module <code class="literal">gdml</code>
460 for allowing import/export of detector description setups (geometrical
461 volumes, solids, materials, etc.). By default, the flag is not set; if
462 set, the path to the installation of XercesC package must be specified
463 through the variable <code class="literal">$XERCESCROOT</code>.
464 </dd><dt><span class="term">
465 $G4LIB_USE_GDML
466 </span></dt><dd>
467 Specifies to use the <code class="literal">gdml</code> module. The flag is
468 automatically set if <code class="literal">$G4LIB_BUILD_GDML</code> is set in the environment.
469 </dd><dt><span class="term">
470 $G4LIB_BUILD_ZLIB
471 </span></dt><dd>
472 If set, triggers compilation of a specific <code class="literal">zlib</code>
473 module for the compression of output files (mainly in use currently
474 for the HepRep graphics driver). By default, the flag is not set and
475 the built-in system library for compression is adopted instead. Setting
476 this flag will also implicitely set the flag below.
477 </dd><dt><span class="term">
478 $G4LIB_USE_ZLIB
479 </span></dt><dd>
480 Specifies to use the <code class="literal">zlib</code> module, either system
481 built-in or Geant4 specific.
482 </dd><dt><span class="term">
483 $G4LIB_BUILD_G3TOG4
484 </span></dt><dd>
485 If set, triggers compilation of the <code class="literal">g3tog4</code> module for
486 conversions of simple legacy geometries descriptions to Geant4. By
487 default, the flag is not set and the module's library is not built.
488 Setting this flag will also implicitely set the flag below.
489 </dd><dt><span class="term">
490 $G4LIB_USE_G3TOG4
491 </span></dt><dd>
492 Specifies to use the <code class="literal">g3tog4</code> module, assuming the related
493 library has been already installed.
494 </dd></dl></div><p>
495</p><h5><a name="id560130"></a>
496Analysis specific
497</h5><p>
498</p><div class="variablelist"><dl><dt><span class="term">
499 $G4ANALYSIS_USE
500 </span></dt><dd>
501 Specifies to activate the appropriate environment for analysis, if
502 an application includes code for histogramming based on
503 <span class="emphasis"><em>AIDA</em></span>. Additional setup variables are required
504 (<code class="literal">$G4ANALYSIS_AIDA_CONFIG_CFLAGS</code>,
505 <code class="literal">$G4ANALYSIS_AIDA_CONFIG_LIBS</code>) to define config options
506 for AIDA ("<code class="literal">aida-config --cflags</code>" and
507 "<code class="literal">aida-config --libs</code>"). See installation instructions
508 of the specific analysis tools for details.
509 </dd></dl></div><p>
510</p><h5><a name="id560186"></a>
511Directory paths to Physics Data
512</h5><p>
513</p><div class="variablelist"><dl><dt><span class="term">
514 $G4NEUTRONHPDATA
515 </span></dt><dd>
516 Path to external data set for Neutron Scattering processes.
517 </dd><dt><span class="term">
518 $G4LEDATA
519 </span></dt><dd>
520 Path to external data set for low energy electromagnetic
521 processes.
522 </dd><dt><span class="term">
523 $G4LEVELGAMMADATA
524 </span></dt><dd>
525 Path to the data set for Photon Evaporation.
526 </dd><dt><span class="term">
527 $G4RADIOACTIVEDATA
528 </span></dt><dd>
529 Path to the data set for Radiative Decay processes.
530 </dd><dt><span class="term">
531 $G4ABLADATA
532 </span></dt><dd>
533 Path to nuclear shell effects data set for INCL/ABLA hadronic model.
534 </dd></dl></div><p>
535</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.MkflEnvVar.LnkExtLib"></a>5.3. 
536Linking External Libraries with Geant4
537</h3></div></div></div><p>
538The Geant4 GNUmake infrastructure allows to extend the link list of
539libraries with external (or user defined) packages which may be
540required for some user's applications to generate the final
541executable.
542</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.MkflEnvVar.LnkExtLib.AddExtlibNoG4"></a>5.3.1. 
543Adding external libraries which do *not* use Geant4
544</h4></div></div></div><p>
545In the <code class="literal">GNUmakefile</code> of your application, before including
546<code class="literal">binmake.gmk</code>, specify the extra library in
547<code class="literal">EXTRALIBS</code> either using the <code class="literal">-L...-l...</code>
548syntax or by specifying the full pathname, e.g.:
549
550</p><div class="informalexample"><pre class="programlisting">
551 EXTRALIBS := -L&lt;your-path&gt;/lib -l&lt;myExtraLib&gt;
552</pre></div><p>
553or
554</p><div class="informalexample"><pre class="programlisting">
555 EXTRALIBS := &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a
556</pre></div><p>
557</p><p>
558You may also specify <code class="literal">EXTRA_LINK_DEPENDENCIES</code>, which is
559added to the dependency of the target executable, and you may also
560specify a rule for making it, e.g.:
561
562</p><div class="informalexample"><pre class="programlisting">
563 EXTRA_LINK_DEPENDENCIES := &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a
564
565 &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a:
566 cd &lt;your-path&gt;/lib; $(MAKE)
567</pre></div><p>
568</p><p>
569Note that you almost certainly need to augment <code class="literal">CPPFLAGS</code>
570for the header files of the external library, e.g.:
571
572</p><div class="informalexample"><pre class="programlisting">
573 CPPFLAGS+=-I&lt;your-path&gt;/include
574</pre></div><p>
575
576See <a href="apas05.html#programlist_MkflEnvVar_1" title="Example 86. 
577An example of a customised GNUmakefile for an application or
578example using an external module not bound to Geant4.
579">Example 86</a>.
580</p><p>
581</p><div class="example"><a name="programlist_MkflEnvVar_1"></a><p class="title"><b>Example 86. 
582An example of a customised GNUmakefile for an application or
583example using an external module not bound to Geant4.
584</b></p><div class="example-contents"><pre class="programlisting">
585 # --------------------------------------------------------------------
586 # GNUmakefile for the application "sim" depending on module "Xplotter"
587 # --------------------------------------------------------------------
588
589 name := sim
590 G4TARGET := $(name)
591 G4EXLIB := true
592
593 CPPFLAGS += -I$(HOME)/Xplotter/include
594 EXTRALIBS += -L$(HOME)/Xplotter/lib -lXplotter
595 EXTRA_LINK_DEPENDENCIES := $(HOME)/Xplotter/lib/libXplotter.a
596
597 .PHONY: all
598
599 all: lib bin
600
601 include $(G4INSTALL)/config/binmake.gmk
602
603 $(HOME)/Xplotter/lib/libXplotter.a:
604 cd $(HOME)/Xplotter; $(MAKE)
605</pre></div></div><p><br class="example-break">
606</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.MkflEnvVar.LnkExtLib.AddExtlibWithG4"></a>5.3.2. 
607Adding external libraries which use Geant4
608</h4></div></div></div><p>
609In addition to the above, specify, in <code class="literal">EXTRALIBSSOURCEDIRS</code>,
610a list of directories containing source files in its <code class="literal">src/</code>
611subdirectory. Thus, your <code class="literal">GNUmakefile</code> might contain:
612
613</p><div class="informalexample"><pre class="programlisting">
614 EXTRALIBS += $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a \
615 -L&lt;your-path&gt;/lib -l&lt;myExtraLib&gt;
616 EXTRALIBSSOURCEDIRS += &lt;your-path&gt;/&lt;myApp&gt; &lt;your-path&gt;/&lt;MyExtraModule&gt;
617 EXTRA_LINK_DEPENDENCIES := $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a
618
619 MYSOURCES := $(wildcard &lt;your-path&gt;/&lt;myApp&gt;/src/*cc)
620 $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a: $(MYSOURCES)
621 cd &lt;your-path&gt;/&lt;myApp&gt;; $(MAKE)
622</pre></div><p>
623</p><p>
624See <a href="apas05.html#programlist_MkflEnvVar_2" title="Example 87. 
625An example of a customised GNUmakefile for an
626application or example using external modules bound to Geant4.
627">Example 87</a>.
628</p><p>
629</p><div class="example"><a name="programlist_MkflEnvVar_2"></a><p class="title"><b>Example 87. 
630An example of a customised GNUmakefile for an
631application or example using external modules bound to Geant4.
632</b></p><div class="example-contents"><pre class="programlisting">
633# -----------------------------------------------------------------
634# GNUmakefile for the application "phys" depending on module "reco"
635# -----------------------------------------------------------------
636
637name := phys
638G4TARGET := $(name)
639G4EXLIB := true
640
641EXTRALIBS += $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a \
642 -L$(HOME)/reco/lib -lreco
643EXTRALIBSSOURCEDIRS += $(HOME)/phys $(HOME)/reco
644EXTRA_LINK_DEPENDENCIES := $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a
645
646.PHONY: all
647all: lib bin
648
649include $(G4INSTALL)/config/binmake.gmk
650
651MYSOURCES := $(wildcard $(HOME)/phys/src/*cc)
652$(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a: $(MYSOURCES)
653 cd $(HOME)/phys; $(MAKE)
654</pre></div></div><p><br class="example-break">
655</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="apas04.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="apa.html"><img src="AllResources/IconsGIF/up.gif" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="apas06.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">4. 
656C++ Standard Template Library
657 </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="AllResources/IconsGIF/home.gif" alt="Home"></a></td><td width="40%" align="right" valign="top"> 6. 
658Step-by-Step Installation Guides
659</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.