Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Sep 2008 13:40:19 -0700
From:      =?utf-8?Q?Derek_Kuli=C5=84ski?= <takeda@takeda.tk>
To:        Bartosz Stec <admin@kkip.pl>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Funny things with cflags and world/kernel building
Message-ID:  <334439428.20080907134019@takeda.tk>
In-Reply-To: <48C1302C.2040109@kkip.pl>
References:  <48C1302C.2040109@kkip.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello Bartosz,

Friday, September 5, 2008, 6:12:12 AM, you wrote:

> My make.conf:
>     CPUTYPE=athlon64
>     MAKEOPTS=-j3

I would recommend to take that -j3 out from make.conf, it might screw
up make install, not to mention many ports might not build with it.

>     # USE CCACHE
>     .if !defined(NOCCACHE)
>     CC=/usr/local/libexec/ccache/world-cc
>     CXX=/usr/local/libexec/ccache/world-c++
>     .endif

AFAIK this is setting for building world, the way you set it up seems
to be using it for everything else (i.e. ports)
I belive this is the recommended way of using it:

.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE)
CC=/usr/local/libexec/ccache/world-cc
CXX=/usr/local/libexec/ccache/world-c++
.endif


> 1. when I use these flags:

>     CFLAGS=-O2 -fno-strict-aliasing -pipe
>     CXXFLAGS=${CFLAGS}
>     COPTFLAGS=${CFLAGS}

> world building finish without problem, but making kernel give an error:

> 2. When I use these flags:

>     CFLAGS=-O2 -fno-strict-aliasing -pipe
>     CXXFLAGS=-O2 -fno-strict-aliasing -pipe
>     COPTFLAGS=-O2 -fno-strict-aliasing -pipe

> kernel build finish without problem, but... building world give an error!:

> 3. What's even more funny? When I use flags:

>     CFLAGS=-O2 -fno-strict-aliasing -pipe
>     COPTFLAGS=-O2 -fno-strict-aliasing -pipe
>     CXXFLAGS=${CFLAGS}

> I have no errors at all! But shouldn't all those flags be treated by 
> make command exactly the same way??

I think the strange behavior probably is because make.conf is called
each time a make is executed. Building world, kernel etc. Will call
multiple makes inside of another make. I suspect some of the Makefiles
might append additional flags, so the ${CFLAGS} might change its value
in different parts of the compiling, so that's why you might get the
weird errors.
I guess perhaps you could use the last option since it works, or
instead of using = you would use ?=
i.e.
CFLAGS ?= -O2 -fno-strict-aliasing -pipe

This will assign cflags only if CFLAGS is empty.

-- 
Best regards,
 Derek                            mailto:takeda@takeda.tk

-- Be nice to your kids. They'll choose your nursing home.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?334439428.20080907134019>