12.16 Avoid Use of the .error Construct

The correct way for a Makefile to signal that the port can not be installed due to some external factor (for instance, the user has specified an illegal combination of build options) is to set a non-blank value to IGNORE. This value will be formatted and shown to the user by make install.

It is a common mistake to use .error for this purpose. The problem with this is that many automated tools that work with the ports tree will fail in this situation. The most common occurrence of this is seen when trying to build /usr/ports/INDEX (see Section 9.1). However, even more trivial commands such as make maintainer also fail in this scenario. This is not acceptable.

Example 12-1. How to Avoid Using .error

Assume that someone has the line

USE_POINTYHAT=yes

in make.conf. The first of the next two Makefile snippets will cause make index to fail, while the second one will not:

.if USE_POINTYHAT
.error "POINTYHAT is not supported"
.endif
.if USE_POINTYHAT
IGNORE=	POINTYHAT is not supported
.endif
For questions about the FreeBSD ports system, e-mail <ports@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.