xref: /freebsd/lib/libthr/Makefile (revision 783d3ff6d7fae619db8a7990b8a6387de0c677b5)
1
2PACKAGE=	clibs
3SHLIBDIR?= /lib
4
5LIBADD=	c sys
6.if defined(COMPAT_libcompat)
7# XXX: work around gcc -m32 + bfd ld path issue for DT_NEEDED symbols.
8# https://sourceware.org/bugzilla/show_bug.cgi?id=31395
9LDFLAGS+=	-Wl,--rpath=/usr/lib${COMPAT_libcompat}
10.endif
11
12.include <src.opts.mk>
13MK_SSP=	no
14
15LIB=thr
16SHLIB_MAJOR= 3
17
18NO_WTHREAD_SAFETY=1
19NO_WCAST_ALIGN.gcc=1    # for gcc 4.2
20CFLAGS+=-DPTHREAD_KERNEL
21CFLAGS+=-I${SRCTOP}/lib/libc/include
22CFLAGS+=-I${SRCTOP}/lib/libc/${MACHINE_CPUARCH}
23CFLAGS+=-I${.CURDIR}/thread
24CFLAGS+=-I${.CURDIR}/arch/${MACHINE_CPUARCH}/include
25CFLAGS+=-I${.CURDIR}/sys
26CFLAGS+=-I${SRCTOP}/libexec/rtld-elf
27CFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH}
28CFLAGS+=-I${SRCTOP}/lib/libthread_db
29
30CFLAGS.thr_stack.c+=	-Wno-cast-align
31CFLAGS.rtld_malloc.c+=	-Wno-cast-align
32CFLAGS.thr_symbols.c+=	-Wno-missing-variable-declarations
33.if ${MK_ASAN} != "no"
34# False-positive ASAN error claiming the local "struct sigaction act;" is
35# overflowed by handle_signal() reading from the ucontext_t argument. This
36# could be caused by ASAN not treating this function as a signal handler.
37CFLAGS.thr_sig.c+=	-fno-sanitize=address
38.endif
39
40.if ${MACHINE_CPUARCH} == "arm"
41NO_THREAD_UNWIND_STACK= yes
42.endif
43
44.ifndef NO_THREAD_UNWIND_STACK
45CFLAGS+=-fexceptions
46CFLAGS+=-D_PTHREAD_FORCED_UNWIND
47.endif
48
49LDFLAGS+=-Wl,-znodelete
50LDFLAGS+=-Wl,--auxiliary,libsys.so.7
51
52VERSION_DEF=${SRCTOP}/lib/libc/Versions.def
53SYMBOL_MAPS=${.CURDIR}/pthread.map
54
55MAN=	libthr.3
56
57.if ${MK_PTHREADS_ASSERTIONS} != "no"
58# enable extra internal consistency checks
59CFLAGS+=-D_PTHREADS_INVARIANTS
60.endif
61
62PRECIOUSLIB=
63
64.PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH}/${MACHINE_CPUARCH}
65.PATH: ${SRCTOP}/libexec/rtld-elf
66
67.if exists(${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc)
68.include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc"
69.endif
70.include "${.CURDIR}/sys/Makefile.inc"
71.include "${.CURDIR}/thread/Makefile.inc"
72SRCS+= rtld_malloc.c
73
74LIBSYS_SRCTOP=	${.CURDIR:H}/libsys
75.if exists(${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/_umtx_op_err.S)
76.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}
77.else
78.PATH: ${LIBSYS_SRCTOP}
79.endif
80OBJS+=	_umtx_op_err.o
81
82.if ${MK_INSTALLLIB} != "no"
83SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a
84.endif
85.if !defined(NO_PIC)
86SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so
87.endif
88.if ${MK_PROFILE} != "no"
89SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a
90.endif
91
92HAS_TESTS=
93SUBDIR.${MK_TESTS}+= tests
94
95.include <bsd.lib.mk>
96