Next Previous Contents

4. Macros

This is the contents of /usr/doc/rpm*/macros only nicely formatted. Macros in RPM are used in the spec file for building RPMs only (ie this is not an end user item).

RPM 2.3.9 introduces simple spec file macros. The macros can do straight text substitution only. Macros can be used anywhere in a spec file, and in ``included file lists'' (those read in using %files -f <file>).

4.1 Defining a Macro

To define a macro use:

%define <name> <expansion>

All whitespace surrounding <expansion> is removed. Name may be composed of alphanumeric characters, and the character `_' (the underscore). Macro expansion is performed on <expansion> so that <expansion> my reference other macros that have already been defined.

4.2 Using a Macro

To use a macro, write:

%<name>

or

%{<name>}

The latter allows you to place the expansion adjacent to other text.

4.3 Predefined Macros

The following macros are defined as the values they reference are specified in the spec file:


Next Previous Contents