Subject: Re: mk.conf & compiler flags
To: Dunric <dunric@centrum.cz>
From: Juan RP <juan@xtraeme.nopcode.org>
List: netbsd-users
Date: 02/03/2005 04:31:28
--Signature=_Thu__3_Feb_2005_04_31_28_+0100_JlWaguVt73xYhhOz
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

On Thu, 03 Feb 2005 03:18:27 +0100
"Dunric" <dunric@centrum.cz> wrote:

> It had to be zillion-times asked but no reliable information in NetBSD guide
> even in mailing lists found :(
> Are there some rules how C/C++ compiler flags has to be properly set in
> /etc/mk.conf ?

Yes, for kernel/userland use COPTS/CPUFLAGS, for pkgsrc use CFLAGS.

Don't forget to append the options to the vars, e.g:
COPTS+=blah or CFLAGS+= blah...

> NetBSD's kernel + userland are using COPTS, both CFLAGS and CXXFLAGS applies
> too. NetBSD's X11 on the other hand ignores COPTS completely - a bit
> confusing.
> Pkgsrc ports are ignoring COPTS too, again CFLAGS & CXXFLAGS are used. There
> is another problem, because some ports define in CFLAGS some important
> options(defines,paths) without them compilation fails so I cann't replace it
> with my own :( When I add my options(+=), some builds are compiled in some
> cases with wild collision flags like "-mcpu=i386" ...
> I just wish to rebuild whole system including packages with "-O2 -pipe
> -march=pentium3" in proper way.

Read above.
 
> Besides I still found NetBSD to be an _incredible good_ system, best I've ever
> met and used (Linux 4 years, FreeBSD 3/4 of year).

Agreed! 

--Signature=_Thu__3_Feb_2005_04_31_28_+0100_JlWaguVt73xYhhOz
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (NetBSD)

iD8DBQFCAZsQypkLYVDran0RAl/kAJ9YzGZi7aI6A+Lr7pC7WB0hfRVJzwCdFLz0
zHwDrXnKqU9rJtQdTYNSVaA=
=Qk2+
-----END PGP SIGNATURE-----

--Signature=_Thu__3_Feb_2005_04_31_28_+0100_JlWaguVt73xYhhOz--