From owner-freebsd-ports@FreeBSD.ORG Tue Sep 7 18:29:02 2004 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6E86A16A4CE for ; Tue, 7 Sep 2004 18:29:02 +0000 (GMT) Received: from fillmore.dyndns.org (port-212-202-49-127.dynamic.qsc.de [212.202.49.127]) by mx1.FreeBSD.org (Postfix) with ESMTP id E699E43D39 for ; Tue, 7 Sep 2004 18:29:01 +0000 (GMT) (envelope-from eikemeier@fillmore-labs.com) Received: from dhcp-11.local ([172.16.0.11] helo=dhcp-7.local) by fillmore.dyndns.org with esmtps (TLSv1:DES-CBC3-SHA:168) (Exim 4.42 (FreeBSD)) id 1C4kiA-000PaE-LO; Tue, 07 Sep 2004 20:29:01 +0200 Date: Tue, 7 Sep 2004 20:28:57 +0200 Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v482) To: John Polstra From: Oliver Eikemeier In-Reply-To: Message-Id: Content-Transfer-Encoding: 7bit User-Agent: KMail/1.5.9 cc: ports@freebsd.org Subject: Re: Best way to override user's CFLAGS in a port? X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2004 18:29:02 -0000 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 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 (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