svn commit: r211437 - in head: share/mk sys/conf sys/dev/aic7xxx/aicasm sys/i386/acpica

Rui Paulo rpaulo at FreeBSD.org
Tue Aug 17 20:39:29 UTC 2010


Author: rpaulo
Date: Tue Aug 17 20:39:28 2010
New Revision: 211437
URL: http://svn.freebsd.org/changeset/base/211437

Log:
  For every instance of '.if ${CC} == "foo"' or '.if ${CC} != "foo"' in
  Makefiles or *.mk files, use ${CC:T:Mfoo} instead, so only the basename
  of the compiler command (excluding any arguments) is considered.
  
  This allows you to use, for example, CC="/nondefault/path/clang -xxx",
  and still have the various tests in bsd.*.mk identify your compiler as
  clang correctly.
  
  ICC if cases were also changed.
  
  Submitted by:	Dimitry Andric <dimitry at andric.com>

Modified:
  head/share/mk/bsd.dep.mk
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.sys.mk
  head/sys/conf/kern.mk
  head/sys/conf/kern.pre.mk
  head/sys/conf/kmod.mk
  head/sys/dev/aic7xxx/aicasm/Makefile
  head/sys/i386/acpica/Makefile

Modified: head/share/mk/bsd.dep.mk
==============================================================================
--- head/share/mk/bsd.dep.mk	Tue Aug 17 20:26:17 2010	(r211436)
+++ head/share/mk/bsd.dep.mk	Tue Aug 17 20:39:28 2010	(r211437)
@@ -125,7 +125,7 @@ depend: beforedepend ${DEPENDFILE} after
 
 # Different types of sources are compiled with slightly different flags.
 # Split up the sources, and filter out headers and non-applicable flags.
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 MKDEP_CFLAGS=	${CFLAGS:M-X*} ${CFLAGS:M-[BIDU]*}
 MKDEP_CXXFLAGS=	${CXXFLAGS:M-X*} ${CXXFLAGS:M-[BIDU]*}
 MKDEP_OBJCFLAGS=${OBJCFLAGS:M-X*} ${OBJCFLAGS:M-[BIDU]*}

Modified: head/share/mk/bsd.lib.mk
==============================================================================
--- head/share/mk/bsd.lib.mk	Tue Aug 17 20:26:17 2010	(r211436)
+++ head/share/mk/bsd.lib.mk	Tue Aug 17 20:39:28 2010	(r211437)
@@ -65,7 +65,7 @@ PICFLAG=-fpic
 .endif
 .endif
 
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 PO_FLAG=-p
 .else
 PO_FLAG=-pg

Modified: head/share/mk/bsd.sys.mk
==============================================================================
--- head/share/mk/bsd.sys.mk	Tue Aug 17 20:26:17 2010	(r211436)
+++ head/share/mk/bsd.sys.mk	Tue Aug 17 20:39:28 2010	(r211437)
@@ -11,7 +11,7 @@
 # the default is gnu99 for now
 CSTD		?= gnu99
 
-.if ${CC} != "icc"
+.if ${CC:T:Micc} != "icc"
 . if ${CSTD} == "k&r"
 CFLAGS		+= -traditional
 . elif ${CSTD} == "c89" || ${CSTD} == "c90"
@@ -24,7 +24,7 @@ CFLAGS		+= -std=iso9899:1999
 CFLAGS		+= -std=${CSTD}
 . endif
 .endif
-.if !defined(NO_WARNS) && ${CC} != "icc"
+.if !defined(NO_WARNS) && ${CC:T:Micc} != "icc"
 # -pedantic is problematic because it also imposes namespace restrictions
 #CFLAGS		+= -pedantic
 . if defined(WARNS)
@@ -79,7 +79,7 @@ CWARNFLAGS	+=	-Werror
 CWARNFLAGS	+=	-Wno-unknown-pragmas
 .endif
 
