xref: /freebsd/lib/libthr/Makefile (revision 642cd511028b8839db2c89a44cf7807d80664f38)
1bb535300SJeff Roberson# $FreeBSD$
2bb535300SJeff Roberson#
3bb535300SJeff Roberson# All library objects contain FreeBSD revision strings by default; they may be
4bb535300SJeff Roberson# excluded as a space-saving measure.  To produce a library that does
5bb535300SJeff Roberson# not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
69c4a7c50SJohn Baldwin# below.
75740a2b6SRuslan Ermilov
8c389411cSGlen BarberPACKAGE=	clibs
9241715e7SRuslan ErmilovSHLIBDIR?= /lib
10241715e7SRuslan Ermilov
11c6063d0dSWarner Losh.include <src.opts.mk>
12d9ca85fcSRuslan ErmilovMK_SSP=	no
1300fb440cSDaniel Eischen
14bb535300SJeff RobersonLIB=thr
15419ecd5dSDaniel EischenSHLIB_MAJOR= 3
166eccf6e3SEric van GyzenNO_WTHREAD_SAFETY=1
17afba14e2SEric van GyzenNO_WCAST_ALIGN.gcc=1    # for gcc 4.2
18a091d823SDavid XuCFLAGS+=-DPTHREAD_KERNEL
195d00c5a6SKonstantin BelousovCFLAGS+=-I${SRCTOP}/lib/libc/include
205d00c5a6SKonstantin BelousovCFLAGS+=-I${SRCTOP}/lib/libc/${MACHINE_CPUARCH}
215d00c5a6SKonstantin BelousovCFLAGS+=-I${.CURDIR}/thread
22f4fbf9c8SNathan WhitehornCFLAGS+=-I${.CURDIR}/arch/${MACHINE_CPUARCH}/include
23a091d823SDavid XuCFLAGS+=-I${.CURDIR}/sys
2458368ba9SEnji CooperCFLAGS+=-I${SRCTOP}/libexec/rtld-elf
2558368ba9SEnji CooperCFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH}
2658368ba9SEnji CooperCFLAGS+=-I${SRCTOP}/lib/libthread_db
273832fd24SDavid Xu
280b2f3f20SEric van GyzenCFLAGS.thr_stack.c+=	-Wno-cast-align
29d49ca25dSKonstantin BelousovCFLAGS.rtld_malloc.c+=	-Wno-cast-align
300b2f3f20SEric van GyzenCFLAGS.thr_symbols.c+=	-Wno-missing-variable-declarations
319efbe526SAlex Richardson.if ${MK_ASAN} != "no"
329efbe526SAlex Richardson# False-positive ASAN error claiming the local "struct sigaction act;" is
339efbe526SAlex Richardson# overflowed by handle_signal() reading from the ucontext_t argument. This
349efbe526SAlex Richardson# could be caused by ASAN not treating this function as a signal handler.
359efbe526SAlex RichardsonCFLAGS.thr_sig.c+=	-fno-sanitize=address
369efbe526SAlex Richardson.endif
370b2f3f20SEric van Gyzen
38bbf4df17SJohn Baldwin.if ${MACHINE_CPUARCH} == "arm"
39bbf4df17SJohn BaldwinNO_THREAD_UNWIND_STACK= yes
40bbf4df17SJohn Baldwin.endif
41bbf4df17SJohn Baldwin
42f4213b90SDavid Xu.ifndef NO_THREAD_UNWIND_STACK
430935fc89SDavid XuCFLAGS+=-fexceptions
443832fd24SDavid XuCFLAGS+=-D_PTHREAD_FORCED_UNWIND
453832fd24SDavid Xu.endif
463832fd24SDavid Xu
476d772c3bSKonstantin BelousovLDFLAGS+=-Wl,-znodelete
48a091d823SDavid Xu
4958368ba9SEnji CooperVERSION_DEF=${SRCTOP}/lib/libc/Versions.def
50a9b9744fSDag-Erling SmørgravSYMBOL_MAPS=${.CURDIR}/pthread.map
51bb535300SJeff Roberson
525335c6bcSRobert WatsonMAN=	libthr.3
535335c6bcSRobert Watson
54*642cd511SGreg Becker.if ${MK_PTHREADS_ASSERTIONS} != "no"
55e13c6045SKonstantin Belousov# enable extra internal consistency checks
5644a31c2dSDavid XuCFLAGS+=-D_PTHREADS_INVARIANTS
57*642cd511SGreg Becker.endif
58bb535300SJeff Roberson
59a35d8893SRuslan ErmilovPRECIOUSLIB=
60bb535300SJeff Roberson
6110f3ae58SWarner Losh.PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH}/${MACHINE_CPUARCH}
62381c2d2eSKonstantin Belousov.PATH: ${SRCTOP}/libexec/rtld-elf
6310f3ae58SWarner Losh
6420fe2c94SAndrew Turner.if exists(${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc)
65f4fbf9c8SNathan Whitehorn.include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc"
6620fe2c94SAndrew Turner.endif
67a091d823SDavid Xu.include "${.CURDIR}/sys/Makefile.inc"
68a091d823SDavid Xu.include "${.CURDIR}/thread/Makefile.inc"
69d49ca25dSKonstantin BelousovSRCS+= rtld_malloc.c
70bb535300SJeff Roberson
71455cc6ecSJung-uk Kim.if ${MK_INSTALLLIB} != "no"
7255ac4c35SDavid XuSYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a
73455cc6ecSJung-uk Kim.endif
7455ac4c35SDavid Xu.if !defined(NO_PIC)
7584e709f1SRuslan ErmilovSYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so
7655ac4c35SDavid Xu.endif
775740a2b6SRuslan Ermilov.if ${MK_PROFILE} != "no"
7855ac4c35SDavid XuSYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a
7955ac4c35SDavid Xu.endif
8055ac4c35SDavid Xu
81d511b20aSEnji CooperHAS_TESTS=
824b330699SEnji CooperSUBDIR.${MK_TESTS}+= tests
833eee258dSEnji Cooper
84bb535300SJeff Roberson.include <bsd.lib.mk>
85