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