12.15. Avoid Use of the .error Construct

The correct way for a Makefile to signal that the port cannot 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, “Running make describe). 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

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

.error "option is not supported"
IGNORE=option is not supported

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 <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.