From cecf84d49f7f825447f22f0c7d1dd3bec987a04f Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 14 May 2015 02:56:01 +0000 Subject: [PATCH] Stop including CFLAGS in CXXFLAGS it creates problems when mixing C and C++ when wanting to pass flags to only the C compiler. Tested in a ports bulk build by naddy and the handful of problems found were fixed by naddy, jca and pascal. --- gnu/lib/libstdc++-v3/Makefile | 11 ++++++----- gnu/lib/libstdc++-v3/Makefile.common | 9 +++++---- gnu/lib/libsupc++-v3/Makefile | 5 +++-- share/mk/bsd.lib.mk | 3 ++- share/mk/bsd.prog.mk | 3 ++- share/mk/sys.mk | 4 ++-- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/gnu/lib/libstdc++-v3/Makefile b/gnu/lib/libstdc++-v3/Makefile index 050d73c1252..de544bb2cea 100644 --- a/gnu/lib/libstdc++-v3/Makefile +++ b/gnu/lib/libstdc++-v3/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/gnu/lib/libstdc++/Makefile,v 1.63.2.1 2009/08/03 08:13:06 kensmith Exp $ -# $OpenBSD: Makefile,v 1.7 2013/06/21 17:07:30 robert Exp $ +# $OpenBSD: Makefile,v 1.8 2015/05/14 02:56:01 jsg Exp $ .include "${.CURDIR}/Makefile.common" @@ -7,13 +7,14 @@ GCC_TARGET= ${MACHINE_ARCH}-unknown-openbsd${OSREV} 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 diff --git a/gnu/lib/libstdc++-v3/Makefile.common b/gnu/lib/libstdc++-v3/Makefile.common index ca592374297..53551158838 100644 --- a/gnu/lib/libstdc++-v3/Makefile.common +++ b/gnu/lib/libstdc++-v3/Makefile.common @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.common,v 1.3 2010/05/16 13:22:58 espie Exp $ +# $OpenBSD: Makefile.common,v 1.4 2015/05/14 02:56:01 jsg Exp $ GCCDIR= ${.CURDIR}/../../gcc/gcc GCCLIB= ${GCCDIR}/gcc @@ -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 diff --git a/gnu/lib/libsupc++-v3/Makefile b/gnu/lib/libsupc++-v3/Makefile index 15bd0f60459..08ebd18c00d 100644 --- a/gnu/lib/libsupc++-v3/Makefile +++ b/gnu/lib/libsupc++-v3/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2011/07/18 18:32:47 matthieu Exp $ +# $OpenBSD: Makefile,v 1.4 2015/05/14 02:56:01 jsg Exp $ .include "${.CURDIR}/../libstdc++-v3/Makefile.common" @@ -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 diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 18683c26a06..a06fce6d360 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.lib.mk,v 1.71 2013/10/15 22:40:00 deraadt Exp $ +# $OpenBSD: bsd.lib.mk,v 1.72 2015/05/14 02:56:01 jsg Exp $ # $NetBSD: bsd.lib.mk,v 1.67 1996/01/17 20:39:26 mycroft Exp $ # @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 @@ -30,6 +30,7 @@ SHLIB_MINOR=${minor} .if defined(NOPIE) CFLAGS+= ${NOPIE_FLAGS} +CXXFLAGS+= ${NOPIE_FLAGS} AFLAGS+= ${NOPIE_FLAGS} .endif diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 88e89f3bde1..835e032b102 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -1,4 +1,4 @@ -# $OpenBSD: bsd.prog.mk,v 1.66 2014/12/23 16:35:53 deraadt Exp $ +# $OpenBSD: bsd.prog.mk,v 1.67 2015/05/14 02:56:01 jsg Exp $ # $NetBSD: bsd.prog.mk,v 1.55 1996/04/08 21:19:26 jtc Exp $ # @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 @@ -12,6 +12,7 @@ .if (defined(LDSTATIC) && !defined(STATICPIE)) || defined(NOPIE) CFLAGS+= ${NOPIE_FLAGS} +CXXFLAGS+= ${NOPIE_FLAGS} AFLAGS+= ${NOPIE_FLAGS} LDFLAGS+= ${NOPIE_LDFLAGS} .endif diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 80b368a5c2f..a1eaaceee30 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -1,4 +1,4 @@ -# $OpenBSD: sys.mk,v 1.71 2015/01/01 15:50:27 deraadt Exp $ +# $OpenBSD: sys.mk,v 1.72 2015/05/14 02:56:01 jsg Exp $ # $NetBSD: sys.mk,v 1.27 1996/04/10 05:47:19 mycroft Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -39,7 +39,7 @@ LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} HOSTCC?= cc CXX?= c++ -CXXFLAGS?= ${CFLAGS} +CXXFLAGS?= -O2 ${PIPE} ${DEBUG} COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} -- 2.20.1