12.5. Writing Something After bsd.port.mk

Do not write anything after the .include <bsd.port.mk> line. It usually can be avoided by including bsd.port.pre.mk somewhere in the middle of the Makefile and bsd.port.post.mk at the end.

Important:

Include either the bsd.port.pre.mk/bsd.port.post.mk pair or bsd.port.mk only; do not mix these two usages.

bsd.port.pre.mk only defines a few variables, which can be used in tests in the Makefile, bsd.port.post.mk defines the rest.

Here are some important variables defined in bsd.port.pre.mk (this is not the complete list, please read bsd.port.mk for the complete list).

VariableDescription
ARCHThe architecture as returned by uname -m (for example, i386)
OPSYSThe operating system type, as returned by uname -s (for example, FreeBSD)
OSRELThe release version of the operating system (for example, 2.1.5 or 2.2.7)
OSVERSIONThe numeric version of the operating system; the same as __FreeBSD_version.
LOCALBASEThe base of the local tree (for example, /usr/local)
PREFIXWhere the port installs itself (see more on PREFIX).

Note:

When MASTERDIR is needed, always define it before including bsd.port.pre.mk.

Here are some examples of things that can be added after bsd.port.pre.mk:

# no need to compile lang/perl5 if perl5 is already in system
.if ${OSVERSION} > 300003
BROKEN=	perl is in system
.endif

Always use tab instead of spaces after BROKEN=.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <[email protected]>.
Send questions about this document to <[email protected]>.