On Fri, Jul 18, 2014 at 12:10:25AM +1000, Jonathan Gray wrote:
> sys.mk automatically gets included by make(1) and sets CXXFLAGS to
> CFLAGS. If a Makefile defines additional CFLAGS they will then be
> passed to the C++ compiler. Which creates problems with flags
> that should only be used by the C compiler in Makefiles that
> deal with both C and C++ (like Mesa).
>
> Fix this situation by not initialising CXXFLAGS with CFLAGS.
> No problems building src/xenocara with the following diff:
Here is the diff again. If there are concerns on the ports
side could someone doing ports bulk builds give this a try?
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /cvs/src/share/mk/bsd.lib.mk,v
retrieving revision 1.71
diff -u -p -r1.71 bsd.lib.mk
--- share/mk/bsd.lib.mk 15 Oct 2013 22:40:00 -0000 1.71
+++ share/mk/bsd.lib.mk 16 Jul 2014 13:46:45 -0000
@@ -30,6 +30,7 @@ SHLIB_MINOR=${minor}
.if defined(NOPIE)
CFLAGS+= ${NOPIE_FLAGS}
+CXXFLAGS+= ${NOPIE_FLAGS}
AFLAGS+= ${NOPIE_FLAGS}
.endif
Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /cvs/src/share/mk/bsd.prog.mk,v
retrieving revision 1.66
diff -u -p -r1.66 bsd.prog.mk
--- share/mk/bsd.prog.mk 23 Dec 2014 16:35:53 -0000 1.66
+++ share/mk/bsd.prog.mk 28 Dec 2014 07:15:08 -0000
@@ -12,6 +12,7 @@
.if (defined(LDSTATIC) && !defined(STATICPIE)) || defined(NOPIE)
CFLAGS+= ${NOPIE_FLAGS}
+CXXFLAGS+= ${NOPIE_FLAGS}
AFLAGS+= ${NOPIE_FLAGS}
LDFLAGS+= ${NOPIE_LDFLAGS}
.endif
Index: share/mk/sys.mk
===================================================================
RCS file: /cvs/src/share/mk/sys.mk,v
retrieving revision 1.71
diff -u -p -r1.71 sys.mk
--- share/mk/sys.mk 1 Jan 2015 15:50:27 -0000 1.71
+++ share/mk/sys.mk 4 Jan 2015 13:18:26 -0000
@@ -39,7 +39,7 @@ LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${L
HOSTCC?= cc
CXX?= c++
-CXXFLAGS?= ${CFLAGS}
+CXXFLAGS?= -O2 ${PIPE} ${DEBUG}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
Index: gnu/lib/libstdc++-v3/Makefile
===================================================================
RCS file: /cvs/src/gnu/lib/libstdc++-v3/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- gnu/lib/libstdc++-v3/Makefile 21 Jun 2013 17:07:30 -0000 1.7
+++ gnu/lib/libstdc++-v3/Makefile 17 Jul 2014 06:28:16 -0000
@@ -7,13 +7,14 @@ GCC_TARGET= ${MACHINE_ARCH}-unknown-open
LIB= stdc++
-CFLAGS+= -DIN_GLIBCPP_V3 -DHAVE_CONFIG_H
+CPPFLAGS+= -DIN_GLIBCPP_V3 -DHAVE_CONFIG_H
.if ${MACHINE_ARCH} == "arm"
-CFLAGS+= -D_GLIBCXX_SJLJ_EXCEPTIONS=1
+CPPFLAGS+= -D_GLIBCXX_SJLJ_EXCEPTIONS=1
.endif
-CFLAGS+= -I${.CURDIR} -I${SUPDIR} -I${GCCDIR} -I${SRCDIR}/include
-CFLAGS+= -I${GCCLIB}/include -I${SRCDIR}/include
-I${.CURDIR}/../libiberty/include -I.
+CPPFLAGS+= -I${.CURDIR} -I${SUPDIR} -I${GCCDIR} -I${SRCDIR}/include
+CPPFLAGS+= -I${GCCLIB}/include -I${SRCDIR}/include
-I${.CURDIR}/../libiberty/include -I.
CFLAGS+= -frandom-seed=RepeatabilityConsideredGood
+CXXFLAGS+= -frandom-seed=RepeatabilityConsideredGood
CXXFLAGS+= -fno-implicit-templates -ffunction-sections -fdata-sections \
-Wno-deprecated
Index: gnu/lib/libstdc++-v3/Makefile.common
===================================================================
RCS file: /cvs/src/gnu/lib/libstdc++-v3/Makefile.common,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile.common
--- gnu/lib/libstdc++-v3/Makefile.common 16 May 2010 13:22:58 -0000
1.3
+++ gnu/lib/libstdc++-v3/Makefile.common 17 Jul 2014 06:57:22 -0000
@@ -10,10 +10,11 @@ SUPDIR= ${SRCDIR}/libsupc++
${SRCDIR}/include ${SUPDIR} ${.CURDIR}/../libiberty/src \
${.CURDIR}/../libstdc++-v3/obj
-CFLAGS+= -DIN_GLIBCPP_V3 -DHAVE_CONFIG_H
-CFLAGS+= -I${.CURDIR}/../libstdc++-v3/ -I${SUPDIR} -I${GCCDIR}
-I${SRCDIR}/include
-CFLAGS+= -I${GCCLIB}/include -I${SRCDIR}/include
-I${.CURDIR}/../libiberty/include -I.
+CPPFLAGS+= -DIN_GLIBCPP_V3 -DHAVE_CONFIG_H
+CPPFLAGS+= -I${.CURDIR}/../libstdc++-v3/ -I${SUPDIR} -I${GCCDIR}
-I${SRCDIR}/include
+CPPFLAGS+= -I${GCCLIB}/include -I${SRCDIR}/include
-I${.CURDIR}/../libiberty/include -I.
CFLAGS+= -frandom-seed=RepeatabilityConsideredGood
+CXXFLAGS+= -frandom-seed=RepeatabilityConsideredGood
CXXFLAGS+= -fno-implicit-templates -ffunction-sections -fdata-sections \
-Wno-deprecated
Index: gnu/lib/libsupc++-v3/Makefile
===================================================================
RCS file: /cvs/src/gnu/lib/libsupc++-v3/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- gnu/lib/libsupc++-v3/Makefile 18 Jul 2011 18:32:47 -0000 1.3
+++ gnu/lib/libsupc++-v3/Makefile 17 Jul 2014 06:56:26 -0000
@@ -9,11 +9,12 @@ LIB= supc++
SRCS= ${SUPSRCS}
.if ${MACHINE_ARCH} == "arm"
-CFLAGS+= -D_GLIBCXX_SJLJ_EXCEPTIONS=1
+CPPFLAGS+= -D_GLIBCXX_SJLJ_EXCEPTIONS=1
.endif
# Build a standard .a lib with PIC objects
NOPIC=
CFLAGS+= ${PICFLAG}
+CXXFLAGS+= ${PICFLAG}
.include <bsd.lib.mk>