12.9. Respect Both `CC` and `CXX`
Prev | Chapter 12. Dos and Don'ts | Next

## 12.9. Respect Both `CC` and `CXX`

The port must respect both `CC` and `CXX` variables. What we mean by this is that the port must not set the values of these variables absolutely, overriding existing values; instead, it may append whatever values it needs to the existing values. This is so that build options that affect all ports can be set globally.

If the port does not respect these variables, please add `NO_PACKAGE=ignores either cc or cxx` to the `Makefile`.

An example of a `Makefile` respecting both `CC` and `CXX` variables follows. Note the `?=`:

CC?= gcc
CXX?= g++

Here is an example which respects neither `CC` nor `CXX` variables:

CC= gcc
CXX= g++

Both `CC` and `CXX` variables can be defined on FreeBSD systems in `/etc/make.conf`. The first example defines a value if it was not previously set in `/etc/make.conf`, preserving any system-wide definitions. The second example clobbers anything previously defined.

Prev | Up | Next
12.8. Do Things Rationally | Home | 12.10. Respect `CFLAGS`

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