On 2011-10-23 18:27, Robert Millan wrote:
Author: rmh
Date: Sun Oct 23 16:27:03 2011
New Revision: 226665
URL: http://svn.freebsd.org/changeset/base/226665

Log:
   Conditionalize a pair of FreeBSD GCC extensions so that its CFLAGS are only
   used with FreeBSD GCC.

   Approved by: kib (mentor)

Modified:
   head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==============================================================================
--- head/sys/conf/kern.mk       Sun Oct 23 16:04:07 2011        (r226664)
+++ head/sys/conf/kern.mk       Sun Oct 23 16:27:03 2011        (r226665)
@@ -1,11 +1,21 @@
  # $FreeBSD$

+.if ${CC:T:Mclang} != "clang"
+FREEBSD_GCC!=  ${CC} --version | grep FreeBSD || true
+.endif
+
  #
  # Warning flags for compiling the kernel and components of the kernel:
  #
+.if ${FREEBSD_GCC}
+# FreeBSD extensions, not available in upstream GCC
+format_extensions=     -fformat-extensions
+no_align_long_strings= -mno-align-long-strings
+.endif

Note: this breaks builds where CC=clang, with:

Kernel build for GENERIC started on Sun Oct 23 22:01:23 CEST 2011
...
stage 2.1: cleaning up the object tree
--------------------------------------------------------------
cd /usr/obj/usr/src/sys/GENERIC; MAKEOBJDIRPREFIX=/usr/obj  MACHINE_ARCH=i386  MACHINE=i386  
CPUTYPE= GROFF_BIN_PATH=/usr/obj/usr/src/tmp/legacy/usr/bin  
GROFF_FONT_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/groff_font  
GROFF_TMAC_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/tmac  _SHLIBDIRPREFIX=/usr/obj/usr/src/tmp  
VERSION="FreeBSD 10.0-CURRENT i386 1000000"  INSTALL="sh 
/usr/src/tools/install.sh"  
PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin
 make KERNEL=kernel cleandir
"/usr/src/sys/conf/kern.mk", line 10: Malformed conditional (${FREEBSD_GCC})
"/usr/src/sys/conf/kern.mk", line 14: if-less endif
make: fatal errors encountered -- cannot continue
*** Error code 1
1 error
*** Error code 2
1 error
Exited
Process exited with status 2

Since our base 'clang --version' also has 'FreeBSD' in its output, you
might want to drop the first .if ${CC:T:Mclang} != "clang" test.  E.g.
just unconditionally set the FREEBSD_GCC macro (although it's then no
longer correctly named, but that aside).
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to