Manual Reference Pages - STYLE.MAKEFILE (5)
file style guide
This file specifies the preferred style for makefiles in the
- All makefiles should have an SCM ID at the start of the file,
followed by a blank line.
comes next if needed, and is spelled
with a single
space after a colon.
Do not use the
- Special variables (i.e.,
LIB, SRCS, MLINKS,
etc.) are listed in order of
then building and installing a binary.
Special variables may also be listed in
order: i.e., ones for the primary program (or library) first.
PROG /[SHLIB / SCRIPTS]
PROG /[SHLIB / SCRIPTS]
and there is a single source file named the same as the
and the manual page is named the same as the
and is in section 1.
- All variable assignments are spelled
i.e., no space between the variable name and the
Keep values sorted alphabetically, if possible.
- Variables are expanded with
- Do not use
to set variables that are only set once
(or to set variables for the first time).
- Do not use vertical whitespace in simple makefiles,
but do use it to group locally related things in more complex/longer ones.
as it is basically a
It comes before
rather than after
so it does not get lost in a sea of
is an important thing.
The usage of
so that it may be overridden on the command line or in
should not be used,
it defeats the purpose of
It should only be used on the command line and in special circumstances.
is preferred for alphabetical ordering and to make
easier to see.
often affect conditional compilation,
tend to be quite long.
settings between the
- Do not use GCCisms (such as
- Typically, there is one
and the value in order to start the value in column 9.
space is allowed for variable names that extend beyond column 9.
A lack of whitespace is also allowed for very long variable names.
.include In bsd.*.mk
- Do not use anachronisms like
- To not build the
part of the base system,
- To optionally build something in the base system,
spell the knob
The latter are reserved for the
- For variables that are only checked with
do not provide any fake value.
The desire to express a logical grouping often means not obeying some of the
The simplest program
The simplest library
This manual page is inspired from the same source as
manual page in
There are few hard and fast style rules here.
The style of many things is too dependent on the context of the whole makefile,
or the lines surrounding it.
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.