1 .sinclude "${.CURDIR}/${MACHINE_ARCH}/pthreads/Makefile.inc"
3 .PATH: ${.CURDIR}/pthreads
5 CFLAGS += -I${.CURDIR}/pthreads
7 MISRCS += pthread_cancelable.c pthread_cond.c pthread_tsd.c pthread.c \
8 pthread_mutex.c thread_setup.c stack.s pthread_rwlock.c
10 DYLDSRCS += pthread.c pthread_mutex.c pthread_tsd.c
12 .ifdef FEATURE_PLOCKSTAT
13 ${SYMROOTINC}/plockstat.h: ${.CURDIR}/pthreads/plockstat.d
14 ${MKDIR} ${SYMROOTINC}
15 ${DTRACE} -o ${.TARGET} -C -h -s ${.ALLSRC}
17 .for _src in pthread_cond.c pthread_mutex.c pthread_rwlock.c
18 ${_src:R}.${OBJSUFFIX}: ${SYMROOTINC}/plockstat.h
20 .endif # FEATURE_PLOCKSTAT
22 PTHREADS_INSTHDRS += pthread.h pthread_spis.h pthread_impl.h sched.h
23 PTHREADS_INSTHDRS := ${PTHREADS_INSTHDRS:S/^/${.CURDIR}\/pthreads\//}
24 INSTHDRS += ${PTHREADS_INSTHDRS}
26 PRIV_INSTHDRS += ${.CURDIR}/pthreads/pthread_machdep.h
27 LOCALHDRS += ${.CURDIR}/pthreads/pthread_workqueue.h
29 LEGACYSRCS += pthread.c pthread_cancelable.c pthread_cond.c pthread_mutex.c pthread_rwlock.c
30 CANCELABLESRCS += pthread_cancelable.c
32 # thread_setup.c can only compile with __DARWIN_UNIX03=0 (for ppc64) because
33 # the structure field names are renamed with __ prefix when __DARWIN_UNIX03=1.
34 # If thread_setup.c ever needs to build variant, this will have to be fix
36 CFLAGS-thread_setup.c = -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0
38 # set the LIBC_ALIAS_* macros so we can decorate the symbol independent
39 # of other macro settings
40 CFLAGS-pthread.c += -DLIBC_ALIAS_PTHREAD_CANCEL -DLIBC_ALIAS_PTHREAD_SETCANCELSTATE -DLIBC_ALIAS_PTHREAD_SETCANCELTYPE -DLIBC_ALIAS_PTHREAD_SIGMASK -DLIBC_ALIAS_PTHREAD_TESTCANCEL
41 CFLAGS-pthread_cancelable.c += -DLIBC_ALIAS_PTHREAD_COND_TIMEDWAIT -DLIBC_ALIAS_PTHREAD_COND_WAIT -DLIBC_ALIAS_PTHREAD_JOIN -DLIBC_ALIAS_SIGWAIT
42 CFLAGS-pthread_cond.c += -DLIBC_ALIAS_PTHREAD_COND_INIT
43 CFLAGS-pthread_mutex.c += -DLIBC_ALIAS_PTHREAD_MUTEXATTR_DESTROY
44 CFLAGS-pthread_rwlock.c += -DLIBC_ALIAS_PTHREAD_RWLOCK_DESTROY -DLIBC_ALIAS_PTHREAD_RWLOCK_INIT -DLIBC_ALIAS_PTHREAD_RWLOCK_RDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYRDLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_TRYWRLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_UNLOCK -DLIBC_ALIAS_PTHREAD_RWLOCK_WRLOCK
46 .if defined(CCARCH) && ${CCARCH} == armv6
47 CFLAGS-pthread.c += -mno-thumb
48 CFLAGS-pthread_cancelable.c += -mno-thumb
49 CFLAGS-pthread_cond.c += -mno-thumb
50 CFLAGS-pthread_mutex.c += -mno-thumb
51 CFLAGS-pthread_rwlock.c += -mno-thumb
52 CFLAGS-pthread_tsd.c += -mno-thumb
55 STRIP_HDRS += pthread.h
58 MAN3+= pthread.3 pthread_atfork.3 pthread_attr.3 pthread_cancel.3 \
59 pthread_cleanup_pop.3 pthread_cleanup_push.3 \
60 pthread_cond_broadcast.3 pthread_cond_destroy.3 \
61 pthread_cond_init.3 pthread_cond_signal.3 \
62 pthread_cond_timedwait.3 pthread_cond_wait.3 \
63 pthread_create.3 pthread_detach.3 \
64 pthread_equal.3 pthread_exit.3 \
65 pthread_getschedparam.3 pthread_getspecific.3 \
66 pthread_join.3 pthread_key_create.3 \
67 pthread_key_delete.3 pthread_mutex_destroy.3 \
68 pthread_mutex_init.3 pthread_mutex_lock.3 \
69 pthread_mutex_trylock.3 pthread_mutex_unlock.3 \
70 pthread_mutexattr.3 pthread_once.3 \
71 pthread_self.3 pthread_setcancelstate.3 \
72 pthread_setspecific.3 pthread_condattr.3 \
73 pthread_rwlock_destroy.3 pthread_rwlock_init.3 \
74 pthread_rwlock_rdlock.3 pthread_rwlock_unlock.3 \
75 pthread_rwlock_wrlock.3 pthread_rwlockattr_destroy.3 \
76 pthread_rwlockattr_getpshared.3 pthread_rwlockattr_init.3 \
77 pthread_rwlockattr_setpshared.3
79 MLINKS+= pthread_attr.3 pthread_attr_destroy.3 \
80 pthread_attr.3 pthread_attr_getdetachstate.3 \
81 pthread_attr.3 pthread_attr_getinheritsched.3 \
82 pthread_attr.3 pthread_attr_getschedparam.3 \
83 pthread_attr.3 pthread_attr_getschedpolicy.3 \
84 pthread_attr.3 pthread_attr_getscope.3 \
85 pthread_attr.3 pthread_attr_getstackaddr.3 \
86 pthread_attr.3 pthread_attr_getstacksize.3 \
87 pthread_attr.3 pthread_attr_init.3 \
88 pthread_attr.3 pthread_attr_setdetachstate.3 \
89 pthread_attr.3 pthread_attr_setinheritsched.3 \
90 pthread_attr.3 pthread_attr_setschedparam.3 \
91 pthread_attr.3 pthread_attr_setschedpolicy.3 \
92 pthread_attr.3 pthread_attr_setscope.3 \
93 pthread_attr.3 pthread_attr_setstackaddr.3 \
94 pthread_attr.3 pthread_attr_setstacksize.3
96 MLINKS+= pthread_getschedparam.3 pthread_setschedparam.3
98 MLINKS+= pthread_mutexattr.3 pthread_mutexattr_destroy.3 \
99 pthread_mutexattr.3 pthread_mutexattr_getprioceiling.3 \
100 pthread_mutexattr.3 pthread_mutexattr_getprotocol.3 \
101 pthread_mutexattr.3 pthread_mutexattr_gettype.3 \
102 pthread_mutexattr.3 pthread_mutexattr_init.3 \
103 pthread_mutexattr.3 pthread_mutexattr_setprioceiling.3 \
104 pthread_mutexattr.3 pthread_mutexattr_setprotocol.3 \
105 pthread_mutexattr.3 pthread_mutexattr_settype.3
107 MLINKS+= pthread_setcancelstate.3 pthread_setcanceltype.3 \
108 pthread_setcancelstate.3 pthread_testcancel.3
110 MLINKS+= pthread_condattr.3 pthread_condattr_destroy.3 \
111 pthread_condattr.3 pthread_condattr_init.3
113 MLINKS+= pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3
115 MLINKS+= pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3