Re: [PATCH] Fix CFLAGS overwrite by Makefile

From: Arnaud Lacombe <lacombar_at_gmail.com>
Date: Thu, 26 May 2011 14:57:56 -0400
Hi,

On Tue, May 24, 2011 at 4:09 PM, Arnaud Lacombe <lacombar_at_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 before the
> Makefile is interpreted, CFLAGS might already have been set with CPU specific
> 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 committed.

 - Arnaud

> Signed-off-by: Arnaud Lacombe <lacombar_at_gmail.com>
> ---
>  sbin/gvinum/Makefile                 |    2 +-
>  sys/boot/arm/at91/Makefile.inc       |    2 +-
>  sys/boot/i386/boot2/Makefile         |    2 +-
>  sys/boot/i386/gptboot/Makefile       |    2 +-
>  sys/boot/i386/gptzfsboot/Makefile    |    2 +-
>  sys/boot/i386/kgzldr/Makefile        |    2 +-
>  sys/boot/i386/zfsboot/Makefile       |    2 +-
>  sys/boot/pc98/boot2/Makefile         |    2 +-
>  sys/boot/pc98/kgzldr/Makefile        |    2 +-
>  sys/boot/powerpc/boot1.chrp/Makefile |    2 +-
>  sys/boot/sparc64/boot1/Makefile      |    2 +-
>  11 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
> _at__at_ -5,7 +5,7 _at__at_ SRCS=   gvinum.c gvinum.h geom_vinum_share.c
>  MAN=   gvinum.8
>
>  WARNS?=        2
> -CFLAGS=        -I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit
> +CFLAGS+=-I${.CURDIR}/../../sys -I${DESTDIR}/${INCLUDEDIR}/edit
>
>  DPADD= ${LIBEDIT} ${LIBTERMCAP} ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM}
>  LDADD= -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
> _at__at_ -8,7 +8,7 _at__at_ __at91_boot_Makefile.inc__:
>  # tsc, bwct, kb920x, centipad are the supported flavors
>  BOOT_FLAVOR?=kb920x
>
> -CFLAGS=-Os -mcpu=arm9 -ffreestanding \
> +CFLAGS+=-Os -mcpu=arm9 -ffreestanding \
>        -I${.CURDIR}/../libat91 \
>        -I${.CURDIR}/../../../.. \
>        -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
> _at__at_ -22,7 +22,7 _at__at_ BOOT2_UFS?=   UFS1_AND_UFS2
>  #BOOT2_UFS?=   UFS2_ONLY
>  #BOOT2_UFS?=   UFS1_ONLY
>
> -CFLAGS=        -Os \
> +CFLAGS+=-Os \
>        -fno-guess-branch-probability \
>        -fomit-frame-pointer \
>        -fno-unit-at-a-time \
> diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
> index 5642220..18c0f35 100644
> --- a/sys/boot/i386/gptboot/Makefile
> +++ b/sys/boot/i386/gptboot/Makefile
> _at__at_ -19,7 +19,7 _at__at_ GPTBOOT_UFS?= UFS1_AND_UFS2
>  #GPTBOOT_UFS?= UFS2_ONLY
>  #GPTBOOT_UFS?= UFS1_ONLY
>
> -CFLAGS=        -DBOOTPROG=\"gptboot\" \
> +CFLAGS+=-DBOOTPROG=\"gptboot\" \
>        -Os \
>        -fno-guess-branch-probability \
>        -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
> _at__at_ -16,7 +16,7 _at__at_ REL1= 0x700
>  ORG1=  0x7c00
>  ORG2=  0x0
>
> -CFLAGS=        -DBOOTPROG=\"gptzfsboot\" \
> +CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \
>        -Os \
>        -fno-guess-branch-probability \
>        -fomit-frame-pointer \
> diff --git a/sys/boot/i386/kgzldr/Makefile b/sys/boot/i386/kgzldr/Makefile
> index a124474..e8a4157 100644
> --- a/sys/boot/i386/kgzldr/Makefile
> +++ b/sys/boot/i386/kgzldr/Makefile
> _at__at_ -7,7 +7,7 _at__at_ BINDIR= ${LIBDIR}
>  NO_MAN=
>
>  SRCS=  start.s boot.c inflate.c lib.c crt.s sio.s
> -CFLAGS=        -Os
> +CFLAGS+=-Os
>  CFLAGS+=-DKZIP
>  NO_SHARED=
>  LDFLAGS=-Wl,-r
> diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
> index 06ff863..aa1bfbe 100644
> --- a/sys/boot/i386/zfsboot/Makefile
> +++ b/sys/boot/i386/zfsboot/Makefile
> _at__at_ -14,7 +14,7 _at__at_ REL1= 0x700
>  ORG1=  0x7c00
>  ORG2=  0x2000
>
> -CFLAGS=        -DBOOTPROG=\"zfsboot\" \
> +CFLAGS+=-DBOOTPROG=\"zfsboot\" \
>        -Os -g \
>        -fno-guess-branch-probability \
>        -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
> _at__at_ -22,7 +22,7 _at__at_ BOOT2_UFS?=   UFS1_AND_UFS2
>  #BOOT2_UFS?=   UFS2_ONLY
>  #BOOT2_UFS?=   UFS1_ONLY
>
> -CFLAGS=        -Os \
> +CFLAGS+=-Os \
>        -fno-guess-branch-probability \
>        -fomit-frame-pointer \
>        -fno-unit-at-a-time \
> diff --git a/sys/boot/pc98/kgzldr/Makefile b/sys/boot/pc98/kgzldr/Makefile
> index 2303fd9..645cc58 100644
> --- a/sys/boot/pc98/kgzldr/Makefile
> +++ b/sys/boot/pc98/kgzldr/Makefile
> _at__at_ -7,7 +7,7 _at__at_ BINDIR= ${LIBDIR}
>  NO_MAN=
>
>  SRCS=  start.s boot.c inflate.c lib.c crt.s sio.s
> -CFLAGS=        -Os
> +CFLAGS+=-Os
>  CFLAGS+=-DKZIP
>  NO_SHARED=
>  LDFLAGS=-Wl,-r
> diff --git a/sys/boot/powerpc/boot1.chrp/Makefile b/sys/boot/powerpc/boot1.chrp/Makefile
> index f3f7e4d..88358b5 100644
> --- a/sys/boot/powerpc/boot1.chrp/Makefile
> +++ b/sys/boot/powerpc/boot1.chrp/Makefile
> _at__at_ -13,7 +13,7 _at__at_ SRCS=         boot1.c ashldi3.c
>  INTERNALPROG=
>  NO_MAN=
>
> -CFLAGS= -ffreestanding -msoft-float -Os \
> +CFLAGS+=-ffreestanding -msoft-float -Os \
>        -I${.CURDIR}/../../common -I${.CURDIR}/../../../
>  LDFLAGS=-nostdlib -static -N
>
> diff --git a/sys/boot/sparc64/boot1/Makefile b/sys/boot/sparc64/boot1/Makefile
> index dec3e09..29e14f8 100644
> --- a/sys/boot/sparc64/boot1/Makefile
> +++ b/sys/boot/sparc64/boot1/Makefile
> _at__at_ -8,7 +8,7 _at__at_ SRCS=   _start.s boot1.c
>
>  BOOTBLOCKBASE= 0x4000
>
> -CFLAGS=        -mcmodel=medlow -Os -I${.CURDIR}/../../common
> +CFLAGS+=-mcmodel=medlow -Os -I${.CURDIR}/../../common
>  LDFLAGS=-Ttext ${BOOTBLOCKBASE} -Wl,-N
>
>  # Construct boot1. sunlabel expects it to contain zeroed-out space for the
> --
> 1.7.5.rc1.23.g0cac8.dirty
>
>
Received on Thu May 26 2011 - 16:57:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:14 UTC