Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 May 2005 11:32:34 -0300
From:      Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
To:        freebsd-stable@FreeBSD.org
Subject:   make buildkernel subdirs do not respect COPTFLAGS
Message-ID:  <20050508143256.25030.qmail@exxodus.fedaykin.here>

next in thread | raw e-mail | index | archive | help

--gBBFr7Ir9EOA20Yy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

	I was doing my often world build when something came up.

$ make buildworld

just fine

$ make buildkernel=20

not so good

$ make buildkernel -V CFLAGS
-Os -pipe -march=3Dathlon-xp -falign-functions -falign-jumps -fno-strict-al=
iasing -fomit-frame-pointer -fpeel-loops -freorder-blocks -funit-at-a-time =
-funswitch-loops -mfpmath=3D387 -march=3Dathlon-xp
$ make buildkernel -V COPTFLAGS
-Os -pipe -march=3Dathlon-xp -falign-functions -falign-jumps -fno-strict-al=
iasing -fomit-frame-pointer -fpeel-loops -freorder-blocks -funit-at-a-time =
-funswitch-loops -mfpmath=3D387
$ make buildkernel -V LDFLAGS

	Those are the compile options I have. As you can see, both
COPTFLAGS and CFLAGS contents are the same whereas LDFLAGS is empty.

	I did a CVSup then a buildworld, then proceeded to a buildkernel.
Here is what I've got:

cd /usr/src/sys/modules; MAKEOBJDIRPREFIX=3D/usr/obj/usr/src/sys/LIOUX/modu=
les KMODDIR=3D/boot/kernel MACHINE=3Di386 KERNBUILDDIR=3D"/usr/obj/usr/src/=
sys/LIOUX" make  all
=3D=3D=3D> 3dfx
=3D=3D=3D> aac
=3D=3D=3D> aac/aac_linux
=3D=3D=3D> accf_data
=3D=3D=3D> accf_http
=3D=3D=3D> acpi
=3D=3D=3D> acpi/acpi
/usr/local/libexec/ccache/cc -O -pipe -pipe -msse -mfpmath=3Dsse,387 -funit=
-at-a-time -falign-functions -fforce-addr -fforce-mem -foptimize-register-m=
ove -foptimize-sibling-calls -fpeel-loops -fprefetch-loop-arrays -freorder-=
blocks -march=3Dathlon-xp -I/usr/src/sys/modules/acpi/acpi/../../../contrib=
/dev/acpica -D_KERNEL -DKLD_MODULE -nostdinc -I-  -I/usr/src/sys/modules/ac=
pi/acpi/../../../contrib/dev/acpica -include /usr/obj/usr/src/sys/LIOUX/opt=
_global.h -I. -I@ -I@/contrib/altq -I@/../include -finline-limit=3D8000 -fn=
o-common  -I/usr/obj/usr/src/sys/LIOUX -mno-align-long-strings -mpreferred-=
stack-boundary=3D2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -=
Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prot=
otypes -Wpointer-arith -Winline -Wcast-qual  -fformat-extensions -std=3Dc99=
 -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -c /usr/=
src/sys/modules/acpi/acpi/../../../contrib/dev/acpica/dsfield.c
/usr/src/sys/modules/acpi/acpi/../../../contrib/dev/acpica/dsfield.c:1: war=
ning: SSE instruction set disabled, using 387 arithmetics
*** Error code 1

	As you can see the FLAGS options being used to build the
kernel DO NOT match either CFLAGS or COPTFLAGS for buildkernel. I
can reproduce this just fine. Let me know if you need a full log
'make buildworld buildkernel'

	As you can see below my standard CFLAGS is not the same as
of the one for buildkernel.

$ make -V CFLAGS
-O -pipe -pipe -msse -mfpmath=3Dsse,387 -funit-at-a-time -falign-functions =
-fforce-addr -fforce-mem -foptimize-register-move -foptimize-sibling-calls =
-fpeel-loops -fprefetch-loop-arrays -freorder-blocks -march=3Dathlon-xp

	I trick the system to use different build make options
depending on the given situation.

My /etc/make.conf contains the following

COPTFLAGS=3D-Os -pipe
COPTFLAGS+=3D-march=3Dathlon-xp
COPTFLAGS+=3D-falign-functions
COPTFLAGS+=3D-falign-jumps
COPTFLAGS+=3D-fno-strict-aliasing
COPTFLAGS+=3D-fomit-frame-pointer
COPTFLAGS+=3D-fpeel-loops
COPTFLAGS+=3D-freorder-blocks
COPTFLAGS+=3D-funit-at-a-time
COPTFLAGS+=3D-funswitch-loops
=2Eif make(buildworld) || make(buildkernel)
LDFLAGS_LD_INSTEAD_OF_CC=3Dyes
NO_CFLAGS=3Dyes
CFLAGS=3D${COPTFLAGS}
=2Eif make(buildworld)
COPTFLAGS+=3D-msse
COPTFLAGS+=3D-mfpmath=3Dsse,387
=2Eelif make(buildkernel) # ! make(buildworld)
COPTFLAGS+=3D-mfpmath=3D387
=2Eendif # make(buildkernel)
=2Eendif # make(buildworld) || make(buildkernel)

	The botton line is, the following line

cd /usr/src/sys/modules; MAKEOBJDIRPREFIX=3D/usr/obj/usr/src/sys/LIOUX/modu=
les KMODDIR=3D/boot/kernel MACHINE=3Di386 KERNBUILDDIR=3D"/u
sr/obj/usr/src/sys/LIOUX" make  all

has no idea that it is part of a buildkernel statement. We can fix
that by setting a ENVIRONMENT variable when the kernel is being
built and check that within /usr/src/sys/modules in order to respect
COPTFLAGS over CFLAGS.

	What do you guys think? I hope my make.conf code tricks are
useful to some folks out there.

	Regards,

ps: Plz, CC: me in your responses since I am no longer subscribed
to this mailing list

--=20
Mario S F Ferreira - DF - Brazil - "I guess this is a signature."
feature, n: a documented bug | bug, n: an undocumented feature

--gBBFr7Ir9EOA20Yy
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQFCfiMYrxEiaFLzGQwRAsu2AJ0WQePuiLEWdK8A71yf9UaJkfJ8iACfddnV
p6hGknXvGGBrOghpxZJyX0Q=
=ma0Q
-----END PGP SIGNATURE-----

--gBBFr7Ir9EOA20Yy--



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