source: trunk/documents/UserDoc/UsersGuides/ForApplicationDeveloper/html/GettingStarted/makeFile.html @ 1358

Last change on this file since 1358 was 1208, checked in by garnier, 15 years ago

CVS update

File size: 4.2 KB
Line 
1<HTML>
2<TITLE>
3</TITLE>
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
8<BODY>
9<TABLE WIDTH="100%"><TR>
10<TD>
11
12
13<A HREF="index.html">
14<IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents"></A>
15<A HREF="eventDef.html">
16<IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous"></A>
17<A HREF="graphicalUserInterface.html">
18<IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next"></A>
19</TD>
20<TD ALIGN="Right">
21<FONT SIZE="-1" COLOR="#238E23">
22<B>Geant4 User's Guide</B>
23<BR>
24<B>For Application Developers</B>
25<BR>
26<B>Getting Started with Geant4</B>
27</FONT>
28</TD>
29</TR></TABLE>
30<BR><BR>
31
32<P ALIGN="Center">
33<FONT SIZE="+3" COLOR="#238E23">
34<B>2.7 How to Make an Executable Program</B>
35</FONT>
36<BR><br>
37
38<HR ALIGN="Center" SIZE="7%">
39<p>
40
41<a name="2.7.1">
42<H2>2.7.1 Building ExampleN01 in a UNIX Environment</H2></a>
43
44 The code for the user examples in Geant4 is placed in the
45 directory <TT>$G4INSTALL/examples</TT>, where <TT>$G4INSTALL</TT> 
46 is the environment variable set to the place where the Geant4 distribution
47 is installed (set by default to <TT>$HOME/geant4</TT>).
48 In the following sections, a quick overview on how the GNUmake mechanism
49 works in Geant4 will be given, and we will show how to build a concrete
50 example, "ExampleN01", which is part of the Geant4 distribution.
51<P>
52
53<H4>2.7.1.1 How GNUmake works in Geant4</H4>
54
55 The GNUmake process in Geant4 is mainly controlled by the following
56 GNUmake script files<br>
57 (<TT>*.gmk</TT> scripts are placed in <TT>$G4INSTALL/config</TT>):
58<table>
59<tr>
60<td valign=top><TT>architecture.gmk</TT>
61<td>invoking and defining all the architecture specific settings and paths
62 which are stored in <TT>$G4INSTALL/config/sys<TT>.
63<tr>
64<td valign=top><TT>common.gmk</TT>
65<td>defining all general GNUmake rules for building objects and libraries
66<tr>
67<td valign=top><TT>globlib.gmk</TT>
68<td>defining all general GNUmake rules for building compound libraries
69<tr>
70<td valign=top><TT>binmake.gmk</TT>
71<td>defining the general GNUmake rules for building executables
72<tr>
73<td valign=top><tt>GNUmakefile</tt>
74<td>placed inside each directory in the Geant4 distribution and defining
75 directives specific to build a library, a set of sub-libraries, or an executable.
76</table>
77<p>
78 Kernel libraries are placed by default in <TT>$G4INSTALL/lib/$G4SYSTEM</TT>,
79 where <TT>$G4SYSTEM</TT> specifies the system architecture and compiler in
80 use. Executable binaries are placed in <TT>$G4WORKDIR/bin/$G4SYSTEM</TT>,
81 and temporary files (object-files and data products of the compilation
82 process) in <TT>$G4WORKDIR/tmp/$G4SYSTEM</TT>.
83 <TT>$G4WORKDIR</TT> (set by default to <TT>$G4INSTALL</TT>) should be
84 set by the user to specify the place his/her own workdir for Geant4 in
85 the user area.
86<P>
87 For more information on how to build Geant4 kernel libraries and set up
88 the correct environment for Geant4, refer to the "Installation Guide".
89<P>
90
91<H4>2.7.1.2 Building the executable</H4>
92
93 The compilation process to build an executable, such as an example from
94 <TT>$G4INSTALL/examples</TT>, is started by invoking the "gmake" command
95 from the (sub)directory in which you are interested.
96 To build, for instance, exampleN01 in your <TT>$G4WORKDIR</TT> area, you
97 should copy the module <TT>$G4INSTALL/examples</TT> to your
98 <TT>$G4WORKDIR</TT> and do the following actions:
99<PRE>
100  > cd $G4WORKDIR/examples/novice/N01
101  > gmake
102</PRE>
103 This will create, in <TT>$G4WORKDIR/bin/$G4SYSTEM</TT>, the "exampleN01"
104 executable, which you can invoke and run. You should actually add
105 <TT>$G4WORKDIR/bin/$G4SYSTEM</TT> to <TT>$PATH</TT> in your environment.
106<P>
107
108<HR>
109<a name="2.7.2">
110<H2>2.7.2 Building ExampleN01 in a Windows Environment</H2></a>
111
112 The procedure to build a Geant4 executable on a system based on a
113 Windows system is similar to what should be done on a
114 UNIX based system, assuming that your system is equipped with GNUmake,
115 MS-Visual C++ compiler and the required software to run Geant4 (see
116 "Installation Guide").
117<P>
118<H4>2.7.2.1 Building the executable</H4>
119
120 See paragraph 2.7.1.
121<p>
122
123<HR>
124<A HREF="../../../../Authors/html/subjectsToAuthors.html">
125<I>About the authors</I></A>
126
127</BODY>
128</HTML>
Note: See TracBrowser for help on using the repository browser.