1 2PACKAGE= clibs 3SHLIBDIR?= /lib 4 5LIBADD= c sys 6.if defined(COMPAT_libcompat) 7# XXX: work around gcc -m32 + bfd ld path issue for DT_NEEDED symbols. 8# https://sourceware.org/bugzilla/show_bug.cgi?id=31395 9LDFLAGS+= -Wl,--rpath=/usr/lib${COMPAT_libcompat} 10.endif 11 12.include <src.opts.mk> 13MK_SSP= no 14# SSP forced off already implies FORTIFY_SOURCE=0, but we must make sure that 15# one cannot turn it back on. 16FORTIFY_SOURCE= 0 17 18LIB=thr 19SHLIB_MAJOR= 3 20 21NO_WTHREAD_SAFETY=1 22NO_WCAST_ALIGN.gcc=1 # for gcc 4.2 23CFLAGS+=-DPTHREAD_KERNEL 24CFLAGS+=-I${SRCTOP}/lib/libc/include 25CFLAGS+=-I${SRCTOP}/lib/libc/${MACHINE_CPUARCH} 26CFLAGS+=-I${.CURDIR}/thread 27CFLAGS+=-I${.CURDIR}/arch/${MACHINE_CPUARCH}/include 28CFLAGS+=-I${.CURDIR}/sys 29CFLAGS+=-I${SRCTOP}/libexec/rtld-elf 30CFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH} 31CFLAGS+=-I${SRCTOP}/lib/libthread_db 32 33CFLAGS.thr_stack.c+= -Wno-cast-align 34CFLAGS.rtld_malloc.c+= -Wno-cast-align 35CFLAGS.thr_symbols.c+= -Wno-missing-variable-declarations 36.if ${MK_ASAN} != "no" 37# False-positive ASAN error claiming the local "struct sigaction act;" is 38# overflowed by handle_signal() reading from the ucontext_t argument. This 39# could be caused by ASAN not treating this function as a signal handler. 40CFLAGS.thr_sig.c+= -fno-sanitize=address 41.endif 42 43.if ${MACHINE_CPUARCH} == "arm" 44NO_THREAD_UNWIND_STACK= yes 45.endif 46 47.ifndef NO_THREAD_UNWIND_STACK 48CFLAGS+=-fexceptions 49CFLAGS+=-D_PTHREAD_FORCED_UNWIND 50.endif 51 52LDFLAGS+=-Wl,-znodelete 53LDFLAGS+=-Wl,--auxiliary,libsys.so.7 54 55VERSION_DEF=${SRCTOP}/lib/libc/Versions.def 56SYMBOL_MAPS=${.CURDIR}/pthread.map 57 58MAN= libthr.3 59 60.if ${MK_PTHREADS_ASSERTIONS} != "no" 61# enable extra internal consistency checks 62CFLAGS+=-D_PTHREADS_INVARIANTS 63.endif 64 65PRECIOUSLIB= 66 67.PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH}/${MACHINE_CPUARCH} 68.PATH: ${SRCTOP}/libexec/rtld-elf 69 70.if exists(${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc) 71.include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc" 72.endif 73.include "${.CURDIR}/sys/Makefile.inc" 74.include "${.CURDIR}/thread/Makefile.inc" 75SRCS+= rtld_malloc.c 76 77LIBSYS_SRCTOP= ${.CURDIR:H}/libsys 78.if exists(${LIBSYS_SRCTOP}/${MACHINE_CPUARCH}/_umtx_op_err.S) 79.PATH: ${LIBSYS_SRCTOP}/${MACHINE_CPUARCH} 80.else 81.PATH: ${LIBSYS_SRCTOP} 82.endif 83OBJS+= _umtx_op_err.o 84 85.if ${MK_INSTALLLIB} != "no" 86SYMLINKS+=lib${LIB}.a ${LIBDIR}/libpthread.a 87.endif 88.if !defined(NO_PIC) 89SYMLINKS+=lib${LIB}.so ${LIBDIR}/libpthread.so 90.endif 91.if ${MK_PROFILE} != "no" 92SYMLINKS+=lib${LIB}_p.a ${LIBDIR}/libpthread_p.a 93.endif 94 95HAS_TESTS= 96SUBDIR.${MK_TESTS}+= tests 97 98.include <bsd.lib.mk> 99