Subject: Re: kern/21311: Generic kernel doesnt compile in 1.6.1_STABLE
To: enami tsugutomo <enami@sm.sony.co.jp>
From: Mipam <mipam@ibb.net>
List: netbsd-bugs
Date: 04/25/2003 20:21:44
On Fri, Apr 25, 2003 at 06:14:43PM +0900, enami tsugutomo wrote:
> Mipam <mipam@ibb.net> writes:
> 
> > If not, what could i do?
> 
> Remove `COPTS+=-pipe' and leave just `CFLAGS+=-pipe' in your
> /etc/mk.conf.  The latter should be fine for kernel and userland also.
> Setting value to COPTS results missing -O2.  Read
> sys/conf/Makefile.kern.inc and sys/arch/i386/conf/Makefile.i386 for
> detail.

Thanks for all the answers.
It remains unclear .... it's stated as fact and i experience it by trying
it's so, but i dont understand why.
I dont have a problem adding -O2 at COPTS, but ..........
Are these the only options which are always set?
Are no other options ever needed in compiling a kernel?
If so, using COPTS is a bad idea.
Im back to using CFLAGS+=-pipe which i quit doing a while ago when i believed
COPTS took over for kernel and userland.
Obviously it doesnt. I used CFLAGS+= now and it did what i hoped for:
append -pipe to the already existing CFLAGS as defined in
/usr/share/mk/sys.mk

Where if the arch is i386, DBG?= -O2
and CFLAGS?= ${DBG}
Now adding CFLAGS+= to mk.conf appends indeed.
Makes me wonder why COPTS was introduced anyway.
Or perhaps i should just change sys.mk CFLAGS?= ${DBG} -pipe
Now in my /etc/mk.conf is:

CFLAGS+= -pipe
HOST_FLAGS+= ${CFLAGS}
CXXFLAGS+= ${CFLAGS}
HOST_CXXFLAGS+= ${CFLAGS}

Or isnt this a good idea?
The GENERIC kernel compiles now.
So, when you use COPTS, CFLAGS is defined before sys.mk comes into play
and when using CFLAGS first sys.mk is being read and then mk.conf??
I guess im wrong?
Bye,

Mipam.