rpm-macrofile(5) — Linux manual page

NAME | SYNOPSIS | DESCRIPTION | EXAMPLES | SEE ALSO | COLOPHON

RPM-MACROFILE(5)           File Formats Manual           RPM-MACROFILE(5)

NAME         top

       rpm-macrofile - rpm macro file format

SYNOPSIS         top

       %NAME[([OPTS]) BODY

DESCRIPTION         top

       Rpm macro files are used to define rpm-macros(7) in the global
       macro context. The two primary uses of macros are assisting
       packaging work, and configuring rpm behavior. A pre-determined set
       of macro files is read upon rpm library initialization as
       described in rpm-config(5) but they can also be loaded via the
       %load macro separately.

       The format of a macro file is: the macro NAME prefixed with %,
       followed by whitespace and then the macro body, each new
       definition separated with a newline. The syntax is exactly the
       same as when using %define. See rpm-macros(7) for details on the
       macro syntax.

       A trailing \ indicates line continuation, but can be omitted
       inside macro bodies wrapped in a %{macro:...} block.

       Lines starting with # or consisting solely of whitespace are
       ignored.

       Reading a macro file is always fully declarative: no macros are
       ever expanded when reading a macro file.

EXAMPLES         top

   Example 1. Simple macro
           %mytool   /usr/bin/mytool-with-annoying-name

   Example 2. Multiline macro with a preceding comment
           # Trailing %{nil} is handy for ensuring a newline at the end
           %mycmd %{mytool} \
               --one \
               --with \
               --too \
               --many arguments \
           %{nil}

   Example 3. Multiline parametric Lua macro:
           %myhelper() %{lua:
               function dostuff(arg)
                   return 'do stuff to '..arg
               end
               print(dostuff(arg[1]))
           }

SEE ALSO         top

       rpm-config(5) rpmbuild-config(5) rpm-macros(7)

COLOPHON         top

       This page is part of the rpm (RPM Package Manager) project.
       Information about the project can be found at 
       ⟨https://github.com/rpm-software-management/rpm⟩.  It is not known
       how to report bugs for this man page; if you know, please send a
       mail to [email protected].  This page was obtained from the
       project's upstream Git repository
       ⟨https://github.com/rpm-software-management/rpm.git⟩ on
       2026-01-16.  (At that time, the date of the most recent commit
       that was found in the repository was 2026-01-15.)  If you discover
       any rendering problems in this HTML version of the page, or you
       believe there is a better or more up-to-date source for the page,
       or you have corrections or improvements to the information in this
       COLOPHON (which is not part of the original manual page), send a
       mail to [email protected]

RPM 6.0.90                      2026-01-16               RPM-MACROFILE(5)

Pages that refer to this page: rpmbuild-config(5)rpm-config(5)rpm-dependency-generators(7)rpm-macros(7)rpm-common(8)