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