Subject: Re: kmem_map panic, building userland et al, atalk q's
To: Hans-Christian Becker <hcb@phc.chalmers.se>
From: Frederick Bruckman <fb@enteract.com>
List: port-mac68k
Date: 09/11/1998 11:45:07
On Fri, 11 Sep 1998, Hans-Christian Becker wrote:

> (2) Is it correct that I can have something like
> COPTS += -O2 -mc68040
> in /etc/mk.conf and compile my stuff with '040 instructions? I browsed
> through /usr/share/mk/* and that is what I  the stuff there.

Setting COPTS there only affects userland. (BTW, it's -m68040; there is no
-mc68040;  -mc68020 is set by default.) As for kernels, the Makefile
produced by config explicitly overrides COPTS, and CFLAGS too. You could
add

makeoptions	COPTS="-O2 -m68040 -pipe"

for example, to your kernel config, if you want to optimize kernels.

Most packages only respond to CFLAGS, which also works for userland, but
again doesn't affect kernels. Most of the packages which don't respect
CFLAGS do so because it's known that they have problems with
optimizations, so it's probably best to leave them alone.

You can also set CFLAGS or COPTS in your environment. I've built many
trees and kernels with COPTS in the kernel options file, and CFLAGS in my
environment, both set as above. I used to go with -O3, but stopped that
after detecting an obscure bug with "eqn." Also be aware that there's a
know bug, where kernels don't build at all with -O0, or no 'O' at all.
Lately I'm having a problem with new kernels, but this does not appear to
be a problem with the optimizations. (Tried without it; no help.)

Also, be aware that increasing the optimization level adds a significant
amount of time to the build. Making the full tree, with optimizations set
as above, takes about 25 hours on a Quadra 630. Just tried it last night
with NOMAN=1, and the default, -O, and it only took 10 hours.

Some time ago I posed the question to this list, of how to control the
optimizations for X Windows. The answer was to set CDEBUGFLAGS, by
changing the relevant line in xsrc/xc/config/NetBSD.cf. Setting this
variable in your environment, or /etc/mk.conf, does nothing, as it's set
unconditionally in that file. Alternatively, you can set it in
xsrc/xc/config/host.def, which is normally empty (like mk.conf). The
disadvantage to using host.def is that it generates an error line for
every Makefile, as the existing variable is redefined. "make World" took
me about 8 hours, again with the "-O2 -m68040 -pipe".