The code for the user examples in Geant4 is placed in the directory
$G4INSTALL is the
environment variable set to the place where the Geant4 distribution
is installed (set by default to
$HOME/geant4). In the
following sections, a quick overview on how the GNUmake mechanism
works in Geant4 will be given, and we will show how to build a
concrete example, "ExampleN01", which is part of the Geant4
The GNUmake process in Geant4 is mainly controlled by the following
GNUmake script files (
*.gmk scripts are placed in
Kernel libraries are placed by default in
specifies the system architecture and compiler in use. Executable
binaries are placed in
temporary files (object-files and data products of the compilation
(set by default to
$G4INSTALL) should be set by the user
to specify the place his/her own workdir for Geant4 in the user
For more information on how to build Geant4 kernel libraries and set up the correct environment for Geant4, refer to the "Installation Guide".
The compilation process to build an executable, such as an example
$G4INSTALL/examples, is started by invoking the
"gmake" command from the (sub)directory in which you are
interested. To build, for instance, exampleN01 in your
$G4WORKDIR area, you should copy the module
$G4INSTALL/examples to your
and do the following actions:
> cd $G4WORKDIR/examples/novice/N01 > gmake
This will create, in
"exampleN01" executable, which you can invoke and run. You should
$PATH in your environment.
The procedure to build a Geant4 executable on a system based on a Windows system is similar to what should be done on a UNIX based system, assuming that your system is equipped with GNUmake, MS-Visual C++ compiler and the required software to run Geant4 (see "Installation Guide").
See paragraph Section 2.7.1.