From e3b702d33cc4aafaca8e3956d9e6e5e6926eb463 Mon Sep 17 00:00:00 2001 From: dim Date: Sat, 8 Sep 2012 11:34:22 +0000 Subject: [PATCH] MFC r239680: Add libcxxrt's objects (prefixing them with cxxrt_ to avoid collisions) to libc++.a and libc++_p.a, to make static linking of C++ executables with libc++ easier. This is similar to the approach used in libstdc++. MFC r239686: When using -stdlib=libc++, add the correct dependency to .depend in bsd.prog.mk. Submitted by: Yamaya Takashi MFC r239695: For building libstdc++ and libsupc++, filter out any -stdlib=libc++ option from CXXFLAGS, otherwise these libraries will not build. Similarly, filter out any -std=xxx options that aren't supported. Submitted by: Yamaya Takashi git-svn-id: svn://svn.freebsd.org/base/stable/9@240236 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- gnu/lib/libstdc++/Makefile | 1 + gnu/lib/libsupc++/Makefile | 1 + lib/libc++/Makefile | 19 ++++++++++++++++++- share/mk/bsd.prog.mk | 4 ++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gnu/lib/libstdc++/Makefile b/gnu/lib/libstdc++/Makefile index c3734429d..14bb04191 100644 --- a/gnu/lib/libstdc++/Makefile +++ b/gnu/lib/libstdc++/Makefile @@ -22,6 +22,7 @@ CFLAGS+= -I${GCCLIB}/include -I${SRCDIR}/include -I. CFLAGS+= -frandom-seed=RepeatabilityConsideredGood CXXFLAGS+= -fno-implicit-templates -ffunction-sections -fdata-sections \ -Wno-deprecated +CXXFLAGS:= ${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]} PO_CXXFLAGS= ${CXXFLAGS:N-ffunction-sections} DPADD= ${LIBM} diff --git a/gnu/lib/libsupc++/Makefile b/gnu/lib/libsupc++/Makefile index a65198970..76fa1018c 100644 --- a/gnu/lib/libsupc++/Makefile +++ b/gnu/lib/libsupc++/Makefile @@ -24,6 +24,7 @@ CFLAGS+= -I${GCCLIB}/include -I${SRCDIR} -I${GCCDIR} CFLAGS+= -I${.CURDIR}/../libstdc++ -I. CFLAGS+= -frandom-seed=RepeatabilityConsideredGood CXXFLAGS+= -fno-implicit-templates -ffunction-sections -fdata-sections +CXXFLAGS:= ${CXXFLAGS:N-stdlib=libc++:N-std=c++[01][13x]:N-std=gnu++[01][13x]} PO_CXXFLAGS= ${CXXFLAGS:N-ffunction-sections} HDRS= exception new typeinfo cxxabi.h exception_defines.h diff --git a/lib/libc++/Makefile b/lib/libc++/Makefile index 1c65cc385..6e9582367 100644 --- a/lib/libc++/Makefile +++ b/lib/libc++/Makefile @@ -35,8 +35,25 @@ SRCS+= algorithm.cpp\ utility.cpp\ valarray.cpp +CXXRT_SRCS+= libelftc_dem_gnu3.c\ + terminate.cc\ + dynamic_cast.cc\ + memory.cc\ + auxhelper.cc\ + exception.cc\ + stdexcept.cc\ + typeinfo.cc\ + guard.cc + +.for _S in ${CXXRT_SRCS} +STATICOBJS+= cxxrt_${_S:R}.o +cxxrt_${_S}: + ln -sf ${LIBCXXRTDIR}/${_S} ${.TARGET} +.endfor + WARNS= 0 -CXXFLAGS+= -I${HDRDIR} -I${LIBCXXRTDIR} -std=c++0x -nostdlib -DLIBCXXRT +CFLAGS+= -I${HDRDIR} -I${LIBCXXRTDIR} -nostdlib -DLIBCXXRT +CXXFLAGS+= -std=c++0x DPADD= ${LIBCXXRT} LDADD= -lcxxrt diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index e71ce01cd..f7c80fb32 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -131,10 +131,14 @@ _EXTRADEPEND: .else echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE} .if defined(PROG_CXX) +.if !empty(CXXFLAGS:M-stdlib=libc++) + echo ${PROG}: ${LIBCPLUSPLUS} >> ${DEPENDFILE} +.else echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE} .endif .endif .endif +.endif .if !target(install) -- 2.45.0