1 |
williamc |
1.1 |
<h1>BuildFile Examples</h1>
|
2 |
|
|
<p>
|
3 |
|
|
The Default Build is configured at the project level. The default can be
|
4 |
|
|
overridden or parameters passed to the default build rules through the
|
5 |
|
|
BuildFile.
|
6 |
|
|
|
7 |
williamc |
1.4.2.1 |
|
8 |
williamc |
1.1 |
<p>
|
9 |
|
|
Examples of different build files are shown below
|
10 |
|
|
<ol>
|
11 |
|
|
<li>The Binary Executable<p>
|
12 |
|
|
The binary building rules require explicit specification of the binary targets
|
13 |
|
|
e.g.
|
14 |
|
|
<p>
|
15 |
williamc |
1.4 |
<font color=green>
|
16 |
williamc |
1.1 |
<pre>
|
17 |
williamc |
1.4.2.1 |
<Group name=G3>
|
18 |
williamc |
1.1 |
<External ref=X11>
|
19 |
williamc |
1.4.2.5 |
|
20 |
|
|
<Environment>
|
21 |
williamc |
1.4.2.1 |
<Use name=CARF>
|
22 |
williamc |
1.4 |
<Lib name=examplelib></lib>
|
23 |
williamc |
1.1 |
<bin file=example1.cpp>
|
24 |
williamc |
1.2 |
You can write between bin tags some documentation to describe what the binary
|
25 |
williamc |
1.4.2.5 |
does. As the bin tag is inside the Environment tags this environment will apply
|
26 |
|
|
in addition. (i.e example1.cpp will use CARF and the library examplelib as well
|
27 |
|
|
as X11 and G3)
|
28 |
williamc |
1.1 |
</bin>
|
29 |
williamc |
1.4.2.5 |
</Environment>
|
30 |
|
|
|
31 |
williamc |
1.1 |
<bin file=example2.cpp name=mytestexe>
|
32 |
williamc |
1.2 |
Here we call the final binary a different name from the default.
|
33 |
williamc |
1.1 |
</bin>
|
34 |
|
|
</pre>
|
35 |
williamc |
1.4 |
</font>
|
36 |
williamc |
1.1 |
This file will build two executables called (example1 and mytestexe) from files example1.cpp and example2.cpp respectively. Both are built in the context of
|
37 |
williamc |
1.4.2.5 |
external libraries defined by the group G3 and the external package X11.
|
38 |
|
|
example1 will in addition be built with CARF and examplelib<p>
|
39 |
|
|
<em><b>Note: Theres still work to be done here</b></em><br>
|
40 |
williamc |
1.2 |
<ul>
|
41 |
|
|
<li> Anything Outside of the bin tags will be included in the
|
42 |
|
|
GNUmakefile. This allows you the full functionality of gmake
|
43 |
|
|
to make up for any inadequacies. Hopefully as full scram
|
44 |
|
|
binary functionality is achieved this will be phased out
|
45 |
williamc |
1.3 |
</ul>
|
46 |
williamc |
1.1 |
<p>
|
47 |
|
|
<li>The library BuildFile
|
48 |
williamc |
1.4.2.2 |
You may wish to exclude some files from a
|
49 |
williamc |
1.1 |
build or include external package headers or assign the module to a group.
|
50 |
|
|
<br>e.g.<p>
|
51 |
williamc |
1.4 |
<font color=green>
|
52 |
williamc |
1.1 |
<pre>
|
53 |
|
|
<Group name=G3>
|
54 |
|
|
skip_files := FakeClusterizer.cc SigmaClusterizer.cc
|
55 |
|
|
</pre>
|
56 |
williamc |
1.4 |
</font>
|
57 |
williamc |
1.4.2.2 |
|
58 |
|
|
<br>
|
59 |
|
|
It is also possible to override the default type of library that is built
|
60 |
|
|
<br>e.g.<p>
|
61 |
|
|
<font color=green>
|
62 |
|
|
<pre>
|
63 |
|
|
<LibType type=shared>
|
64 |
williamc |
1.4.2.4 |
Shared libraries are dynamic!
|
65 |
|
|
</LibType>
|
66 |
williamc |
1.4.2.3 |
<LibType type=debug_shared>
|
67 |
williamc |
1.4.2.4 |
But the code still goes wrong
|
68 |
|
|
</LibType>
|
69 |
williamc |
1.4.2.2 |
</pre>
|
70 |
|
|
</font>
|
71 |
|
|
To build two shared objects - one with and one without debug information
|
72 |
williamc |
1.4.2.4 |
<br>
|
73 |
|
|
The comments you put between the beginning and end tags will be echoed to the
|
74 |
|
|
screen at build time
|
75 |
williamc |
1.4.2.2 |
<p>
|
76 |
williamc |
1.1 |
<li>Empty Group
|
77 |
|
|
Sometimes the default builds arn't wanted at all. Switch them off with
|
78 |
|
|
<p>
|
79 |
williamc |
1.4 |
<font color=green>
|
80 |
williamc |
1.1 |
<pre>
|
81 |
|
|
<AssociateGroup>
|
82 |
|
|
none
|
83 |
|
|
</AssociateGroup>
|
84 |
|
|
</pre>
|
85 |
williamc |
1.4 |
</font>
|
86 |
williamc |
1.4.2.1 |
<p>
|
87 |
|
|
<h2>Avoiding Processing Parts of BuildFiles</h2>
|
88 |
|
|
Anything between <ignore> and </ignore> tags will be excluded
|
89 |
|
|
from processing during the build. This is a convenient mechanism to cut
|
90 |
|
|
out sections of the BuildFile and is not intended for comments. Comments
|
91 |
|
|
should be provided where apppropriate e.g. in between <binb> and </bin>
|
92 |
|
|
tags.
|