source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/GettingStarted/makeFile.xml@ 1213

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

CVS update

File size: 5.2 KB
Line 
1<!-- ******************************************************** -->
2<!-- -->
3<!-- [History] -->
4<!-- Changed by: Katsuya Amako, 16-Nov-1998 -->
5<!-- Changed by: Dennis Wright, 28-Nov-2001 -->
6<!-- Proof read by: Joe Chuma, 16-Jun-1999 -->
7<!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
8<!-- -->
9<!-- ******************************************************** -->
10
11
12<!-- ******************* Section (Level#1) ****************** -->
13<sect1 id="sect.HowToMakeExec">
14<title>
15How to Make an Executable Program
16</title>
17
18<!-- ******************* Section (Level#2) ****************** -->
19<sect2 id="sect.HowToMakeExec.UNIX">
20<title>
21Building ExampleN01 in a UNIX Environment
22</title>
23
24<para>
25The code for the user examples in Geant4 is placed in the directory
26<literal>$G4INSTALL/examples</literal>, where <literal>$G4INSTALL</literal> is the
27environment variable set to the place where the Geant4 distribution
28is installed (set by default to <literal>$HOME/geant4</literal>). In the
29following sections, a quick overview on how the GNUmake mechanism
30works in Geant4 will be given, and we will show how to build a
31concrete example, "ExampleN01", which is part of the Geant4
32distribution.
33</para>
34
35<!-- ******************* Section (Level#3) ****************** -->
36<sect3 id="sect.HowToMakeExec.UNIX.HowGNUmakeWorks">
37<title>
38How GNUmake works in Geant4
39</title>
40
41<para>
42The GNUmake process in Geant4 is mainly controlled by the following
43GNUmake script files (<literal>*.gmk</literal> scripts are placed in
44<literal>$G4INSTALL/config</literal>):
45
46<variablelist>
47 <varlistentry>
48 <term><literal>architecture.gmk</literal></term>
49 <listitem>
50 invoking and defining all the architecture specific settings
51 and paths which are stored in <literal>$G4INSTALL/config/sys</literal>.
52 </listitem>
53 </varlistentry>
54 <varlistentry>
55 <term><literal>common.gmk</literal></term>
56 <listitem>
57 defining all general GNUmake rules for building objects and libraries
58 </listitem>
59 </varlistentry>
60 <varlistentry>
61 <term><literal>globlib.gmk</literal></term>
62 <listitem>
63 defining all general GNUmake rules for building compound libraries
64 </listitem>
65 </varlistentry>
66 <varlistentry>
67 <term><literal>binmake.gmk</literal></term>
68 <listitem>
69 defining the general GNUmake rules for building executables
70 </listitem>
71 </varlistentry>
72 <varlistentry>
73 <term><literal>GNUmakefile</literal></term>
74 <listitem>
75 placed inside each directory in the Geant4 distribution and defining
76 directives specific to build a library, a set of sub-libraries, or
77 an executable.
78 </listitem>
79 </varlistentry>
80</variablelist>
81</para>
82
83<para>
84Kernel libraries are placed by default in
85<literal>$G4INSTALL/lib/$G4SYSTEM</literal>, where <literal>$G4SYSTEM</literal>
86specifies the system architecture and compiler in use. Executable
87binaries are placed in <literal>$G4WORKDIR/bin/$G4SYSTEM</literal>, and
88temporary files (object-files and data products of the compilation
89process) in <literal>$G4WORKDIR/tmp/$G4SYSTEM</literal>. <literal>$G4WORKDIR</literal>
90(set by default to <literal>$G4INSTALL</literal>) should be set by the user
91to specify the place his/her own workdir for Geant4 in the user
92area.
93</para>
94
95<para>
96For more information on how to build Geant4 kernel libraries and
97set up the correct environment for Geant4, refer to the
98"Installation Guide".
99</para>
100
101</sect3>
102
103<!-- ******************* Section (Level#3) ****************** -->
104<sect3 id="sect.HowToMakeExec.UNIX.BuildExec">
105<title>
106Building the executable</title>
107
108<para>
109The compilation process to build an executable, such as an example
110from <literal>$G4INSTALL/examples</literal>, is started by invoking the
111"make" command from the (sub)directory in which you are
112interested. To build, for instance, exampleN01 in your
113<literal>$G4WORKDIR</literal> area, you should copy the module
114<literal>$G4INSTALL/examples</literal> to your <literal>$G4WORKDIR</literal>
115and do the following actions:
116
117<informalexample>
118<programlisting>
119 &gt; cd $G4WORKDIR/examples/novice/N01
120 &gt; gmake
121</programlisting>
122</informalexample>
123</para>
124
125<para>
126This will create, in <literal>$G4WORKDIR/bin/$G4SYSTEM</literal>, the
127"exampleN01" executable, which you can invoke and run. You should
128actually add <literal>$G4WORKDIR/bin/$G4SYSTEM</literal> to
129<literal>$PATH</literal> in your environment.
130</para>
131
132</sect3>
133</sect2>
134
135
136<!-- ******************* Section (Level#2) ****************** -->
137<sect2 id="sect.HowToMakeExec.Windows">
138<title>
139Building ExampleN01 in a Windows Environment
140</title>
141
142<para>
143The procedure to build a Geant4 executable on a system based on a
144Windows system is similar to what should be done on a UNIX based
145system, assuming that your system is equipped with GNUmake,
146MS-Visual C++ compiler and the required software to run Geant4 (see
147"Installation Guide").
148</para>
149
150
151<!-- ******************* Section (Level#3) ****************** -->
152<sect3 id="sect.HowToMakeExec.Windows.BuildExec">
153<title>
154Building the executable
155</title>
156
157<para>
158See paragraph <xref linkend="sect.HowToMakeExec.UNIX" />.
159</para>
160
161
162
163</sect3>
164</sect2>
165</sect1>
Note: See TracBrowser for help on using the repository browser.