Chapter 14. Order of Variables in Port Makefiles

Table of Contents
14.1. PORTNAME Block
14.2. PATCHFILES Block
14.3. MAINTAINER Block
14.4. LICENSE Block
14.6. The Dependencies Block
14.7. USES and USE_x
14.8. Standard Variables
14.9. Options and Helpers
14.10. The Rest of the Variables
14.11. 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 variables and 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.

14.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:


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 <>.