<page xmlns="http://projectmallard.org/1.0/" type="guide" id="programs">
<info>
    <link type="guide" xref="index#recipes"/>
</info>

<title>Programs</title>

<p>
A <em>program</em> is executable code that can be run by a user.
</p>
<p>
To specify a program you need to set <code>programs.<em>id</em>.*</code> <link xref="variables">variables</link> where <em>id</em> is a unique ID for the program.
The following variables are allowed:
</p>
<table frame="all" shade="rows">
<thead>
<tr>
  <td><p>Name</p></td>
  <td><p>Description</p></td>
</tr>
</thead>
<tr>
  <td><p>name</p></td>
  <td><p>The name of this program (optional, defaults to the ID)</p></td>
</tr>
<tr>
  <td><p>compiler</p></td>
  <td><p>Compiler to compile with (optional, defaults to automatic detection)</p></td>
</tr>
<tr>
  <td><p>sources</p></td>
  <td><p>The files that make up this program</p></td>
</tr>
<tr>
  <td><p>install</p></td>
  <td><p>If this program should be installed into the system (defaults to true)</p></td>
</tr>
<tr>
  <td><p>install-directory</p></td>
  <td><p>Directory to install the program to (defaults to system directory)</p></td>
</tr>
<tr>
  <td><p>gettext-domain</p></td>
  <td><p>Translation domain to use for translatable strings</p></td>
</tr>
</table>
<note>
<p>
The ID must be a valid variable name and cannot contain period characters.
If you require period characters set the <em>name</em> variable.
</p>
</note>
<p>
Bake will attempt to <link xref="building">build</link> your program by checking the filenames in the <code>sources</code> variable and generating the required <link xref="rules">rules</link>.
Depending on what <link xref="index#programs-and-libraries">language</link> your program uses additional variables may be allowed.
</p>
<example>
<p>
The following describes a simple <link xref="c">C program</link> that is built from one C file:
</p>
<code>
programs.example-program {
  sources = example-program.c
}
</code>
<p>
When building Bake will compile example-program.c and produce the program <em>example-program</em>.
When <link xref="installing">installing</link> Bake will install <em>example-program</em> into the appropriate directory.
</p>
</example>
<note>
<p>
Programs can contain <link xref="tests">tests</link>.
</p>
</note>
</page>
