Re: Properly controlling CFLAGS/CXXFLAGS



Oliver Fromme wrote:
Garrett Cooper wrote:
> I was wondering (looking at the make.conf manpage), what's the
> best way to control one's CFLAGS/CXXFLAGS. I'd prefer if only a few
> ports would have optimized compiler flags, while the rest of the system
> used a safe set of compiler flags.

The simplest way is to use conditionals in /etc/make.conf
depending on the ports directory:

.if ${.CURDIR:M*/somecategory/someport}
CFLAGS= -O3 -pipe
CFLAGS+= -DSOMETHING
.endif

> CFLAGS= -O2 -pipe

Using -O2 without -fno-strict-aliasing will break certain
programs. The default is -O2 -fno-strict-aliasing -pipe
and it is _not_ recommended to override it globally, or
otherwise you're guaranteed to shoot yourself in the foot,
sooner or later.

> COPTFLAGS= ${CFLAGS} -msse -msse2 -mfpmath=sse,387

That will break kernel compiles. Again, you should not
override COPTFLAGS, unless you know exactly what you're
doing.

Best regards
Oliver

Interesting. No wonder I didn't have it in my Gentoo /etc/make.conf. It appears (from what I see) that maybe -fno-strict-aliasing has been enabled by default (at least it doesn't show up in the GCC 4.1.1 manpage on FC5).
-Garrett
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Properly controlling CFLAGS/CXXFLAGS
    ... Based on my experience though with FreeBSD, this is an improper ... ports would have optimized compiler flags, while the rest of the system ...
    (freebsd-hackers)
  • Re: Properly controlling CFLAGS/CXXFLAGS
    ... ports would have optimized compiler flags, while the rest of the system ... override COPTFLAGS, unless you know exactly what you're ... Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing ...
    (freebsd-hackers)
  • Re: Properly controlling CFLAGS/CXXFLAGS
    ... Coming from Gentoo we were taught how to 'rice' our machines. ... ports would have optimized compiler flags, while the rest of the system ... My suggestion is to leave all mention of *CFLAGS out of /etc/make.conf to ... global and per-port settings that are only used when compiling things ...
    (freebsd-hackers)
  • Re: Inserting variables into a Makefile using Autotools.
    ... I am using autotools for a project that ... CFLAGS set to include '-g -O2', ... We have quite a few compiler flags that need to be set ... It would be nice to add on new flags. ...
    (comp.os.linux.development.apps)
  • Re: Inserting variables into a Makefile using Autotools.
    ... I am using autotools for a project that ... CFLAGS set to include '-g -O2', ... We have quite a few compiler flags that need to be set ... It would be nice to add on new flags. ...
    (comp.os.linux.development.apps)