1# $NetBSD: Makefile,v 1.17 2023/08/03 01:36:55 mrg Exp $
2
3UNSUPPORTED_COMPILER.clang=     # defined
4NOSANITIZER=    # defined
5NOCOMPAT=	# defined
6
7.include <bsd.own.mk>
8
9.include "../Makefile.inc"
10.include "../Makefile.sanitizer"
11
12.PATH: ${SANITIZER}/tsan
13
14# XXXmknative
15TSAN_SRCS= \
16	tsan_clock.cpp \
17	tsan_debugging.cpp \
18	tsan_external.cpp \
19	tsan_fd.cpp \
20	tsan_flags.cpp \
21	tsan_ignoreset.cpp \
22	tsan_interceptors_posix.cpp \
23	tsan_interceptors_mac.cpp \
24	tsan_interface_ann.cpp \
25	tsan_interface_atomic.cpp \
26	tsan_interface.cpp \
27	tsan_interface_java.cpp \
28	tsan_malloc_mac.cpp \
29	tsan_md5.cpp \
30	tsan_mman.cpp \
31	tsan_mutexset.cpp \
32	tsan_new_delete.cpp \
33	tsan_platform_linux.cpp \
34	tsan_platform_mac.cpp \
35	tsan_platform_posix.cpp \
36	tsan_platform_windows.cpp \
37	tsan_report.cpp \
38	tsan_rtl.cpp \
39	tsan_rtl_access.cpp \
40	tsan_rtl_mutex.cpp \
41	tsan_rtl_proc.cpp \
42	tsan_rtl_report.cpp \
43	tsan_rtl_thread.cpp \
44	tsan_stack_trace.cpp \
45	tsan_suppressions.cpp \
46	tsan_symbolize.cpp \
47	tsan_sync.cpp \
48	tsan_vector_clock.cpp
49
50.if ${MACHINE_ARCH} == "x86_64"
51TSAN_SRCS+= tsan_rtl_amd64.S
52.elif ${MACHINE_CPU} == "aarch64"
53TSAN_SRCS+= tsan_rtl_aarch64.S
54.elif ${MACHINE_MIPS64}
55TSAN_SRCS+= tsan_rtl_mips64.S
56.elif ${MACHINE_ARCH} == "powerpc64"
57TSAN_SRCS+= tsan_rtl_ppc64.S
58.else
59.error Unsupported
60.endif
61
62LIB=	tsan
63SRCS+=	${TSAN_SRCS}
64LIBDPLIBS+= rt ${NETBSDSRCDIR}/lib/librt
65LIBDPLIBS+= m  ${NETBSDSRCDIR}/lib/libm
66LIBDPLIBS+= pthread ${NETBSDSRCDIR}/lib/libpthread
67CPPFLAGS+=-DCAN_SANITIZE_UB=0
68COPTS.tsan_interceptors.cpp += -Wno-unused-function
69
70.include <bsd.lib.mk>
71