traling whitespace in CFLAGS if make.conf:CPUTYPE is not defined/empty

Alexander Best arundel at freebsd.org
Thu Sep 16 01:01:20 UTC 2010


hi there,

after discovering PR #114082 i noticed that with CPUTYPE not being defined in
make.conf, `make -VCFLAGS` reports a trailing whitespace for CFLAGS.
the reason for this is that ${_CPUCFLAGS} gets added to CFLAGS even if it's
empty.

the following patch should take care of the problem. i also added the same
logik to COPTFLAGS. although i wasn't able to trigger the trailing whitespace,
it should still introduce a cleaner behaviour.

cheers.
alex

-- 
a13x
-------------- next part --------------
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index e3ad18b..fa7fb32 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -6,6 +6,7 @@
 
 .if !defined(CPUTYPE) || empty(CPUTYPE)
 _CPUCFLAGS =
+NO_CPU_CFLAGS =
 . if ${MACHINE_ARCH} == "i386"
 MACHINE_CPU = i486
 . elif ${MACHINE_ARCH} == "amd64"
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index d4bdc1f..9929176 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -23,6 +23,10 @@ NM?=		nm
 OBJCOPY?=	objcopy
 SIZE?=		size
 
+.if !defined(CPUTYPE) || empty(CPUTYPE)
+_CPUCFLAGS =
+NO_CPU_COPTFLAGS =
+.endif
 .if ${CC:T:Micc} == "icc"
 COPTFLAGS?=	-O
 .else


More information about the freebsd-hackers mailing list