Table of Contents
The GNU Make backend is used to build
items that contain an Abuild.mk
file. In
this chapter, we describe how to set up your
Abuild.mk
file and provide details specific
to the rule sets provided by the abuild GNU
Make backend.
The Abuild.mk
file is read by GNU Make and is
a GNU Make fragment. It therefore has GNU Make syntax. The
Abuild.mk
file is intended to contain only
variable settings. It contains no make rules or include
directives. Abuild automatically includes your
Abuild.mk
file at the appropriate time and in
the appropriate context.
The most important line in Abuild.mk
is the
setting of the RULES
variable. Its purpose is
to tell abuild which rule set should be used to generate
targets from sources. Most of the remaining variables that are
set are dependent upon which rules are being used. It is always
possible to use abuild's help system to get detailed
rule-specific help about what variables you are expected to
define in your Abuild.mk
for a specific set
of rules. Run abuild --help help for
additional information. Abuild provides some built-in rules.
Additional rules may provided my plugins or items that you depend
on. You can always run abuild --help rules
list to get a list of rules that are available to your
build item.
In rare instances, it may be necessary to create local rules for
a specific build item. Examples may include one-off,
special-purpose code generators that are specific to a particular
build item. To use local rules, place a list of files that
contain definitions of your rules in the
LOCAL_RULES
variable. Files listed there are
resolved relative to the Abuild.mk
. They
may contain any valid GNU Make code.
If you have written the same local rule in more than one or two
places, you are probably doing something wrong and should be
using build-item-specific rules (Chapter 22, Build Item Rules and Automatically Generated Code ) or plugins (Chapter 29, Enhancing Abuild with Plugins) instead.
Please note that local rules are run from the context of the
output directory—you must keep this in mind when using
relative paths from your local rules. The make variable
SRCDIR
is always set to a relative path to the
directory that contains the Abuild.mk
file.
Also, local rules should avoid creating files outside of the
output directory since these files will not be removed by the
clean target.