xref: /openbsd-src/gnu/lib/libcxxabi/Makefile (revision 3bef86f7bc2197c76d5fec5b22e91f84e96ed5e5)
1# $OpenBSD: Makefile,v 1.5 2024/01/26 11:51:45 robert Exp $
2
3.include <bsd.own.mk>
4
5.if ${COMPILER_VERSION:L} != "clang"
6CC=		clang
7CXX=		clang++
8.endif
9
10.if ${BUILD_CLANG:L} == "yes"
11
12HDRDIR=		${.CURDIR}/../../../gnu/llvm/libcxxabi/include
13SRCDIR=		${.CURDIR}/../../../gnu/llvm/libcxxabi/src
14SHDRDIR=	${.CURDIR}/../../../gnu/llvm/libcxx/include
15SSHDRDIR=	${.CURDIR}/../../../gnu/llvm/libcxx/src/include
16UHDRDIR=	${.CURDIR}/../../../gnu/llvm/libunwind/include
17CXXINCLUDEDIR=	/usr/include/c++/v1
18
19LOCALHDRDIR=    ${.CURDIR}/../libcxx/include/c++/v1
20
21.PATH: ${SRCDIR} ${.CURDIR}/../../../gnu/llvm/libunwind/src
22
23LIB=		c++abi
24
25
26SRCS+=		abort_message.cpp \
27		cxa_aux_runtime.cpp \
28		cxa_default_handlers.cpp \
29		cxa_demangle.cpp \
30		cxa_exception.cpp \
31		cxa_exception_storage.cpp \
32		cxa_guard.cpp \
33		cxa_handlers.cpp \
34		cxa_personality.cpp \
35		cxa_thread_atexit.cpp \
36		cxa_vector.cpp \
37		cxa_virtual.cpp \
38		fallback_malloc.cpp \
39		private_typeinfo.cpp \
40		stdlib_exception.cpp \
41		stdlib_new_delete.cpp \
42		stdlib_stdexcept.cpp \
43		stdlib_typeinfo.cpp \
44		Unwind-EHABI.cpp \
45		Unwind-sjlj.c \
46		UnwindLevel1-gcc-ext.c \
47		UnwindLevel1.c \
48		UnwindRegistersRestore.S \
49		UnwindRegistersSave.S \
50		libunwind.cpp
51
52CPPFLAGS+=	-Wall -I${SHDRDIR} -I${HDRDIR} -I${UHDRDIR} \
53		-I${LOCALHDRDIR} -I${SHDRDIR}/../ -I${SSHDRDIR}/../
54CPPFLAGS+=	-D_LIBUNWIND_IS_NATIVE_ONLY
55CPPFLAGS+=	-D_LIBCXXABI_BUILDING_LIBRARY
56CPPFLAGS+=	-D_LIBCPP_BUILDING_LIBRARY
57CPPFLAGS+=	-DNDEBUG
58CFLAGS+=	-nostdlib -funwind-tables
59CXXFLAGS+=	-nostdlib -nostdinc++ -funwind-tables
60.if empty(CXXFLAGS:M-std=*)
61CXXFLAGS+=	-std=c++20
62.endif
63
64STD_HEADERS=	cxxabi.h \
65		__cxxabi_config.h
66
67.for hdr in ${STD_HEADERS}
68STD+=		${hdr} ${HDRDIR}/${hdr}
69.endfor
70STDDIR=		${CXXINCLUDEDIR}
71
72STD_UHEADERS=	libunwind.h \
73		__libunwind_config.h \
74		unwind.h \
75		unwind_arm_ehabi.h \
76		unwind_itanium.h
77
78.for hdr in ${STD_UHEADERS}
79USTD+=		${hdr} ${UHDRDIR}/${hdr}
80.endfor
81USTDDIR=	${CXXINCLUDEDIR}
82
83MACHO_HEADERS=compact_unwind_encoding.h
84
85.for hdr in ${MACHO_HEADERS}
86MACHO+=		${hdr} ${UHDRDIR}/mach-o/${hdr}
87.endfor
88MACHODIR=	${CXXINCLUDEDIR}/mach-o
89
90includes:
91	@echo installing ${STD_HEADERS}
92	${INSTALL} -d -m 755 ${DESTDIR}/${STDDIR};
93.	for hdr src in ${STD}
94		cmp -s ${src} ${DESTDIR}/${STDDIR}/${hdr} || \
95		${INSTALL} ${INSTALL_COPY} -m 444 ${src} ${DESTDIR}/${STDDIR}/${hdr};
96.	endfor
97	${INSTALL} -d -m 755 ${DESTDIR}/${USTDDIR};
98.	for hdr src in ${USTD}
99		cmp -s ${src} ${DESTDIR}/${USTDDIR}/${hdr} || \
100		${INSTALL} ${INSTALL_COPY} -m 444 ${src} ${DESTDIR}/${USTDDIR}/${hdr};
101.	endfor
102	${INSTALL} -d -m 755 ${DESTDIR}/${MACHODIR};
103.	for hdr src in ${MACHO}
104		cmp -s ${src} ${DESTDIR}/${MACHODIR}/${hdr} || \
105		${INSTALL} ${INSTALL_COPY} -m 444 ${src} ${DESTDIR}/${MACHODIR}/${hdr};
106.	endfor
107
108.include <bsd.lib.mk>
109
110.else
111NOPROG=
112.include <bsd.prog.mk>
113.endif
114