Chapter 5. Building targets

Table of Contents

5.1. The bt_logic module
5.2. Examples

A target defines how to do a specific task with source or object files, like compiling them, installing binaries, etc. A package has several standard targets associated to it, which are described below:

all

Builds the source package. This includes libraries, binary programs or whatever else that can be "built" in some way.

clean

Cleans the source package in a soft way. This means that the package can be rebuilt without the need of reconfiguring it.

cleandir

Cleans the source package in a hard way. This leaves the package as it was when the distribution file was unpacked. Implies a regular soft clean.

deinstall

Deinstalls a previous installation of the software package.

install

Installs all result files coming from a build.

test

Runs several checks against a built package. These are specific to it, so they may not be available if the developer did not provide them. Must be run after a successful build.

Targets can only be built if they are defined either by Generic.bt or by a Logic.bt file. Furthermore, the package must be configured; see Chapter 4, Automatic package configuration.

In Buildtool, the process of building a target is done by the bt_logic module. See next section.

5.1. The bt_logic module

buildtool build | clean | cleandir | deinstall | install | test [[-d dir] | [--destdir=dir]] [[-f file] | [--file=file]] [[-h] | [--help]] [--ignore-sw-config] [[-l logfile] | [--logfile=logfile]] [[-s stage] | [--stage=stage]] [[-w dir] | [--workdir=dir]] [target...]

The bt_logic module applies a stage to a target. A target is a single entity within the source tree that is given a name and is associated a set of stages. A stage is the specific status of a target at a specific time. For example, a target can be cleaned, built, installed, etc.

The following options are recognized:

-d dir | --destdir=dir

Specify a fake root directory during installation, so that all files are placed inside it (with their respective paths). This feature is generally needed by package systems to issue staged installations.

-f file | --file=file

Instead of parsing Generic.bt or Logic.bt, parse file.

-h | --help

Show an usage messages.

--ignore-sw-config

Do not load the system wide configuration file before configuring the package. See Chapter 6, System wide configuration.

-l file | --logfile=file

Enable the creation of a log file, which will be named file.

-s name | --stage=name

Apply the name stage to all given targets. This option is almost useless when using Buildtool's wrapper (but you may use it to override the implicit stage; discouraged).

-w dir | --workdir=dir

Use the specified directory to put work files in it, like objects, dependency tracking, executables, etc. Must match the value given to bt_config during configuration time.

5.2. Examples

This section shows several examples on how to build targets inside a source package. Remember that the package must be configured before any target can be built.

To build a source package and generate binary (or target) files, simply issue:

$ buildtool build

To install the package after it has been built:

$ buildtool install

To do a soft clean:

$ buildtool clean

To do a complete clean:

$ buildtool cleandir