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