[PATCH] Fix CFLAGS overwrite by Makefile

Arnaud Lacombe lacombar at gmail.com
Tue May 24 20:09:44 UTC 2011


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.

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
@@ -5,7 +5,7 @@ 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
@@ -8,7 +8,7 @@ __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
@@ -22,7 +22,7 @@ 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
@@ -19,7 +19,7 @@ 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
@@ -16,7 +16,7 @@ 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
@@ -7,7 +7,7 @@ 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
@@ -14,7 +14,7 @@ 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
@@ -22,7 +22,7 @@ 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
@@ -7,7 +7,7 @@ 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
@@ -13,7 +13,7 @@ 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
@@ -8,7 +8,7 @@ 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



More information about the freebsd-current mailing list