Chapter 15. Order of Variables in Port Makefiles

Table of Contents
15.1. PORTNAME Block
15.2. PATCHFILES Block
15.3. MAINTAINER Block
15.4. LICENSE Block
15.6. The Dependencies Block
15.7. Flavors
15.8. USES and USE_x
15.9. Standard Variables
15.10. Options and Helpers
15.11. The Rest of the Variables
15.12. The Targets

The first sections of the Makefile must always come in the same order. This standard makes it so everyone can easily read any port without having to search for variables in a random order.

The first line of a Makefile is always a comment containing the Subversion version control ID, followed by an empty line. In new ports, it looks like this:

# $FreeBSD$

In existing ports, Subversion has expanded it to look like this:

# $FreeBSD: head/ports-mgmt/pkg/Makefile 437007 2017-03-26 21:25:47Z bapt $


The sections and variables described here are mandatory in a ordinary port. In a slave port, many sections and variables can be skipped.


Each following block must be separated from the previous block by a single blank line.

In the following blocks, only set the variables that are required by the port. Define these variables in the order they are shown here.

15.1. PORTNAME Block

This block is the most important. It defines the port name, version, distribution file location, and category. The variables must be in this order:

[1] Important:

Only one of PORTVERSION and DISTVERSION can be used.

All FreeBSD documents are available for download at

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