Date: Tue, 7 Sep 2004 20:28:57 +0200 From: Oliver Eikemeier <eikemeier@fillmore-labs.com> To: John Polstra <jdp@polstra.com> Cc: ports@freebsd.org Subject: Re: Best way to override user's CFLAGS in a port? Message-ID: <C7CBC4CE-00FB-11D9-A5DE-00039312D914@fillmore-labs.com> In-Reply-To: <XFMail.20040907092458.jdp@polstra.com>
next in thread | previous in thread | raw e-mail | index | archive | help
John Polstra wrote: > The ezm3 port has to be built with an optimization level of -O, and > that's not likely to change any time soon. Some users, especially > users of -current where -O2 is officially supported, are getting > burned by that. What is the best way for me to change the ezm3 port's > Makefile so that -O will be used regardless of the user's environment > or /etc/make.conf settings? The Porters Handbook <http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters- handbook/dads-cflags.html> tells you to respect CFLAGS, which means you should add .if defined(CFLAGS) && !empty(CFLAGS:M-O[2-9]*) BROKEN= "Doesn't build with ${CFLAGS:M-O[2-9]*}" .endif to your port, so that a user could use a workaround in make.conf(5) when necessary. Specifying CFLAGS in make.conf(5) is problematic for ports anyways, see <http://lists.freebsd.org/pipermail/freebsd- current/2004-August/034763.html> (an example for a problematic port is net/obnc, which misses -DIPSEC). If you just want a dirty hack, you could use CFLAGS:= ${CFLAGS:N-O*} -O but this won't work with recent make(1)s when CFLAGS is specified on the command line, and might lead to other problems. I guess the first solution is preferred. -Oliver
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C7CBC4CE-00FB-11D9-A5DE-00039312D914>