NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Compiler options for NetBSD



Christian Baer <christian.baer%uni-dortmund.de@localhost> wrote:

> Under FreeBSD, setting CFLAGS in /etc/make.conf was not considered a bad 
> thing. The NetBSD manpage for mk.conf says that CFLAGS should *never* be 
> set in mk.conf, without saying where to put them instead. :-) Can 
> someone help me out here?
> 
> Under FreeBSD, my make.conf looked something like this:
> 
>   CFLAGS+= -O2 -pipe -fno-strict-aliasing -mtune=ultrasparc
>   #CFLAGS+= -mcpu=ultrasparc
> 
>   COPTFLAGS+= -O2 -pipe -mtune=ultrasparc
>   #COPTFLAGS+= -mcpu=ultrasparc
> 
> The line containing the -mcpu is commented out because that often broke 
> the build, including world and kernel. This was not a code problem but 
> instead a problem concerning the definition of the platform. Make kept 
> on complaining that it had no idea what plattform to compile for. :-)

Use CPUFLAGS for -mcpu, -mtune and the like.  It is also used when
compiling assembler sources.

For optimization settings I think the party line is to use COPTS,
though I usually cheat and set DBG which is not documented but which
is used to seed CFLAGS (cf. sys.mk).


> I noticed that quite a few things from NetBSD are compiled with -Os, 
> which is nearly -O2 minus a few things.

-Os is only used for things like boot code, etc and is set by
respective makefiles in the tree, the paltfrom default is -O2 for
almost all architectures (though some do use -O1 or -Os by default).


SY, Uwe
-- 
uwe%stderr.spb.ru@localhost                       |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen



Home | Main Index | Thread Index | Old Index