source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Appendix/makeFile.xml@ 1301

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

CVS update

File size: 30.7 KB
Line 
1<!-- ******************************************************** -->
2<!-- -->
3<!-- [History] -->
4<!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
5<!-- -->
6<!-- ******************************************************** -->
7
8
9<!-- ******************* Section (Level#1) ****************** -->
10<sect1 id="sect.MkflEnvVar">
11<title>
12Makefiles and Environment Variables
13</title>
14
15<para>
16This section describes how the GNUmake infrastructure is
17implemented in Geant4 and provides a quick reference guide for the
18user/installer about the most important environment variables
19defined.
20</para>
21
22<!-- ******************* Section (Level#2) ****************** -->
23<sect2 id="sect.MkflEnvVar.GNUG4">
24<title>
25The GNUmake system in Geant4
26</title>
27
28<para>
29As described in <xref linkend="sect.HowToDefMain" /> of the
30Installation Guide, the GNUmake process in
31Geant4 is mainly controlled by the following GNUmake script files
32(<literal>*.gmk</literal> scripts are placed in
33<literal>$G4INSTALL/config</literal>):
34
35<itemizedlist spacing="compact">
36 <listitem><para>
37 <literal>architecture.gmk</literal>: defining all the architecture
38 specific settings and paths. System settings are stored in
39 <literal>$G4INSTALL/config/sys</literal> in separate files.
40 </para></listitem>
41 <listitem><para>
42 <literal>common.gmk</literal>: defining all general GNUmake rules for
43 building objects and libraries.
44 </para></listitem>
45 <listitem><para>
46 <literal>globlib.gmk</literal>: defining all general GNUmake rules for
47 building compound libraries.
48 </para></listitem>
49 <listitem><para>
50 <literal>binmake.gmk</literal>: defining the general GNUmake rules for
51 building executables.
52 </para></listitem>
53 <listitem><para>
54 <literal>GNUmake</literal> scripts: placed inside each directory in the
55 G4 distribution and defining directives specific to build a library
56 (or a set of sub-libraries) or and executable.
57 </para></listitem>
58</itemizedlist>
59</para>
60
61<para>
62To build a single library (or a set of sub-libraries) or an
63executable, you must explicitly change your current directory to
64the one you're interested in and invoke the "<literal>make</literal>"
65command from there ("<literal>make global</literal>" for building a
66compound library). Here is a list of the basic commands or GNUmake
67"targets" one can invoke to build libraries and/or executables:
68
69<itemizedlist spacing="compact">
70 <listitem><para>
71 <literal>make</literal>
72 <para>
73 starts the compilation process for building a kernel library or a
74 library associated with an example. Kernel libraries are built with
75 maximum granularity, i.e. if a category is a compound, this command
76 will build all the related sub-libraries,
77 <emphasis role="bold">not</emphasis> the compound one.
78 The top level <literal>GNUmakefile</literal> in
79 <literal>$G4INSTALL/source</literal> will also build in this case a
80 dependency map <literal>libname.map</literal> of each library to establish
81 the linking order automatically at the <literal>bin</literal> step. The map
82 will be placed in <literal>$G4LIB/$G4SYSTEM</literal>.
83 </para>
84 </para></listitem>
85 <listitem><para>
86 <literal>make global</literal>
87 <para>
88 starts the compilation process to build a single compound kernel
89 library per category. If issued after "make", both 'granular' and
90 'compound' libraries will be available (NOTE: this will
91 consistently increase the disk space required. Compound libraries
92 will then be selected by default at link time, unless
93 G4LIB_USE_GRANULAR is specified).
94 </para>
95 </para></listitem>
96 <listitem><para>
97 <literal>make bin</literal> or <literal>make</literal> (only for
98 examples/)
99 <para>
100 starts the compilation process to build an executable. This command
101 will build implicitly the library associated with the example and
102 link the final application. It assumes <emphasis role="bold">all</emphasis>
103 kernel libraries are already generated and placed in the correct
104 <literal>$G4INSTALL</literal> path defined for them.
105 </para>
106
107 <para>
108 The linking order is controlled automatically in case libraries
109 have been built with maximum granularity, and the link list is
110 generated on the fly.
111 </para>
112 </para></listitem>
113 <listitem><para>
114 <literal>make dll</literal>
115 <para>
116 On Windows systems this will start the compilation process to build
117 single compound kernel library per category and generate Dynamic
118 Link Libraries (DLLs). Once the libraries are generated, the
119 process will imply also the deletion of all temporary files
120 generated during the compilation.
121 </para>
122 </para></listitem>
123</itemizedlist>
124</para>
125
126<!-- ******* Bridgehead ******* -->
127<bridgehead renderas='sect4'>
128<literal>lib/ bin/</literal> and <literal>tmp/</literal> directories
129</bridgehead>
130
131<para>
132The <literal>$G4INSTALL</literal> environment variable specifies where
133the installation of the Geant4 toolkit should take place, therefore
134kernel libraries will be placed in <literal>$G4INSTALL/lib</literal>. The
135<literal>$G4WORKDIR</literal> environment variable is set by the user and
136specifies the path to the user working directory; temporary files
137(object-files and data products of the installation process of
138Geant4) will be placed in <literal>$G4WORKDIR/tmp</literal>, according to
139the system architecture used. Binaries will be placed in
140<literal>$G4WORKDIR/bin</literal>, according to the system architecture
141used. The path to <literal>$G4WORKDIR/bin/$G4SYSTEM</literal> should be
142added to <literal>$PATH</literal> in the user environment.
143</para>
144
145</sect2>
146
147
148<!-- ******************* Section (Level#2) ****************** -->
149<sect2 id="sect.MkflEnvVar.EnvVar">
150<title>
151Environment variables
152</title>
153
154<para>
155Here is a list of the most important environment variables defined
156within the Geant4 <literal>GNUmake</literal> infrastructure, with a short
157explanation of their use.
158</para>
159
160<para>
161<emphasis role="bold">We recommend that those environment variables listed here and
162marked with (*) NOT be overriden or set (explicitly or by
163accident). They are already set and used internally in the default
164setup !</emphasis>
165</para>
166
167<!-- ******* Bridgehead ******* -->
168<bridgehead renderas='sect4'>
169System configuration
170</bridgehead>
171
172<para>
173<variablelist>
174 <varlistentry>
175 <term>
176 $CLHEP_BASE_DIR
177 </term>
178 <listitem>
179 Specifies the path where the CLHEP package is installed in your system.
180 </listitem>
181 </varlistentry>
182 <varlistentry>
183 <term>
184 $G4SYSTEM
185 </term>
186 <listitem>
187 <para>
188 Defines the architecture and compiler currently used.
189 </para>
190 <para>
191 <emphasis role="bold">NOTE</emphasis>: This variable is set automatically
192 if the <literal>Configure</literal> script is adopted for the
193 installation. This will result in the proper settings also for
194 configuring the environment with the generated shell scripts
195 <literal>env.[c]sh</literal>.
196 </para>
197 </listitem>
198 </varlistentry>
199</variablelist>
200</para>
201
202
203
204<!-- ******* Bridgehead ******* -->
205<bridgehead renderas='sect4'>
206Installation paths
207</bridgehead>
208
209<para>
210<variablelist>
211 <varlistentry>
212 <term>
213 $G4INSTALL
214 </term>
215 <listitem>
216 Defines the path where the Geant4 toolkit is located. It
217 should be set by the system installer. By default, it sets to
218 <literal>$HOME/geant4</literal>, assuming the Geant4 distribution
219 is placed in <literal>$HOME</literal>.
220 </listitem>
221 </varlistentry>
222 <varlistentry>
223 <term>
224 $G4BASE <emphasis role="bold">(*)</emphasis>
225 </term>
226 <listitem>
227 Defines the path to the source code. Internally used to define
228 <literal>$CPPFLAGS</literal> and <literal>$LDFLAGS</literal> for
229 -I and -L directives. It has to be set to
230 <literal>$G4INSTALL/src</literal>.
231 </listitem>
232 </varlistentry>
233 <varlistentry>
234 <term>
235 $G4WORKDIR
236 </term>
237 <listitem>
238 Defines the path for the user's workdir for Geant4. It is set by
239 default to <literal>$HOME/geant4</literal>, assuming the user's
240 working directory for Geant4 is placed in <literal>$HOME</literal>.
241 </listitem>
242 </varlistentry>
243 <varlistentry>
244 <term>
245 $G4INCLUDE
246 </term>
247 <listitem>
248 Defines the path where source header files may be mirrored at
249 installation by issuing <literal>gmake includes</literal> (default
250 is set to <literal>$G4INSTALL/include</literal>)
251 </listitem>
252 </varlistentry>
253 <varlistentry>
254 <term>
255 $G4BIN, $G4BINDIR <emphasis role="bold">(*)</emphasis>
256 </term>
257 <listitem>
258 Used by the system to specify the place where to store executables.
259 By default they're set to <literal>$G4WORKDIR/bin</literal> and
260 <literal>$G4BIN/$G4SYSTEM</literal> respectively. The path to
261 <literal>$G4WORKDIR/bin/$G4SYSTEM</literal> should be added to
262 <literal>$PATH</literal> in the user environment.
263 <literal>$G4BIN</literal> can be overridden.
264 </listitem>
265 </varlistentry>
266 <varlistentry>
267 <term>
268 $G4TMP, $G4TMPDIR <emphasis role="bold">(*)</emphasis>
269 </term>
270 <listitem>
271 Used by the system to specify the place where to store temporary
272 files products of the compilation/build of a user application or
273 test. By default they're set to <literal>$G4WORKDIR/tmp</literal>
274 and <literal>$G4TMP/$G4SYSTEM</literal> respectively.
275 <literal>$G4TMP</literal> can be overridden.
276 </listitem>
277 </varlistentry>
278 <varlistentry>
279 <term>
280 $G4LIB, $G4LIBDIR <emphasis role="bold">(*)</emphasis>
281 </term>
282 <listitem>
283 Used by the system to specify the place where to install libraries.
284 By default they're set to <literal>$G4INSTALL/lib</literal> and
285 <literal>$G4LIB/$G4SYSTEM</literal> respectively.
286 <literal>$G4LIB</literal> can be overridden.
287 </listitem>
288 </varlistentry>
289</variablelist>
290</para>
291
292<!-- ******* Bridgehead ******* -->
293<bridgehead renderas='sect4'>
294Build specific
295</bridgehead>
296
297<para>
298<variablelist>
299 <varlistentry>
300 <term>
301 $G4TARGET
302 </term>
303 <listitem>
304 Specifies the target (name of the source file defining the main())
305 of the application/example to be built. This variable is set
306 automatically for the examples and tests placed in
307 <literal>$G4INSTALL/examples</literal>.
308 </listitem>
309 </varlistentry>
310 <varlistentry>
311 <term>
312 $G4DEBUG
313 </term>
314 <listitem>
315 Specifies to compile the code (libraries or examples) including
316 symbolic information in the object code for debugging. The size of
317 the generated object code can increase considerably. By default,
318 code is compiled in optimised mode (<literal>$G4OPTIMISE</literal> set).
319 </listitem>
320 </varlistentry>
321 <varlistentry>
322 <term>
323 $G4OPTDEBUG
324 </term>
325 <listitem>
326 Only available for the <literal>g++</literal> compiler, specifies to
327 compile the code (libraries or examples) in optimised mode, but
328 including symbolic information in the object code for debugging.
329 </listitem>
330 </varlistentry>
331 <varlistentry>
332 <term>
333 $G4NO_OPTIMISE
334 </term>
335 <listitem>
336 Specifies to compile the code (libraries or examples) without
337 compiler optimisation.
338 </listitem>
339 </varlistentry>
340 <varlistentry>
341 <term>
342 $G4PROFILE
343 </term>
344 <listitem>
345 On <literal>Linux</literal> systems with the <literal>g++</literal>
346 compiler, it allows to build libraries with profiling setup for
347 monitoring with the <literal>gprof</literal> tool.
348 </listitem>
349 </varlistentry>
350 <varlistentry>
351 <term>
352 $G4_NO_VERBOSE
353 </term>
354 <listitem>
355 Geant4 code is compiled by default in high verbosity mode
356 (<literal>$G4VERBOSE</literal> flag set). For better performance,
357 verbosity code can be left out by defining <literal>$G4_NO_VERBOSE</literal>.
358 </listitem>
359 </varlistentry>
360 <varlistentry>
361 <term>
362 $G4LIB_BUILD_SHARED
363 </term>
364 <listitem>
365 Flag specifying if to build kernel libraries as shared libraries
366 (libraries will be then used by default). If not set, static
367 archive libraries are built by default.
368 </listitem>
369 </varlistentry>
370 <varlistentry>
371 <term>
372 $G4LIB_BUILD_STATIC
373 </term>
374 <listitem>
375 Flag specifying if to build kernel libraries as static archive
376 libraries in addition to shared libraries (in case
377 <literal>$G4LIB_BUILD_SHARED</literal> is set as well).
378 </listitem>
379 </varlistentry>
380 <varlistentry>
381 <term>
382 $G4LIB_BUILD_DLL <emphasis role="bold">(*)</emphasis>
383 </term>
384 <listitem>
385 Internal flag for specifying to build DLL kernel libraries for
386 Windows systems. The flag is automatically set when requested to
387 build DLLs.
388 </listitem>
389 </varlistentry>
390 <varlistentry>
391 <term>
392 $G4LIB_USE_DLL
393 </term>
394 <listitem>
395 For Windows systems only. Flag to specify to build an application
396 using the installed DLL kernel libraries for Windows systems. It is
397 required to have this flag set in the environment in order to
398 successfully build an application if the DLL libraries have been
399 installed.
400 </listitem>
401 </varlistentry>
402 <varlistentry>
403 <term>
404 $G4LIB_USE_GRANULAR
405 </term>
406 <listitem>
407 To force usage of "granular" libraries against "compound" libraries
408 at link time in case both have been installed. The Geant4 building
409 system chooses "compound" libraries by default, if installed.
410 </listitem>
411 </varlistentry>
412 <varlistentry>
413 <term>
414
415 </term>
416 <listitem>
417
418 </listitem>
419 </varlistentry>
420</variablelist>
421</para>
422
423<!-- ******* Bridgehead ******* -->
424<bridgehead renderas='sect4'>
425UI specific
426</bridgehead>
427
428<para>
429The most relevant flags for User Interface drivers are just
430listed here. A more detailed description is given also in section
4312. of this User's Guide.
432</para>
433
434<para>
435<variablelist>
436 <varlistentry>
437 <term>
438 G4UI_USE_TERMINAL
439 </term>
440 <listitem>
441 Specifies to use dumb terminal interface in the application to be
442 built (default).
443 </listitem>
444 </varlistentry>
445 <varlistentry>
446 <term>
447 G4UI_USE_TCSH
448 </term>
449 <listitem>
450 Specifies to use the tcsh-shell like interface in the application
451 to be built.
452 </listitem>
453 </varlistentry>
454 <varlistentry>
455 <term>
456 G4UI_BUILD_XM_SESSION, G4UI_BUILD_XAW_SESSION
457 </term>
458 <listitem>
459 Specifies to include in kernel library the <emphasis>XM</emphasis> or
460 <emphasis>XAW</emphasis> Motif-based user interfaces.
461 </listitem>
462 </varlistentry>
463 <varlistentry>
464 <term>
465 G4UI_USE_XM, G4UI_USE_XAW
466 </term>
467 <listitem>
468 Specifies to use the <emphasis>XM</emphasis> or <emphasis>XAW</emphasis>
469 interfaces in the application to be built.
470 </listitem>
471 </varlistentry>
472 <varlistentry>
473 <term>
474 G4UI_BUILD_WIN32_SESSION
475 </term>
476 <listitem>
477 Specifies to include in kernel library the WIN32 terminal interface
478 for Windows systems.
479 </listitem>
480 </varlistentry>
481 <varlistentry>
482 <term>
483 G4UI_USE_WIN32
484 </term>
485 <listitem>
486 Specifies to use the WIN32 interfaces in the application to be
487 built on Windows systems.
488 </listitem>
489 </varlistentry>
490 <varlistentry>
491 <term>
492 G4UI_BUILD_QT_SESSION
493 </term>
494 <listitem>
495 Specifies to include in kernel library the Qt terminal interface.
496 <literal>$QTHOME</literal> should specify the path where Qt libraries
497 and headers are installed
498 </listitem>
499 </varlistentry>
500 <varlistentry>
501 <term>
502 G4UI_USE_QT
503 </term>
504 <listitem>
505 Specifies to use the Qt interfaces in the application to be
506 built.
507 </listitem>
508 </varlistentry>
509 <varlistentry>
510 <term>
511 G4UI_NONE
512 </term>
513 <listitem>
514 If set, no UI sessions nor any UI libraries are built. This can be
515 useful when running a pure batch job or in a user framework having
516 its own UI system.
517 </listitem>
518 </varlistentry>
519</variablelist>
520</para>
521
522<!-- ******* Bridgehead ******* -->
523<bridgehead renderas='sect4'>
524Visualization specific
525</bridgehead>
526
527<para>
528The most relevant flags for visualization graphics drivers are
529just listed here. A description of these variables is given also in
530section 2. of this User's Guide.
531</para>
532
533<para>
534<variablelist>
535 <varlistentry>
536 <term>
537 $G4VIS_BUILD_OPENGLX_DRIVER
538 </term>
539 <listitem>
540 Specifies to build kernel library for visualization including the
541 OpenGL driver with X11 extension. It requires <literal>$OGLHOME</literal>
542 set (path to OpenGL installation).
543 </listitem>
544 </varlistentry>
545 <varlistentry>
546 <term>
547 $G4VIS_USE_OPENGLX
548 </term>
549 <listitem>
550 Specifies to use OpenGL graphics with X11 extension in the
551 application to be built.
552 </listitem>
553 </varlistentry>
554 <varlistentry>
555 <term>
556 $G4VIS_BUILD_OPENGLXM_DRIVER
557 </term>
558 <listitem>
559 Specifies to build kernel library for visualization including the
560 OpenGL driver with XM extension. It requires <literal>$OGLHOME</literal>
561 set (path to OpenGL installation).
562 </listitem>
563 </varlistentry>
564 <varlistentry>
565 <term>
566 $G4VIS_USE_OPENGLXM
567 </term>
568 <listitem>
569 Specifies to use OpenGL graphics with XM extension in the
570 application to be built.
571 </listitem>
572 </varlistentry>
573 <varlistentry>
574 <term>
575 G4VIS_BUILD_OPENGLQT_DRIVER
576 </term>
577 <listitem>
578 Specifies to build kernel library for visualization including the
579 OpenGL driver with Qt extension. It requires <literal>$QTHOME</literal>
580 set to specify the path where Qt libraries and headers are installed.
581 </listitem>
582 </varlistentry>
583 <varlistentry>
584 <term>
585 G4VIS_USE_OPENGLQT
586 </term>
587 <listitem>
588 Specifies to use OpenGL graphics with Qt extension in the
589 application to be built.
590 </listitem>
591 </varlistentry>
592 <varlistentry>
593 <term>
594 $G4VIS_BUILD_OI_DRIVER
595 </term>
596 <listitem>
597 Specifies to build kernel library for visualization including the
598 OpenInventor driver. It requires <literal>$OIHOME</literal> set
599 (paths to the <literal>OpenInventor</literal> installation).
600 </listitem>
601 </varlistentry>
602 <varlistentry>
603 <term>
604 $G4VIS_USE_OI
605 </term>
606 <listitem>
607 Specifies to use OpenInventor graphics in the application to be
608 built.
609 </listitem>
610 </varlistentry>
611 <varlistentry>
612 <term>
613 $G4VIS_BUILD_OIX_DRIVER
614 </term>
615 <listitem>
616 Specifies to build the driver for the free X11 version of
617 OpenInventor.
618 </listitem>
619 </varlistentry>
620 <varlistentry>
621 <term>
622 $G4VIS_USE_OIX
623 </term>
624 <listitem>
625 Specifies to use the free X11 version of OpenInventor.
626 </listitem>
627 </varlistentry>
628 <varlistentry>
629 <term>
630 $G4VIS_BUILD_RAYTRACERX_DRIVER
631 </term>
632 <listitem>
633 Specifies to build kernel library for visualization including the
634 Ray-Tracer driver with X11 extension. It requires <literal>X11</literal>
635 installed in the system.
636 </listitem>
637 </varlistentry>
638 <varlistentry>
639 <term>
640 $G4VIS_USE_RAYTRACERX
641 </term>
642 <listitem>
643 Specifies to use the X11 version of the Ray-Tracer driver.
644 </listitem>
645 </varlistentry>
646 <varlistentry>
647 <term>
648 $G4VIS_BUILD_OIWIN32_DRIVER
649 </term>
650 <listitem>
651 Specifies to build the driver for the free X11 version of
652 OpenInventor on Windows systems.
653 </listitem>
654 </varlistentry>
655 <varlistentry>
656 <term>
657 $G4VIS_USE_OIWIN32
658 </term>
659 <listitem>
660 Specifies to use the free X11 version of OpenInventor on Windows
661 systems.
662 </listitem>
663 </varlistentry>
664 <varlistentry>
665 <term>
666 $G4VIS_BUILD_DAWN_DRIVER
667 </term>
668 <listitem>
669 Specifies to build kernel library for visualization including the
670 driver for DAWN.
671 </listitem>
672 </varlistentry>
673 <varlistentry>
674 <term>
675 $G4VIS_USE_DAWN
676 </term>
677 <listitem>
678 Specifies to use DAWN as a possible graphics renderer in the
679 application to be built.
680 </listitem>
681 </varlistentry>
682 <varlistentry>
683 <term>
684 $G4DAWN_HOST_NAME
685 </term>
686 <listitem>
687 To specify the hostname for use with the DAWN-network driver.
688 </listitem>
689 </varlistentry>
690 <varlistentry>
691 <term>
692 $G4VIS_NONE
693 </term>
694 <listitem>
695 If specified, no visualization drivers will be built or used.
696 </listitem>
697 </varlistentry>
698</variablelist>
699</para>
700
701<!-- ******* Bridgehead ******* -->
702<bridgehead renderas='sect4'>
703Hadronic physics specific
704</bridgehead>
705
706<para>
707<variablelist>
708 <varlistentry>
709 <term>
710 $G4NEUTRONHP_USE_ONLY_PHOTONEVAPORATION
711 </term>
712 <listitem>
713 When using high precision neutron code, user may choose to force the
714 use of Photon Evaporation model instead of using the neutron capture
715 final state data.
716 </listitem>
717 </varlistentry>
718 <varlistentry>
719 <term>
720 $G4NEUTRONHP_SKIP_MISSING_ISOTOPES
721 </term>
722 <listitem>
723 User can force high precison neutron code to use only exact isotope
724 data files instead of allowing nearby isotope files to be used. If the
725 exact file is not available, the cross section will be set to zero and a
726 warning message will be printed.
727 </listitem>
728 </varlistentry>
729 <varlistentry>
730 <term>
731 $G4NEUTRONHP_NEGLECT_DOPPLER
732 </term>
733 <listitem>
734 Sets neglecting doppler broadening mode for boosting performance.
735 </listitem>
736 </varlistentry>
737</variablelist>
738</para>
739
740<!-- ******* Bridgehead ******* -->
741<bridgehead renderas='sect4'>
742<literal>GDML</literal>, <literal>zlib</literal> and <literal>g3tog4</literal> modules
743</bridgehead>
744
745<para>
746<variablelist>
747 <varlistentry>
748 <term>
749 $G4LIB_BUILD_GDML
750 </term>
751 <listitem>
752 If set, triggers compilation of a plugin module <literal>gdml</literal>
753 for allowing import/export of detector description setups (geometrical
754 volumes, solids, materials, etc.). By default, the flag is not set; if
755 set, the path to the installation of XercesC package must be specified
756 through the variable <literal>$XERCESCROOT</literal>.
757 </listitem>
758 </varlistentry>
759 <varlistentry>
760 <term>
761 $G4LIB_USE_GDML
762 </term>
763 <listitem>
764 Specifies to use the <literal>gdml</literal> module. The flag is
765 automatically set if <literal>$G4LIB_BUILD_GDML</literal> is set in the environment.
766 </listitem>
767 </varlistentry>
768 <varlistentry>
769 <term>
770 $G4LIB_BUILD_ZLIB
771 </term>
772 <listitem>
773 If set, triggers compilation of a specific <literal>zlib</literal>
774 module for the compression of output files (mainly in use currently
775 for the HepRep graphics driver). By default, the flag is not set and
776 the built-in system library for compression is adopted instead. Setting
777 this flag will also implicitely set the flag below.
778 On Windows systems, if OpenGL or OpenInventor visualization drivers
779 are built, this module is automatically built.
780 </listitem>
781 </varlistentry>
782 <varlistentry>
783 <term>
784 $G4LIB_USE_ZLIB
785 </term>
786 <listitem>
787 Specifies to use the <literal>zlib</literal> module, either system
788 built-in or Geant4 specific.
789 </listitem>
790 </varlistentry>
791 <varlistentry>
792 <term>
793 $G4LIB_BUILD_G3TOG4
794 </term>
795 <listitem>
796 If set, triggers compilation of the <literal>g3tog4</literal> module for
797 conversions of simple legacy geometries descriptions to Geant4. By
798 default, the flag is not set and the module's library is not built.
799 Setting this flag will also implicitely set the flag below.
800 </listitem>
801 </varlistentry>
802 <varlistentry>
803 <term>
804 $G4LIB_USE_G3TOG4
805 </term>
806 <listitem>
807 Specifies to use the <literal>g3tog4</literal> module, assuming the related
808 library has been already installed.
809 </listitem>
810 </varlistentry>
811</variablelist>
812</para>
813
814<!-- ******* Bridgehead ******* -->
815<bridgehead renderas='sect4'>
816Analysis specific
817</bridgehead>
818
819<para>
820<variablelist>
821 <varlistentry>
822 <term>
823 $G4ANALYSIS_USE
824 </term>
825 <listitem>
826 Specifies to activate the appropriate environment for analysis, if
827 an application includes code for histogramming based on
828 <emphasis>AIDA</emphasis>. Additional setup variables are required
829 (<literal>$G4ANALYSIS_AIDA_CONFIG_CFLAGS</literal>,
830 <literal>$G4ANALYSIS_AIDA_CONFIG_LIBS</literal>) to define config options
831 for AIDA ("<literal>aida-config --cflags</literal>" and
832 "<literal>aida-config --libs</literal>"). See installation instructions
833 of the specific analysis tools for details.
834 </listitem>
835 </varlistentry>
836</variablelist>
837</para>
838
839<!-- ******* Bridgehead ******* -->
840<bridgehead renderas='sect4'>
841Directory paths to Physics Data
842</bridgehead>
843
844<para>
845<variablelist>
846 <varlistentry>
847 <term>
848 $G4NEUTRONHPDATA
849 </term>
850 <listitem>
851 Path to external data set for Neutron Scattering processes.
852 </listitem>
853 </varlistentry>
854 <varlistentry>
855 <term>
856 $G4LEDATA
857 </term>
858 <listitem>
859 Path to external data set for low energy electromagnetic
860 processes.
861 </listitem>
862 </varlistentry>
863 <varlistentry>
864 <term>
865 $G4LEVELGAMMADATA
866 </term>
867 <listitem>
868 Path to the data set for Photon Evaporation.
869 </listitem>
870 </varlistentry>
871 <varlistentry>
872 <term>
873 $G4RADIOACTIVEDATA
874 </term>
875 <listitem>
876 Path to the data set for Radiative Decay processes.
877 </listitem>
878 </varlistentry>
879 <varlistentry>
880 <term>
881 $G4ABLADATA
882 </term>
883 <listitem>
884 Path to nuclear shell effects data set for INCL/ABLA hadronic model.
885 </listitem>
886 </varlistentry>
887 <varlistentry>
888 <term>
889 $G4REALSURFACEDATA
890 </term>
891 <listitem>
892 Path to the data set for measured optical surface reflectance for
893 precise optical physics.
894 </listitem>
895 </varlistentry>
896 <varlistentry>
897 <term>
898 $G4REALSURFACEDATA
899 </term>
900 <listitem>
901 Path to the Look-Up-Tables for the LUT model of optical photon
902 boundary reflection.
903 </listitem>
904 </varlistentry>
905</variablelist>
906</para>
907
908
909</sect2>
910
911
912<!-- ******************* Section (Level#2) ****************** -->
913<sect2 id="sect.MkflEnvVar.LnkExtLib">
914<title>
915Linking External Libraries with Geant4
916</title>
917
918<para>
919The Geant4 GNUmake infrastructure allows to extend the link list of
920libraries with external (or user defined) packages which may be
921required for some user's applications to generate the final
922executable.
923</para>
924
925<!-- ******************* Section (Level#3) ****************** -->
926<sect3 id="sect.MkflEnvVar.LnkExtLib.AddExtlibNoG4">
927<title>
928Adding external libraries which do *not* use Geant4
929</title>
930
931<para>
932In the <literal>GNUmakefile</literal> of your application, before including
933<literal>binmake.gmk</literal>, specify the extra library in
934<literal>EXTRALIBS</literal> either using the <literal>-L...-l...</literal>
935syntax or by specifying the full pathname, e.g.:
936
937<informalexample>
938<programlisting>
939 EXTRALIBS := -L&lt;your-path&gt;/lib -l&lt;myExtraLib&gt;
940</programlisting>
941</informalexample>
942or
943<informalexample>
944<programlisting>
945 EXTRALIBS := &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a
946</programlisting>
947</informalexample>
948</para>
949
950<para>
951You may also specify <literal>EXTRA_LINK_DEPENDENCIES</literal>, which is
952added to the dependency of the target executable, and you may also
953specify a rule for making it, e.g.:
954
955<informalexample>
956<programlisting>
957 EXTRA_LINK_DEPENDENCIES := &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a
958
959 &lt;your-path&gt;/lib/lib&lt;myExtraLib&gt;.a:
960 cd &lt;your-path&gt;/lib; $(MAKE)
961</programlisting>
962</informalexample>
963</para>
964
965<para>
966Note that you almost certainly need to augment <literal>CPPFLAGS</literal>
967for the header files of the external library, e.g.:
968
969<informalexample>
970<programlisting>
971 CPPFLAGS+=-I&lt;your-path&gt;/include
972</programlisting>
973</informalexample>
974
975See <xref linkend="programlist_MkflEnvVar_1" />.
976</para>
977
978<para>
979<example id="programlist_MkflEnvVar_1">
980<title>
981An example of a customised GNUmakefile for an application or
982example using an external module not bound to Geant4.
983</title>
984
985<programlisting>
986 # --------------------------------------------------------------------
987 # GNUmakefile for the application "sim" depending on module "Xplotter"
988 # --------------------------------------------------------------------
989
990 name := sim
991 G4TARGET := $(name)
992 G4EXLIB := true
993
994 CPPFLAGS += -I$(HOME)/Xplotter/include
995 EXTRALIBS += -L$(HOME)/Xplotter/lib -lXplotter
996 EXTRA_LINK_DEPENDENCIES := $(HOME)/Xplotter/lib/libXplotter.a
997
998 .PHONY: all
999
1000 all: lib bin
1001
1002 include $(G4INSTALL)/config/binmake.gmk
1003
1004 $(HOME)/Xplotter/lib/libXplotter.a:
1005 cd $(HOME)/Xplotter; $(MAKE)
1006</programlisting>
1007</example>
1008</para>
1009
1010</sect3>
1011
1012
1013<!-- ******************* Section (Level#3) ****************** -->
1014<sect3 id="sect.MkflEnvVar.LnkExtLib.AddExtlibWithG4">
1015<title>
1016Adding external libraries which use Geant4
1017</title>
1018
1019<para>
1020In addition to the above, specify, in <literal>EXTRALIBSSOURCEDIRS</literal>,
1021a list of directories containing source files in its <literal>src/</literal>
1022subdirectory. Thus, your <literal>GNUmakefile</literal> might contain:
1023
1024<informalexample>
1025<programlisting>
1026 EXTRALIBS += $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a \
1027 -L&lt;your-path&gt;/lib -l&lt;myExtraLib&gt;
1028 EXTRALIBSSOURCEDIRS += &lt;your-path&gt;/&lt;myApp&gt; &lt;your-path&gt;/&lt;MyExtraModule&gt;
1029 EXTRA_LINK_DEPENDENCIES := $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a
1030
1031 MYSOURCES := $(wildcard &lt;your-path&gt;/&lt;myApp&gt;/src/*cc)
1032 $(G4WORKDIR)/tmp/$(G4SYSTEM)/&lt;myApp&gt;/lib&lt;myApp&gt;.a: $(MYSOURCES)
1033 cd &lt;your-path&gt;/&lt;myApp&gt;; $(MAKE)
1034</programlisting>
1035</informalexample>
1036</para>
1037
1038<para>
1039See <xref linkend="programlist_MkflEnvVar_2" />.
1040</para>
1041
1042<para>
1043<example id="programlist_MkflEnvVar_2">
1044<title>
1045An example of a customised GNUmakefile for an
1046application or example using external modules bound to Geant4.
1047</title>
1048
1049<programlisting>
1050# -----------------------------------------------------------------
1051# GNUmakefile for the application "phys" depending on module "reco"
1052# -----------------------------------------------------------------
1053
1054name := phys
1055G4TARGET := $(name)
1056G4EXLIB := true
1057
1058EXTRALIBS += $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a \
1059 -L$(HOME)/reco/lib -lreco
1060EXTRALIBSSOURCEDIRS += $(HOME)/phys $(HOME)/reco
1061EXTRA_LINK_DEPENDENCIES := $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a
1062
1063.PHONY: all
1064all: lib bin
1065
1066include $(G4INSTALL)/config/binmake.gmk
1067
1068MYSOURCES := $(wildcard $(HOME)/phys/src/*cc)
1069$(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a: $(MYSOURCES)
1070 cd $(HOME)/phys; $(MAKE)
1071</programlisting>
1072</example>
1073</para>
1074
1075</sect3>
1076
1077</sect2>
1078</sect1>
Note: See TracBrowser for help on using the repository browser.