From owner-freebsd-current@FreeBSD.ORG Fri Aug 20 10:52:52 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3009116A4CE for ; Fri, 20 Aug 2004 10:52:52 +0000 (GMT) Received: from smtp4.server.rpi.edu (smtp4.server.rpi.edu [128.113.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id CEB9243D53 for ; Fri, 20 Aug 2004 10:52:51 +0000 (GMT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp4.server.rpi.edu (8.13.0/8.13.0) with ESMTP id i7KApOWo031632; Fri, 20 Aug 2004 06:51:24 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <377474F4-F285-11D8-A951-00039312D914@fillmore-labs.com> References: <377474F4-F285-11D8-A951-00039312D914@fillmore-labs.com> Date: Fri, 20 Aug 2004 06:51:23 -0400 To: Oliver Eikemeier , current@freebsd.org From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: CanIt (www . canit . ca) Subject: Re: setting CFLAGS in /etc/make.conf X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2004 10:52:52 -0000 At 10:44 AM +0200 8/20/04, Oliver Eikemeier wrote: > >Basically, when a port tries to pass CFLAGS to the distribution >Makefile, this is done by > env CFLAGS="${CFLAGS}" make >which is effectively overwritten by users setting CFLAGS in >make.conf(5). OTOH when += is used, it inherits the previous >values, so when someone would do >CFLAGS+= -O -pipe >in make.conf(5) the effective value passed is >"-O -pipe -O -pipe ${_CPUCFLAGS}", >which is not harmful, but not good either. This is especially >problematic when the port uses CFLAGS="${PTHREAD_CFLAGS}" or >CFLAGS="-DMY_OPTION", and a lot of ports use CFLAGS. This is >no problem when the port has USE_GMAKE, since gmake doesn't >read make.conf(5). Back in March I was working on an updated version of the net/cap port, and I noticed this problem with CFLAGS in /etc/make.conf vs CFLAGS in the makefile of a port. (So I am pretty sure this issue has nothing to do with the recent changes to `make'.) What I ended up doing was changing the net/cap/Makefile to set CAP_CFLAGS instead of CFLAGS. The distributed net/cap source has a bunch of Makefile.m4 files which are used to generate the real makefiles, and those Makefile.m4 files were already adding a bunch of values to CFLAGS. So, I changed a line (in net/cap/Makefile) from: ${FIND} ${WRKSRC} -name Makefile.m4 \ -exec ${REINPLACE_CMD} \ -e 's/CFLAGS=/CFLAGS+=/' \{\} \; to: ${FIND} ${WRKSRC} -name Makefile.m4 \ -exec ${REINPLACE_CMD} \ -e "s/CFLAGS=/CFLAGS+=${CAP_CFLAGS} /" \{\} \; I meant to follow up on this issue on the freebsd-ports mailing list, but I guess I never got around to mentioning it. As near as I could tell, it is just a bad idea for a ports-makefile to depend on setting CFLAGS. The fix I went with for net/cap probably will not make sense for many other ports, but it was the easy fix based on what net/cap/Makefile was already doing. [note that I have not sent in that updated CAP port. What I have seems to work fine on FreeBSD-5.x on i386, but I wanted to see if I could get it working on sparc64, and to also include some bug fixes that I have made to cap at RPI] -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu