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

Last change on this file since 902 was 902, checked in by garnier, 16 years ago

debut de modif de la doc

File size: 30.9 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    </dd><dt><span class="term">
320      G4UI_USE_QT
321    </span></dt><dd>
322      Specifies to use the Qt interfaces in the application to be
323      built.
324    </dd><dt><span class="term">
325      G4UI_NONE
326    </span></dt><dd>
327      If set, no UI sessions nor any UI libraries are built. This can be
328      useful when running a pure batch job or in a user framework having
329      its own UI system.
330    </dd></dl></div><p>
331</p><h5><a name="id559675"></a>
332Visualization specific
333</h5><p>
334The most relevant flags for visualization graphics drivers are
335just listed here. A description of these variables is given also in
336section 2. of this User's Guide.
337</p><p>
338</p><div class="variablelist"><dl><dt><span class="term">
339      $G4VIS_BUILD_OPENGLX_DRIVER
340    </span></dt><dd>
341      Specifies to build kernel library for visualization including the
342      OpenGL driver with X11 extension. It requires <code class="literal">$OGLHOME</code> 
343      set (path to OpenGL installation).
344    </dd><dt><span class="term">
345      $G4VIS_USE_OPENGLX
346    </span></dt><dd>
347      Specifies to use OpenGL graphics with X11 extension in the
348      application to be built.
349    </dd><dt><span class="term">
350      $G4VIS_BUILD_OPENGLXM_DRIVER
351    </span></dt><dd>
352      Specifies to build kernel library for visualization including the
353      OpenGL driver with XM extension. It requires <code class="literal">$OGLHOME</code> 
354      set (path to OpenGL installation).
355    </dd><dt><span class="term">
356      $G4VIS_USE_OPENGLXM
357    </span></dt><dd>
358      Specifies to use OpenGL graphics with XM extension in the
359      application to be built.
360    </dd><dt><span class="term">
361      G4VIS_BUILD_OPENGLQT_DRIVER
362    </span></dt><dd>
363      Specifies to build kernel library for visualization including the
364      OpenGL driver with Qt extension.
365    </dd><dt><span class="term">
366      G4VIS_USE_OPENGLQT
367    </span></dt><dd>
368      Specifies to use OpenGL graphics with Qt extension in the
369      application to be built.
370    </dd><dt><span class="term">
371      $G4VIS_BUILD_OI_DRIVER
372    </span></dt><dd>
373      Specifies to build kernel library for visualization including the
374      OpenInventor driver. It requires <code class="literal">$OIHOME</code> set
375      (paths to the <code class="literal">OpenInventor</code> installation).
376    </dd><dt><span class="term">
377      $G4VIS_USE_OI
378    </span></dt><dd>
379      Specifies to use OpenInventor graphics in the application to be
380      built.
381    </dd><dt><span class="term">
382      $G4VIS_BUILD_OIX_DRIVER
383    </span></dt><dd>
384      Specifies to build the driver for the free X11 version of
385      OpenInventor.
386    </dd><dt><span class="term">
387      $G4VIS_USE_OIX
388    </span></dt><dd>
389      Specifies to use the free X11 version of OpenInventor.
390    </dd><dt><span class="term">
391      $G4VIS_BUILD_RAYTRACERX_DRIVER
392    </span></dt><dd>
393      Specifies to build kernel library for visualization including the
394      Ray-Tracer driver with X11 extension. It requires <code class="literal">X11</code>
395      installed in the system.
396    </dd><dt><span class="term">
397      $G4VIS_USE_RAYTRACERX
398    </span></dt><dd>
399      Specifies to use the X11 version of the Ray-Tracer driver.
400    </dd><dt><span class="term">
401      $G4VIS_BUILD_OIWIN32_DRIVER
402    </span></dt><dd>
403      Specifies to build the driver for the free X11 version of
404      OpenInventor on Windows systems.
405    </dd><dt><span class="term">
406      $G4VIS_USE_OIWIN32
407    </span></dt><dd>
408      Specifies to use the free X11 version of OpenInventor on Windows
409      systems.
410    </dd><dt><span class="term">
411      $G4VIS_BUILD_DAWN_DRIVER
412    </span></dt><dd>
413      Specifies to build kernel library for visualization including the
414      driver for DAWN.
415    </dd><dt><span class="term">
416      $G4VIS_USE_DAWN
417    </span></dt><dd>
418      Specifies to use DAWN as a possible graphics renderer in the
419      application to be built.
420    </dd><dt><span class="term">
421      $G4DAWN_HOST_NAME
422    </span></dt><dd>
423      To specify the hostname for use with the DAWN-network driver.
424    </dd><dt><span class="term">
425      $G4VIS_NONE
426    </span></dt><dd>
427      If specified, no visualization drivers will be built or used.
428    </dd></dl></div><p>
429</p><h5><a name="id559930"></a>
430Hadronic physics specific
431</h5><p>
432</p><div class="variablelist"><dl><dt><span class="term">
433      $G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION
434    </span></dt><dd>
435      When using high precision neutron code, user may choose to force the
436      use of Photon Evaporation model instead of using the neutron capture
437      final state data.
438    </dd><dt><span class="term">
439      $G4NEUTRONHP_SKIP_MISSING_ISOTOPES
440    </span></dt><dd>
441      User can force high precison neutron code to use only exact isotope
442      data files instead of allowing nearby isotope files to be used. If the
443      exact file is not available, the cross section will be set to zero and a
444      warning message will be printed.
445    </dd><dt><span class="term">
446      $G4NEUTRONHP_NEGLECT_DOPPLER
447    </span></dt><dd>
448      Sets neglecting doppler broadening mode for boosting performance.
449    </dd></dl></div><p>
450</p><h5><a name="id559980"></a>
451<code class="literal">GDML</code>, <code class="literal">zlib</code> and <code class="literal">g3tog4</code> modules
452</h5><p>
453</p><div class="variablelist"><dl><dt><span class="term">
454      $G4LIB_BUILD_GDML
455    </span></dt><dd>
456      If set, triggers compilation of a plugin module <code class="literal">gdml</code> 
457      for allowing import/export of detector description setups (geometrical
458      volumes, solids, materials, etc.). By default, the flag is not set; if
459      set, the path to the installation of XercesC package must be specified
460      through the variable <code class="literal">$XERCESCROOT</code>.
461    </dd><dt><span class="term">
462      $G4LIB_USE_GDML
463    </span></dt><dd>
464      Specifies to use the <code class="literal">gdml</code> module. The flag is
465      automatically set if <code class="literal">$G4LIB_BUILD_GDML</code> is set in the environment.
466    </dd><dt><span class="term">
467      $G4LIB_BUILD_ZLIB
468    </span></dt><dd>
469      If set, triggers compilation of a specific <code class="literal">zlib</code> 
470      module for the compression of output files (mainly in use currently
471      for the HepRep graphics driver). By default, the flag is not set and
472      the built-in system library for compression is adopted instead. Setting
473      this flag will also implicitely set the flag below.
474    </dd><dt><span class="term">
475      $G4LIB_USE_ZLIB
476    </span></dt><dd>
477      Specifies to use the <code class="literal">zlib</code> module, either system
478      built-in or Geant4 specific.
479    </dd><dt><span class="term">
480      $G4LIB_BUILD_G3TOG4
481    </span></dt><dd>
482      If set, triggers compilation of the <code class="literal">g3tog4</code> module for
483      conversions of simple legacy geometries descriptions to Geant4. By
484      default, the flag is not set and the module's library is not built.
485      Setting this flag will also implicitely set the flag below.
486    </dd><dt><span class="term">
487      $G4LIB_USE_G3TOG4
488    </span></dt><dd>
489      Specifies to use the <code class="literal">g3tog4</code> module, assuming the related
490      library has been already installed.
491    </dd></dl></div><p>
492</p><h5><a name="id560130"></a>
493Analysis specific
494</h5><p>
495</p><div class="variablelist"><dl><dt><span class="term">
496      $G4ANALYSIS_USE
497    </span></dt><dd>
498      Specifies to activate the appropriate environment for analysis, if
499      an application includes code for histogramming based on
500      <span class="emphasis"><em>AIDA</em></span>. Additional setup variables are required
501      (<code class="literal">$G4ANALYSIS_AIDA_CONFIG_CFLAGS</code>,
502      <code class="literal">$G4ANALYSIS_AIDA_CONFIG_LIBS</code>) to define config options
503      for AIDA ("<code class="literal">aida-config --cflags</code>" and
504      "<code class="literal">aida-config --libs</code>"). See installation instructions
505      of the specific analysis tools for details.
506    </dd></dl></div><p>
507</p><h5><a name="id560186"></a>
508Directory paths to Physics Data
509</h5><p>
510</p><div class="variablelist"><dl><dt><span class="term">
511      $G4NEUTRONHPDATA
512    </span></dt><dd>
513      Path to external data set for Neutron Scattering processes.
514    </dd><dt><span class="term">
515      $G4LEDATA
516    </span></dt><dd>
517      Path to external data set for low energy electromagnetic
518      processes.
519    </dd><dt><span class="term">
520      $G4LEVELGAMMADATA
521    </span></dt><dd>
522      Path to the data set for Photon Evaporation.
523    </dd><dt><span class="term">
524      $G4RADIOACTIVEDATA
525    </span></dt><dd>
526      Path to the data set for Radiative Decay processes.
527    </dd><dt><span class="term">
528      $G4ABLADATA
529    </span></dt><dd>
530      Path to nuclear shell effects data set for INCL/ABLA hadronic model.
531    </dd></dl></div><p>
532</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.MkflEnvVar.LnkExtLib"></a>5.3. 
533Linking External Libraries with Geant4
534</h3></div></div></div><p>
535The Geant4 GNUmake infrastructure allows to extend the link list of
536libraries with external (or user defined) packages which may be
537required for some user's applications to generate the final
538executable.
539</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="sect.MkflEnvVar.LnkExtLib.AddExtlibNoG4"></a>5.3.1. 
540Adding external libraries which do *not* use Geant4
541</h4></div></div></div><p>
542In the <code class="literal">GNUmakefile</code> of your application, before including
543<code class="literal">binmake.gmk</code>, specify the extra library in
544<code class="literal">EXTRALIBS</code> either using the <code class="literal">-L...-l...</code> 
545syntax or by specifying the full pathname, e.g.:
546
547</p><div class="informalexample"><pre class="programlisting">
548  EXTRALIBS := -L&lt;your-path&gt;/lib -l&lt;myExtraLib&gt;
549</pre></div><p>
550or
551</p><div class="informalexample"><pre class="programlisting">
552  EXTRALIBS := &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a
553</pre></div><p>
554</p><p>
555You may also specify <code class="literal">EXTRA_LINK_DEPENDENCIES</code>, which is
556added to the dependency of the target executable, and you may also
557specify a rule for making it, e.g.:
558
559</p><div class="informalexample"><pre class="programlisting">
560  EXTRA_LINK_DEPENDENCIES := &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a
561
562  &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a:
563        cd &lt;your-path&gt;/lib; $(MAKE)
564</pre></div><p>
565</p><p>
566Note that you almost certainly need to augment <code class="literal">CPPFLAGS</code>
567for the header files of the external library, e.g.:
568
569</p><div class="informalexample"><pre class="programlisting">
570  CPPFLAGS+=-I&lt;your-path&gt;/include
571</pre></div><p>
572
573See <a href="apas05.html#programlist_MkflEnvVar_1" title="Example 86. 
574An example of a customised GNUmakefile for an application or
575example using an external module not bound to Geant4.
576">Example 86</a>.
577</p><p>
578</p><div class="example"><a name="programlist_MkflEnvVar_1"></a><p class="title"><b>Example 86. 
579An example of a customised GNUmakefile for an application or
580example using an external module not bound to Geant4.
581</b></p><div class="example-contents"><pre class="programlisting">
582 # --------------------------------------------------------------------
583 # GNUmakefile for the application "sim" depending on module "Xplotter"
584 # --------------------------------------------------------------------
585
586 name := sim
587 G4TARGET := $(name)
588 G4EXLIB := true
589
590 CPPFLAGS  += -I$(HOME)/Xplotter/include
591 EXTRALIBS += -L$(HOME)/Xplotter/lib -lXplotter
592 EXTRA_LINK_DEPENDENCIES := $(HOME)/Xplotter/lib/libXplotter.a
593
594 .PHONY: all
595
596 all: lib bin
597
598 include $(G4INSTALL)/config/binmake.gmk
599
600 $(HOME)/Xplotter/lib/libXplotter.a:
601         cd $(HOME)/Xplotter; $(MAKE)
602</pre></div></div><p><br class="example-break">
603</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. 
604Adding external libraries which use Geant4
605</h4></div></div></div><p>
606In addition to the above, specify, in <code class="literal">EXTRALIBSSOURCEDIRS</code>,
607a list of directories containing source files in its <code class="literal">src/</code>
608subdirectory. Thus, your <code class="literal">GNUmakefile</code> might contain:
609
610</p><div class="informalexample"><pre class="programlisting">
611  EXTRALIBS += $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a \
612               -L&lt;your-path&gt;/lib -l&lt;myExtraLib&gt;
613  EXTRALIBSSOURCEDIRS += &lt;your-path&gt;/&lt;myApp&gt; &lt;your-path&gt;/&lt;MyExtraModule&gt;
614  EXTRA_LINK_DEPENDENCIES := $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a
615
616  MYSOURCES := $(wildcard &lt;your-path&gt;/&lt;myApp&gt;/src/*cc)
617  $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a: $(MYSOURCES)
618        cd &lt;your-path&gt;/&lt;myApp&gt;; $(MAKE)
619</pre></div><p>
620</p><p>
621See <a href="apas05.html#programlist_MkflEnvVar_2" title="Example 87. 
622An example of a customised GNUmakefile for an
623application or example using external modules bound to Geant4.
624">Example 87</a>.
625</p><p>
626</p><div class="example"><a name="programlist_MkflEnvVar_2"></a><p class="title"><b>Example 87. 
627An example of a customised GNUmakefile for an
628application or example using external modules bound to Geant4.
629</b></p><div class="example-contents"><pre class="programlisting">
630# -----------------------------------------------------------------
631# GNUmakefile for the application "phys" depending on module "reco"
632# -----------------------------------------------------------------
633
634name := phys
635G4TARGET := $(name)
636G4EXLIB := true
637
638EXTRALIBS += $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a \
639             -L$(HOME)/reco/lib -lreco
640EXTRALIBSSOURCEDIRS += $(HOME)/phys $(HOME)/reco
641EXTRA_LINK_DEPENDENCIES := $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a
642
643.PHONY: all
644all: lib bin
645
646include $(G4INSTALL)/config/binmake.gmk
647
648MYSOURCES := $(wildcard $(HOME)/phys/src/*cc)
649$(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a: $(MYSOURCES)
650        cd $(HOME)/phys; $(MAKE)
651</pre></div></div><p><br class="example-break">
652</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. 
653C++ Standard Template Library
654 </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. 
655Step-by-Step Installation Guides
656</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.