-.if ${MK_SSP} != "no" && ${CC} != "icc" && ${MACHINE_ARCH} != "ia64" && \
+.if ${MK_SSP} != "no" && ${CC:T:Micc} != "icc" && ${MACHINE_ARCH} != "ia64" && \
 	${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "mips"
 # Don't use -Wstack-protector as it breaks world with -Werror.
 SSP_CFLAGS	?=	-fstack-protector

Modified: head/sys/conf/kern.mk
==============================================================================
--- head/sys/conf/kern.mk	Tue Aug 17 20:26:17 2010	(r211436)
+++ head/sys/conf/kern.mk	Tue Aug 17 20:39:28 2010	(r211437)
@@ -6,7 +6,7 @@
 # Note that the newly added -Wcast-qual is responsible for generating 
 # most of the remaining warnings.  Warnings introduced with -Wall will
 # also pop up, but are easier to fix.
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 #CWARNFLAGS=	-w2	# use this if you are terribly bored
 CWARNFLAGS=
 .else
@@ -29,8 +29,8 @@ CWARNFLAGS?=	-Wall -Wredundant-decls -Wn
 # operations inside the kernel itself.  These operations are exclusively
 # reserved for user applications.
 #
-.if ${MACHINE_ARCH} == "i386" && ${CC} != "icc"
-.if ${CC} != "clang"
+.if ${MACHINE_ARCH} == "i386" && ${CC:T:Micc} != "icc"
+.if ${CC:T:Mclang} != "clang"
 CFLAGS+=	-mno-align-long-strings -mpreferred-stack-boundary=2
 .endif
 CFLAGS+=	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
@@ -93,20 +93,20 @@ INLINE_LIMIT?=	8000
 # GCC 3.0 and above like to do certain optimizations based on the
 # assumption that the program is linked against libc.  Stop this.
 #
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 CFLAGS+=	-nolib_inline
 .else
 CFLAGS+=	-ffreestanding
 .endif
 
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 CFLAGS+=	-restrict
 .endif
 
 #
 # GCC SSP support.
 #
-.if ${MK_SSP} != "no" && ${CC} != "icc" && ${MACHINE_ARCH} != "ia64" && \
+.if ${MK_SSP} != "no" && ${CC:T:Micc} != "icc" && ${MACHINE_ARCH} != "ia64" && \
 	${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "mips"
 CFLAGS+=	-fstack-protector
 .endif

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Tue Aug 17 20:26:17 2010	(r211436)
+++ head/sys/conf/kern.pre.mk	Tue Aug 17 20:39:28 2010	(r211437)
@@ -23,7 +23,7 @@ NM?=		nm
 OBJCOPY?=	objcopy
 SIZE?=		size
 
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 COPTFLAGS?=	-O
 .else
 . if defined(DEBUG)
@@ -48,7 +48,7 @@ COPTFLAGS+= ${_ICC_CPUCFLAGS:C/(-x[^M^K^
 COPTFLAGS+= ${_CPUCFLAGS}
 . endif
 .endif
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 C_DIALECT=
 NOSTDINC= -X
 .else
@@ -92,8 +92,8 @@ INCLUDES+= -I$S/dev/cxgb
 
 CFLAGS=	${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS}
 CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
-.if ${CC} != "icc"
-.if ${CC} != "clang"
+.if ${CC:T:Micc} != "icc"
+.if ${CC:T:Mclang} != "clang"
 CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT}
 .if ${MACHINE_CPUARCH} != "mips"
 CFLAGS+= --param inline-unit-growth=100
@@ -111,7 +111,7 @@ WERROR?= -Werror
 ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
 
 .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
-.if ${CC} == "icc" || ${CC} == "clang"
+.if ${CC:T:Micc} == "icc" || ${CC:T:Mclang} == "clang"
 .error "Profiling doesn't work with icc or clang yet"
 .endif
 CFLAGS+=	-DGPROF -falign-functions=16

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk	Tue Aug 17 20:26:17 2010	(r211436)
+++ head/sys/conf/kmod.mk	Tue Aug 17 20:39:28 2010	(r211437)
@@ -81,7 +81,7 @@ OBJCOPY?=	objcopy
 
 .SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
 
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 CFLAGS:=	${CFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/}
 .else
 . if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
@@ -94,7 +94,7 @@ CFLAGS+=	-D_KERNEL
 CFLAGS+=	-DKLD_MODULE
 
 # Don't use any standard or source-relative include directories.
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 NOSTDINC=	-X
 .else
 CSTD=		c99
@@ -114,7 +114,7 @@ CFLAGS+=	-I. -I@
 # for example.
 CFLAGS+=	-I@/contrib/altq
 
-.if ${CC} != "icc" && ${CC} != "clang"
+.if ${CC:T:Micc} != "icc" && ${CC:T:Mclang} != "clang"
 CFLAGS+=	-finline-limit=${INLINE_LIMIT}
 CFLAGS+= --param inline-unit-growth=100
 CFLAGS+= --param large-function-growth=1000
@@ -122,7 +122,7 @@ CFLAGS+= --param large-function-growth=1
 
 # Disallow common variables, and if we end up with commons from
 # somewhere unexpected, allocate storage for them in the module itself.
-.if ${CC} != "icc"
+.if ${CC:T:Micc} != "icc"
 CFLAGS+=	-fno-common
 .endif
 LDFLAGS+=	-d -warn-common

Modified: head/sys/dev/aic7xxx/aicasm/Makefile
==============================================================================
--- head/sys/dev/aic7xxx/aicasm/Makefile	Tue Aug 17 20:26:17 2010	(r211436)
+++ head/sys/dev/aic7xxx/aicasm/Makefile	Tue Aug 17 20:39:28 2010	(r211437)
@@ -24,7 +24,7 @@ WARNS?=	5
 DEPENDFILE=	.depend_aicasm
 .endif
 
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 CFLAGS+=	-restrict
 NOSTDINC=	-X
 .else

Modified: head/sys/i386/acpica/Makefile
==============================================================================
--- head/sys/i386/acpica/Makefile	Tue Aug 17 20:26:17 2010	(r211436)
+++ head/sys/i386/acpica/Makefile	Tue Aug 17 20:39:28 2010	(r211437)
@@ -9,7 +9,7 @@ DEPENDFILE=
 MAKESRCPATH= ${.CURDIR}
 CLEANFILES= acpi_wakecode.h acpi_wakecode.bin acpi_wakecode.o
 .endif
-.if ${CC} == "icc"
+.if ${CC:T:Micc} == "icc"
 CFLAGS+=	-restrict
 NOSTDINC=	-X
 .else


More information about the svn-src-all mailing list