1# $OpenBSD: Makefile,v 1.3 2024/01/26 11:51:45 robert Exp $ 2 3.include <bsd.own.mk> 4 5USE_UNWIND=no 6.if ${COMPILER_VERSION} == "clang" 7USE_UNWIND=yes 8.endif 9 10LIB=execinfo 11SRCS=backtrace.c 12MAN= backtrace.3 13 14.if empty(CFLAGS:M-std=*) 15CFLAGS+= -std=gnu99 16.endif 17 18.if ${USE_UNWIND} == "yes" 19.PATH: ${SRCDIR} ${BSDSRCDIR}/gnu/llvm/libunwind/src 20.PATH: ${SRCDIR} ${BSDSRCDIR}/gnu/llvm/libcxx/src 21CXXFLAGS+= -I${BSDSRCDIR}/gnu/llvm/libunwind/include \ 22 -I${BSDSRCDIR}/gnu/lib/libcxx/include/c++/v1/ \ 23 -I${BSDSRCDIR}/gnu/llvm/libcxx/include 24CFLAGS+= -I${BSDSRCDIR}/gnu/llvm/libunwind/include 25 26CPPFLAGS+= -D_LIBUNWIND_IS_NATIVE_ONLY 27CPPFLAGS+= -DLIBUNWIND_USE_WEAK_PTHREAD 28CPPFLAGS+= -DNDEBUG 29CXXFLAGS+= -nostdlib -nostdinc++ -funwind-tables \ 30 -fno-exceptions -fno-rtti 31.if empty(CXXFLAGS:M-std=*) 32CXXFLAGS+= -std=c++20 33.endif 34 35SRCS+=unwind.c \ 36 Unwind-EHABI.cpp \ 37 Unwind-sjlj.c \ 38 UnwindLevel1-gcc-ext.c \ 39 UnwindLevel1.c \ 40 UnwindRegistersRestore.S \ 41 UnwindRegistersSave.S \ 42 libunwind.cpp \ 43 new.cpp 44 45.else # !${USE_UNWIND} 46SRCS+=builtin.c 47.endif 48 49VERSION_SCRIPT= ${.CURDIR}/Symbols.map 50 51includes: 52 cmp -s ${DESTDIR}/usr/include/execinfo.h ${.CURDIR}/execinfo.h || \ 53 ${INSTALL} ${INSTALL_COPY} -m 444 -o $(BINOWN) -g $(BINGRP) \ 54 ${.CURDIR}/execinfo.h ${DESTDIR}/usr/include/execinfo.h 55 56.include <bsd.lib.mk> 57