Date: Fri, 20 Aug 2004 06:51:23 -0400 From: Garance A Drosihn <drosih@rpi.edu> To: Oliver Eikemeier <eikemeier@fillmore-labs.com>, current@freebsd.org Subject: Re: setting CFLAGS in /etc/make.conf Message-ID: <p06110400bd4b837282da@[128.113.24.47]> In-Reply-To: <377474F4-F285-11D8-A951-00039312D914@fillmore-labs.com> References: <377474F4-F285-11D8-A951-00039312D914@fillmore-labs.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06110400bd4b837282da>