need help on CFLAGS in /etc/make.conf please

Kris Kennaway kris at obsecurity.org
Thu Feb 12 20:09:33 PST 2004


On Thu, Feb 12, 2004 at 09:56:08PM -0600, Paul Seniura wrote:
> 
> Hi Kris,
> 
> > On Thu, Feb 12, 2004 at 06:17:03PM -0600, Paul Seniura wrote:
> > > 
> > > Hi y'all,
> > > 
> > > I'm trying to find a way to do a CFLAGS+='-O' if and only if such a
> > > parm was not already provided before 'make' actually runs.
> > > 
> > > I had this coded with the single = sign, i.e. without ?= or +=, but
> > > the process still acts as if += was coded anyway, thus tacking on
> > > my -O *after* the port's own CFLAGS.
> > > 
> > > GCC33 docs say the _last_ -O# is the one that will be used.
> > > 
> > > I've seen other discussion on using -O2 but the point seems to be the
> > > ports that set -O2 explicitly are likely to work correctly.
> 
> On Thu 12 Feb 2004 17:13:25 -0800, Kris Kennaway replied:
> > That's not a good assumption; many ports simply add -O2 (or -O3, or
> > -O999) because the authors "want their code to run fast".  The set of
> > ports for which the authors have run full regression suites for all
> > supported versions of gcc and all supported OS and architecture
> > combinations is probably the null set.
> 
> Thank you for responding, but I'm *really* not wanting this to
> become another discussion on "how high my Oh-levels should be". ;)
> 
> My question for this discussion is specifically how to prevent
> overriding a port's own setting for that parm, and to provide a
> default setting -O[1] when the port does not set it at all?
> 
> (I'll save my l-o-n-g-e-r reply for later... believe me I have reasons ;)

There's no general way.  Some ports do ${CFLAGS} -O999, some do -O999
${CFLAGS}.  The ports collection policy is that any port that
specifies its own optimization flags by default and uses them in
preference to ${CFLAGS} is a bug and must be fixed.

Kris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040212/b86e8486/attachment.bin


More information about the freebsd-questions mailing list