Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 2004 14:08:33 +0200
From:      Oliver Eikemeier <eikemeier@fillmore-labs.com>
To:        Garance A Drosihn <drosih@rpi.edu>
Cc:        current@freebsd.org
Subject:   Re: setting CFLAGS in /etc/make.conf
Message-ID:  <A8718F96-F2A1-11D8-A951-00039312D914@fillmore-labs.com>
In-Reply-To: <p06110400bd4b837282da@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
Garance A Drosihn wrote:

> 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'.)

Sure. I even tested it with make(1) from 4.7. This has been there for 
ages.

> 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} /" \{\} \;

Jup, but this is hard to generalize.

> 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.

Many do, but most just hardcode the CFLAGS value they see in the 
configuration step in the (generated) ports Makefile.

I run into this recently with mail/exim. Of course it was possible to 
work around this too, but it happened only when certain configuration 
options where given *and* CFLAGS was set in /etc/make.conf. There must 
be a better way to deal with this.

-Oliver



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A8718F96-F2A1-11D8-A951-00039312D914>