Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2011 14:57:56 -0400
From:      Arnaud Lacombe <lacombar@gmail.com>
To:        freebsd-current@freebsd.org
Cc:        Arnaud Lacombe <lacombar@gmail.com>
Subject:   Re: [PATCH] Fix CFLAGS overwrite by Makefile
Message-ID:  <BANLkTikD23Pv8B8ckuSYTw6D1bsfz4nZnA@mail.gmail.com>
In-Reply-To: <1306267772-31084-1-git-send-email-lacombar@gmail.com>
References:  <1306267772-31084-1-git-send-email-lacombar@gmail.com>

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

On Tue, May 24, 2011 at 4:09 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Many Makefile (espectially under sys/boot/) overwrite the value of CFLAGS=
.
> This is an issue if you want to generate code for a specific CPU as befor=
e the
> Makefile is interpreted, CFLAGS might already have been set with CPU spec=
ific
> settings by <bsd.cpu.mk>, which is source from sys.mk.
>
For the record, I maintain the bootloader part of that patch. So far,
it has not been (technically) proven that optimizing the bootloader
for a specific CPU breaks it in any way. So when I, as a FreeBSD
integrator, explicitly tells the build to target a given CPU, I expect
_all_ the component to be optimized for such a CPU.

Beside that contention point, I'd hope that the gvinum part can be committe=
d.

 - Arnaud

> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
> ---
> =A0sbin/gvinum/Makefile =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A02 +-
> =A0sys/boot/arm/at91/Makefile.inc =A0 =A0 =A0 | =A0 =A02 +-
> =A0sys/boot/i386/boot2/Makefile =A0 =A0 =A0 =A0 | =A0 =A02 +-
> =A0sys/boot/i386/gptboot/Makefile =A0 =A0 =A0 | =A0 =A02 +-
> =A0sys/boot/i386/gptzfsboot/Makefile =A0 =A0| =A0 =A02 +-
> =A0sys/boot/i386/kgzldr/Makefile =A0 =A0 =A0 =A0| =A0 =A02 +-
> =A0sys/boot/i386/zfsboot/Makefile =A0 =A0 =A0 | =A0 =A02 +-
> =A0sys/boot/pc98/boot2/Makefile =A0 =A0 =A0 =A0 | =A0 =A02 +-
> =A0sys/boot/pc98/kgzldr/Makefile =A0 =A0 =A0 =A0| =A0 =A02 +-
> =A0sys/boot/powerpc/boot1.chrp/Makefile | =A0 =A02 +-
> =A0sys/boot/sparc64/boot1/Makefile =A0 =A0 =A0| =A0 =A02 +-
> =A011 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/sbin/gvinum/Makefile b/sbin/gvinum/Makefile
> index 8cccf56..465b617 100644
> --- a/sbin/gvinum/Makefile
> +++ b/sbin/gvinum/Makefile
> @@ -5,7 +5,7 @@ SRCS=3D =A0 gvinum.c gvinum.h geom_vinum_share.c
> =A0MAN=3D =A0 gvinum.8
>
> =A0WARNS?=3D =A0 =A0 =A0 =A02
> -CFLAGS=3D =A0 =A0 =A0 =A0-I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDI=
R}/edit
> +CFLAGS+=3D-I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit
>
> =A0DPADD=3D ${LIBEDIT} ${LIBTERMCAP} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM}
> =A0LDADD=3D -ledit -ltermcap -ldevstat -lkvm -lgeom
> diff --git a/sys/boot/arm/at91/Makefile.inc b/sys/boot/arm/at91/Makefile.=
inc
> index 2f528e3..db37c7d 100644
> --- a/sys/boot/arm/at91/Makefile.inc
> +++ b/sys/boot/arm/at91/Makefile.inc
> @@ -8,7 +8,7 @@ __at91_boot_Makefile.inc__:
> =A0# tsc, bwct, kb920x, centipad are the supported flavors
> =A0BOOT_FLAVOR?=3Dkb920x
>
> -CFLAGS=3D-Os -mcpu=3Darm9 -ffreestanding \
> +CFLAGS+=3D-Os -mcpu=3Darm9 -ffreestanding \
> =A0 =A0 =A0 =A0-I${.CURDIR}/../libat91 \
> =A0 =A0 =A0 =A0-I${.CURDIR}/../../../.. \
> =A0 =A0 =A0 =A0-I${.CURDIR}/../../../../arm \
> diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
> index 9568c1c..fc231e6 100644
> --- a/sys/boot/i386/boot2/Makefile
> +++ b/sys/boot/i386/boot2/Makefile
> @@ -22,7 +22,7 @@ BOOT2_UFS?=3D =A0 UFS1_AND_UFS2
> =A0#BOOT2_UFS?=3D =A0 UFS2_ONLY
> =A0#BOOT2_UFS?=3D =A0 UFS1_ONLY
>
> -CFLAGS=3D =A0 =A0 =A0 =A0-Os \
> +CFLAGS+=3D-Os \
> =A0 =A0 =A0 =A0-fno-guess-branch-probability \
> =A0 =A0 =A0 =A0-fomit-frame-pointer \
> =A0 =A0 =A0 =A0-fno-unit-at-a-time \
> diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makef=
ile
> index 5642220..18c0f35 100644
> --- a/sys/boot/i386/gptboot/Makefile
> +++ b/sys/boot/i386/gptboot/Makefile
> @@ -19,7 +19,7 @@ GPTBOOT_UFS?=3D UFS1_AND_UFS2
> =A0#GPTBOOT_UFS?=3D UFS2_ONLY
> =A0#GPTBOOT_UFS?=3D UFS1_ONLY
>
> -CFLAGS=3D =A0 =A0 =A0 =A0-DBOOTPROG=3D\"gptboot\" \
> +CFLAGS+=3D-DBOOTPROG=3D\"gptboot\" \
> =A0 =A0 =A0 =A0-Os \
> =A0 =A0 =A0 =A0-fno-guess-branch-probability \
> =A0 =A0 =A0 =A0-fomit-frame-pointer \
> diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot=
/Makefile
> index f0ee578..6e7d543 100644
> --- a/sys/boot/i386/gptzfsboot/Makefile
> +++ b/sys/boot/i386/gptzfsboot/Makefile
> @@ -16,7 +16,7 @@ REL1=3D 0x700
> =A0ORG1=3D =A00x7c00
> =A0ORG2=3D =A00x0
>
> -CFLAGS=3D =A0 =A0 =A0 =A0-DBOOTPROG=3D\"gptzfsboot\" \
> +CFLAGS+=3D-DBOOTPROG=3D\"gptzfsboot\" \
> =A0 =A0 =A0 =A0-Os \
> =A0 =A0 =A0 =A0-fno-guess-branch-probability \
> =A0 =A0 =A0 =A0-fomit-frame-pointer \
> diff --git a/sys/boot/i386/kgzldr/Makefile b/sys/boot/i386/kgzldr/Makefil=
e
> index a124474..e8a4157 100644
> --- a/sys/boot/i386/kgzldr/Makefile
> +++ b/sys/boot/i386/kgzldr/Makefile
> @@ -7,7 +7,7 @@ BINDIR=3D ${LIBDIR}
> =A0NO_MAN=3D
>
> =A0SRCS=3D =A0start.s boot.c inflate.c lib.c crt.s sio.s
> -CFLAGS=3D =A0 =A0 =A0 =A0-Os
> +CFLAGS+=3D-Os
> =A0CFLAGS+=3D-DKZIP
> =A0NO_SHARED=3D
> =A0LDFLAGS=3D-Wl,-r
> diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makef=
ile
> index 06ff863..aa1bfbe 100644
> --- a/sys/boot/i386/zfsboot/Makefile
> +++ b/sys/boot/i386/zfsboot/Makefile
> @@ -14,7 +14,7 @@ REL1=3D 0x700
> =A0ORG1=3D =A00x7c00
> =A0ORG2=3D =A00x2000
>
> -CFLAGS=3D =A0 =A0 =A0 =A0-DBOOTPROG=3D\"zfsboot\" \
> +CFLAGS+=3D-DBOOTPROG=3D\"zfsboot\" \
> =A0 =A0 =A0 =A0-Os -g \
> =A0 =A0 =A0 =A0-fno-guess-branch-probability \
> =A0 =A0 =A0 =A0-fomit-frame-pointer \
> diff --git a/sys/boot/pc98/boot2/Makefile b/sys/boot/pc98/boot2/Makefile
> index 18bf251..e9f1506 100644
> --- a/sys/boot/pc98/boot2/Makefile
> +++ b/sys/boot/pc98/boot2/Makefile
> @@ -22,7 +22,7 @@ BOOT2_UFS?=3D =A0 UFS1_AND_UFS2
> =A0#BOOT2_UFS?=3D =A0 UFS2_ONLY
> =A0#BOOT2_UFS?=3D =A0 UFS1_ONLY
>
> -CFLAGS=3D =A0 =A0 =A0 =A0-Os \
> +CFLAGS+=3D-Os \
> =A0 =A0 =A0 =A0-fno-guess-branch-probability \
> =A0 =A0 =A0 =A0-fomit-frame-pointer \
> =A0 =A0 =A0 =A0-fno-unit-at-a-time \
> diff --git a/sys/boot/pc98/kgzldr/Makefile b/sys/boot/pc98/kgzldr/Makefil=
e
> index 2303fd9..645cc58 100644
> --- a/sys/boot/pc98/kgzldr/Makefile
> +++ b/sys/boot/pc98/kgzldr/Makefile
> @@ -7,7 +7,7 @@ BINDIR=3D ${LIBDIR}
> =A0NO_MAN=3D
>
> =A0SRCS=3D =A0start.s boot.c inflate.c lib.c crt.s sio.s
> -CFLAGS=3D =A0 =A0 =A0 =A0-Os
> +CFLAGS+=3D-Os
> =A0CFLAGS+=3D-DKZIP
> =A0NO_SHARED=3D
> =A0LDFLAGS=3D-Wl,-r
> diff --git a/sys/boot/powerpc/boot1.chrp/Makefile b/sys/boot/powerpc/boot=
1.chrp/Makefile
> index f3f7e4d..88358b5 100644
> --- a/sys/boot/powerpc/boot1.chrp/Makefile
> +++ b/sys/boot/powerpc/boot1.chrp/Makefile
> @@ -13,7 +13,7 @@ SRCS=3D =A0 =A0 =A0 =A0 boot1.c ashldi3.c
> =A0INTERNALPROG=3D
> =A0NO_MAN=3D
>
> -CFLAGS=3D -ffreestanding -msoft-float -Os \
> +CFLAGS+=3D-ffreestanding -msoft-float -Os \
> =A0 =A0 =A0 =A0-I${.CURDIR}/../../common -I${.CURDIR}/../../../
> =A0LDFLAGS=3D-nostdlib -static -N
>
> diff --git a/sys/boot/sparc64/boot1/Makefile b/sys/boot/sparc64/boot1/Mak=
efile
> index dec3e09..29e14f8 100644
> --- a/sys/boot/sparc64/boot1/Makefile
> +++ b/sys/boot/sparc64/boot1/Makefile
> @@ -8,7 +8,7 @@ SRCS=3D =A0 _start.s boot1.c
>
> =A0BOOTBLOCKBASE=3D 0x4000
>
> -CFLAGS=3D =A0 =A0 =A0 =A0-mcmodel=3Dmedlow -Os -I${.CURDIR}/../../common
> +CFLAGS+=3D-mcmodel=3Dmedlow -Os -I${.CURDIR}/../../common
> =A0LDFLAGS=3D-Ttext ${BOOTBLOCKBASE} -Wl,-N
>
> =A0# Construct boot1. sunlabel expects it to contain zeroed-out space for=
 the
> --
> 1.7.5.rc1.23.g0cac8.dirty
>
>



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