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

Paul Seniura pdseniura at
Thu Feb 12 16:16:50 PST 2004

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.

And so, in many ports esp. KDE, it will add my -O *after* the port's
own -O2, and KDE et al will not be compiled with the intended
settings, which may be causing some of its slowness.

Since TPTB here could only find a spare slow@$$ Pentium2 for this
project, I'm trying to optimize other ports with at least -O in an
automatic fashion.  That leaves out /etc/pkgtools.conf due to the
sheer manual labor it would take to code this up for each port.

The idea of having a test in /etc/make.conf struck me as the way to
go, since it is effectively 'sourced'-in and could contain some simple
shell logic operations.

I hope I'm explaining this correctly.  ;)

I'd love to hear feedback on this.
I'll continue working on it tomorrow.

Thank you,

  --  Paul Seniura
      System Specialist
      State of Okla. D.O.T.

More information about the freebsd-questions mailing list