Link: Saving FreeBSD Ports Make Flags.
Ever tried to save FreeBSD port flags? You probably used /usr/local/etc/pkgtools.conf, that works most of the time. You have to always use portupgrade to install ports though, if you just go to the port dir and type make the port settings in this file are ignored.
An alternative method is to use a Makefile.local with your settings. This will work with both make and portupgrade, the downside is that your settings are imported only if the Makefile of the port you want to install has .include <bsd.port.pre.mk> in it. If it doesn’t have that you’re out of luck. No settings will take effect.
The best method I’ve found so far is to use make.conf for your port settings. Actually I use a separate file named /etc/ports.conf that is included if make detects that the current directory includes /usr/ports. So how it works:
Add this to your /etc/make.conf file:
.if ${.CURDIR:M*/usr/ports*}
.include "/etc/ports.conf"
.endif
Then for every port you want to customize a block like the following one in /etc/ports.conf:
.if ${.CURDIR:M*/www/apache*}
WITH_OPENSSL_BASE=1
APACHE_BUFFERED_LOGS=1
.endif
This will effectively add -DWITH_OPENSSL_BASE -DAPACHE_BUFFERED_LOGS when make is called under the apache port dir.