xref: /freebsd/lib/libcxxrt/Makefile (revision 255538cd906045095d0c2113ae6c4731ce36c0cf)
1PACKAGE=	clibs
2SHLIBDIR?=	/lib
3
4.include <src.opts.mk>
5
6SRCDIR=		${SRCTOP}/contrib/libcxxrt
7
8SHLIB_MAJOR=	1
9
10.PATH: ${SRCDIR}
11
12LIB=		cxxrt
13
14SRCS+=		auxhelper.cc
15SRCS+=		dynamic_cast.cc
16SRCS+=		exception.cc
17SRCS+=		guard.cc
18SRCS+=		libelftc_dem_gnu3.c
19SRCS+=		memory.cc
20SRCS+=		stdexcept.cc
21SRCS+=		terminate.cc
22SRCS+=		typeinfo.cc
23
24WARNS?=		0
25CFLAGS+=	-isystem ${SRCDIR} -nostdinc++
26
27.if exists(Version.map.${MACHINE})
28VERSION_MAP=	${.CURDIR}/Version.map.${MACHINE}
29.else
30.if ${MACHINE_ABI:Mlong32}
31VERSION_MAP=	Version-32.map
32.else
33VERSION_MAP=	Version-64.map
34.endif
35
36# On powerpc64le long double is IEEE binary128, which clang mangles as
37# u9__ieee128 ("__ieee128" demangled) instead of the generic "long double" (e).
38# Rewrite the typeinfo entries so the version script matches the emitted symbols.
39LDBL_SED=
40.if ${MACHINE_ARCH} == "powerpc64le"
41LDBL_SED=	-e 's/long double/__ieee128/g'
42.endif
43
44Version-32.map: Version.map
45	sed -e 's/%%NEW_DELETE_TYPE%%/int/' ${LDBL_SED} ${.ALLSRC} > ${.TARGET}
46
47Version-64.map: Version.map
48	sed -e 's/%%NEW_DELETE_TYPE%%/long/' ${LDBL_SED} ${.ALLSRC} > ${.TARGET}
49.endif
50
51.include <bsd.lib.mk>
52
53# gcc13 doesn't support _Float16 on riscv, powerpc64, and x86 or __int128
54# on i386.  Disable checks for missing symbols to allow this to link.
55#
56# XXX: This is a hack that hides an ABI divergence between clang and gcc.
57.if ${COMPILER_TYPE} == "gcc" && \
58    (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \
59     ${MACHINE_ARCH:Mpowerpc64*} || ${MACHINE_ARCH} == "riscv64")
60LDFLAGS+=	-Wl,--undefined-version
61.endif
62