xref: /freebsd/lib/libthr/Makefile (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
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
15NO_WTHREAD_SAFETY=1
16NO_WCAST_ALIGN.gcc=1    # for gcc 4.2
17CFLAGS+=-DPTHREAD_KERNEL
18CFLAGS+=-I${SRCTOP}/lib/libc/include
19CFLAGS+=-I${SRCTOP}/lib/libc/${MACHINE_CPUARCH}
20CFLAGS+=-I${.CURDIR}/thread
21CFLAGS+=-I${.CURDIR}/arch/${MACHINE_CPUARCH}/include
22CFLAGS+=-I${.CURDIR}/sys
23CFLAGS+=-I${SRCTOP}/libexec/rtld-elf
24CFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH}
25CFLAGS+=-I${SRCTOP}/lib/libthread_db
26
27CFLAGS.thr_stack.c+=	-Wno-cast-align
28CFLAGS.rtld_malloc.c+=	-Wno-cast-align
29CFLAGS.thr_symbols.c+=	-Wno-missing-variable-declarations
30.if ${MK_ASAN} != "no"
31# False-positive ASAN error claiming the local "struct sigaction act;" is
32# overflowed by handle_signal() reading from the ucontext_t argument. This
33# could be caused by ASAN not treating this function as a signal handler.
34CFLAGS.thr_sig.c+=	-fno-sanitize=address
35.endif
36
37.if ${MACHINE_CPUARCH} == "arm"
38NO_THREAD_UNWIND_STACK= yes
39.endif
40
41.ifndef NO_THREAD_UNWIND_STACK
42CFLAGS+=-fexceptions
43CFLAGS+=-D_PTHREAD_FORCED_UNWIND
44.endif
45
46LDFLAGS+=-Wl,-znodelete
47
48VERSION_DEF=${SRCTOP}/lib/libc/Versions.def
49SYMBOL_MAPS=${.CURDIR}/pthread.map
50
51MAN=	libthr.3
52
53.if ${MK_PTHREADS_ASSERTIONS} != "no"
54# enable extra internal consistency checks
55CFLAGS+=-D_PTHREADS_INVARIANTS
56.endif
57
58PRECIOUSLIB=
59
60.PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH}/${MACHINE_CPUARCH}
61.PATH: ${SRCTOP}/libexec/rtld-elf
62
63.if exists(${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc)
64.include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc"
65.endif
66.include "${.CURDIR}/sys/Makefile.inc"
67.include "${.CURDIR}/thread/Makefile.inc"
68SRCS+= rtld_malloc.c
69
70.if ${MK_INSTALLLIB} != "no"
71SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a
72.endif
73.if !defined(NO_PIC)
74SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so
75.endif
76.if ${MK_PROFILE} != "no"
77SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a
78.endif
79
80HAS_TESTS=
81SUBDIR.${MK_TESTS}+= tests
82
83.include <bsd.lib.mk>
84