xref: /freebsd/lib/libthr/Makefile (revision 66fd12cf4896eb08ad8e7a2627537f84ead84dd3)
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${.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
48
49VERSION_DEF=${SRCTOP}/lib/libc/Versions.def
50SYMBOL_MAPS=${.CURDIR}/pthread.map
51
52MAN=	libthr.3
53
54.if ${MK_PTHREADS_ASSERTIONS} != "no"
55# enable extra internal consistency checks
56CFLAGS+=-D_PTHREADS_INVARIANTS
57.endif
58
59PRECIOUSLIB=
60
61.PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH}/${MACHINE_CPUARCH}
62.PATH: ${SRCTOP}/libexec/rtld-elf
63
64.if exists(${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc)
65.include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc"
66.endif
67.include "${.CURDIR}/sys/Makefile.inc"
68.include "${.CURDIR}/thread/Makefile.inc"
69SRCS+= rtld_malloc.c
70
71.if ${MK_INSTALLLIB} != "no"
72SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a
73.endif
74.if !defined(NO_PIC)
75SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so
76.endif
77.if ${MK_PROFILE} != "no"
78SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a
79.endif
80
81HAS_TESTS=
82SUBDIR.${MK_TESTS}+= tests
83
84.include <bsd.lib.mk>
85