12.16. Avoid Use of the `.error` Construct
Prev | Chapter 12. Dos and Don'ts | Next

## 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, “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`

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

Prev | Up | Next
12.15. Marking a Port for Removal with `DEPRECATED` or `EXPIRATION_DATE` | Home | 12.17. Usage of `sysctl`

This, and other documents, can be downloaded from http://ftp.FreeBSD.org/pub/FreeBSD/doc/

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.