2009-05-17 02:20:40 +04:00
|
|
|
# $NetBSD: Makefile,v 1.56 2009/05/16 22:21:18 ad Exp $
|
2003-01-18 13:32:11 +03:00
|
|
|
#
|
|
|
|
|
2007-01-20 07:56:25 +03:00
|
|
|
WARNS= 4
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
2008-10-26 03:00:27 +03:00
|
|
|
.if defined(PTHREAD_MACHINE_ARCH) && !empty(PTHREAD_MACHINE_ARCH) && \
|
|
|
|
exists(${.CURDIR}/arch/${PTHREAD_MACHINE_ARCH})
|
|
|
|
ARCHSUBDIR= ${PTHREAD_MACHINE_ARCH}
|
|
|
|
.elif exists(${.CURDIR}/arch/${MACHINE_ARCH})
|
2003-01-18 13:32:11 +03:00
|
|
|
ARCHSUBDIR= ${MACHINE_ARCH}
|
|
|
|
.elif exists(${.CURDIR}/arch/${MACHINE_CPU})
|
|
|
|
ARCHSUBDIR= ${MACHINE_CPU}
|
|
|
|
.else
|
|
|
|
.BEGIN:
|
2003-01-19 22:55:13 +03:00
|
|
|
@echo "WARNING: no ARCHSUBDIR for ${MACHINE_ARCH}/${MACHINE_CPU}; skipping..."
|
2003-01-18 13:32:11 +03:00
|
|
|
.endif
|
|
|
|
|
2003-01-19 22:55:13 +03:00
|
|
|
INCS= pthread.h pthread_types.h pthread_queue.h
|
|
|
|
INCSDIR=/usr/include
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
.if defined(ARCHSUBDIR)
|
|
|
|
|
|
|
|
ARCHDIR= ${.CURDIR}/arch/${ARCHSUBDIR}
|
|
|
|
.PATH: ${ARCHDIR}
|
|
|
|
|
2003-01-20 23:10:19 +03:00
|
|
|
CPPFLAGS+= -I${ARCHDIR} -I${.CURDIR} -I${.OBJDIR} -D_LIBC
|
2006-12-24 21:39:45 +03:00
|
|
|
CPPFLAGS+= -D__LIBPTHREAD_SOURCE__
|
2003-01-18 13:32:11 +03:00
|
|
|
|
2005-12-14 01:07:20 +03:00
|
|
|
# XXX: This crappy poke at libc's internals needs to be fixed.
|
|
|
|
CPPFLAGS+=-I${NETBSDSRCDIR}/sys -I${.CURDIR}/../libc
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
LIB= pthread
|
|
|
|
|
|
|
|
#
|
|
|
|
# NOTE: When you create a new file for libpthread, make sure that pthread.c
|
|
|
|
# gets a reference to a symbol in that file. Otherwise, Unix's stupid static
|
|
|
|
# library semantics will end up discarding potentially important objects.
|
|
|
|
#
|
|
|
|
SRCS= pthread.c
|
2003-07-19 02:33:45 +04:00
|
|
|
SRCS+= pthread_attr.c
|
2003-01-18 13:32:11 +03:00
|
|
|
SRCS+= pthread_barrier.c
|
|
|
|
SRCS+= pthread_cancelstub.c
|
|
|
|
SRCS+= pthread_cond.c
|
|
|
|
SRCS+= pthread_lock.c
|
2007-03-02 21:53:51 +03:00
|
|
|
SRCS+= pthread_misc.c
|
2003-01-18 13:32:11 +03:00
|
|
|
SRCS+= pthread_mutex.c
|
|
|
|
SRCS+= pthread_rwlock.c
|
|
|
|
SRCS+= pthread_specific.c
|
2007-08-16 17:54:16 +04:00
|
|
|
SRCS+= pthread_spin.c
|
2003-08-13 22:52:01 +04:00
|
|
|
SRCS+= pthread_tsd.c
|
2004-05-21 07:40:51 +04:00
|
|
|
SRCS+= res_state.c
|
2003-01-20 23:10:19 +03:00
|
|
|
SRCS+= sem.c
|
2003-01-18 13:32:11 +03:00
|
|
|
# Architecture-dependent files
|
2009-05-17 02:20:40 +04:00
|
|
|
.if exists(${ARCHDIR}/pthread_md.S)
|
|
|
|
SRCS+= pthread_md.S
|
2003-01-18 13:32:11 +03:00
|
|
|
.endif
|
|
|
|
|
2008-09-29 12:48:15 +04:00
|
|
|
.if defined(PTHREAD__COMPAT)
|
|
|
|
SRCS+= pthread_compat.c
|
|
|
|
.PATH.c: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
|
|
|
|
.PATH.S: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
|
|
|
|
.PATH.c: ${.CURDIR}/../../common/lib/libc/atomic
|
|
|
|
.PATH.c: ${.CURDIR}/../libc/misc
|
|
|
|
.include "../../common/lib/libc/arch/${ARCHSUBDIR}/atomic/Makefile.inc"
|
|
|
|
.endif
|
|
|
|
|
2003-08-13 22:52:01 +04:00
|
|
|
# The TSD routines are used in the implementation of profiling, and so
|
|
|
|
# can't be profiled themselves.
|
2007-10-05 01:08:35 +04:00
|
|
|
COPTS.pthread_specific.c+= -fomit-frame-pointer -falign-functions=32
|
2003-08-13 22:52:01 +04:00
|
|
|
pthread_specific.po: pthread_specific.o
|
2004-01-02 04:37:53 +03:00
|
|
|
${_MKTARGET_CREATE}
|
2003-08-13 22:52:01 +04:00
|
|
|
cp pthread_specific.o pthread_specific.po
|
|
|
|
|
2007-08-16 17:54:16 +04:00
|
|
|
# Internal spinlock routines are performance critical. Don't profile them,
|
|
|
|
# it's incompatibile with -fomit-frame-pointer.
|
|
|
|
COPTS.pthread_lock.c+= -fomit-frame-pointer -falign-functions=32
|
|
|
|
pthread_lock.po: pthread_lock.o
|
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
cp pthread_lock.o pthread_lock.po
|
|
|
|
|
2008-02-10 21:50:54 +03:00
|
|
|
COPTS.pthread_mutex.c+= -fomit-frame-pointer -falign-functions=32
|
|
|
|
pthread_mutex.po: pthread_mutex.o
|
2007-11-13 20:20:08 +03:00
|
|
|
${_MKTARGET_CREATE}
|
2008-02-10 21:50:54 +03:00
|
|
|
cp pthread_mutex.o pthread_mutex.po
|
2007-11-13 20:20:08 +03:00
|
|
|
|
2007-10-14 00:36:43 +04:00
|
|
|
COPTS.pthread.c += -Wno-stack-protector
|
|
|
|
|
2008-06-16 18:25:49 +04:00
|
|
|
MAN+= affinity.3 pthread.3 \
|
2007-12-15 00:51:21 +03:00
|
|
|
pthread_attr.3 \
|
|
|
|
pthread_attr_getname_np.3 \
|
|
|
|
pthread_attr_setcreatesuspend_np.3 \
|
|
|
|
pthread_attr_setname_np.3 \
|
2003-06-04 01:34:00 +04:00
|
|
|
pthread_barrier_destroy.3 pthread_barrier_init.3 \
|
|
|
|
pthread_barrier_wait.3 pthread_barrierattr.3 \
|
|
|
|
pthread_cancel.3 pthread_cleanup_push.3 \
|
|
|
|
pthread_cond_broadcast.3 pthread_cond_destroy.3 pthread_cond_init.3 \
|
|
|
|
pthread_cond_wait.3 \
|
|
|
|
pthread_condattr.3 pthread_create.3 pthread_detach.3 pthread_equal.3 \
|
2007-12-15 00:51:21 +03:00
|
|
|
pthread_exit.3 \
|
|
|
|
pthread_getname_np.3 \
|
|
|
|
pthread_getspecific.3 pthread_join.3 \
|
2003-06-04 01:34:00 +04:00
|
|
|
pthread_key_create.3 pthread_key_delete.3 pthread_kill.3 \
|
|
|
|
pthread_mutex_destroy.3 pthread_mutex_init.3 pthread_mutex_lock.3 \
|
|
|
|
pthread_mutex_unlock.3 pthread_mutexattr.3 \
|
|
|
|
pthread_once.3 pthread_rwlock_destroy.3 pthread_rwlock_init.3 \
|
|
|
|
pthread_rwlock_rdlock.3 pthread_rwlock_unlock.3 \
|
|
|
|
pthread_rwlock_wrlock.3 pthread_rwlockattr.3 \
|
|
|
|
pthread_schedparam.3 pthread_self.3 \
|
2007-12-15 00:51:21 +03:00
|
|
|
pthread_setname_np.3 \
|
2003-06-04 01:34:00 +04:00
|
|
|
pthread_setspecific.3 pthread_sigmask.3 pthread_spin_destroy.3 \
|
|
|
|
pthread_spin_init.3 pthread_spin_lock.3 pthread_spin_unlock.3 \
|
2008-03-10 17:47:06 +03:00
|
|
|
pthread_suspend_np.3 pthread_testcancel.3
|
2003-06-04 01:34:00 +04:00
|
|
|
|
2008-06-16 18:25:49 +04:00
|
|
|
MLINKS+= affinity.3 pthread_setaffinity_np.3
|
|
|
|
MLINKS+= affinity.3 pthread_getaffinity_np.3
|
2003-06-04 01:34:00 +04:00
|
|
|
MLINKS+= pthread_attr.3 pthread_attr_init.3
|
|
|
|
MLINKS+= pthread_attr.3 pthread_attr_destroy.3
|
|
|
|
MLINKS+= pthread_attr.3 pthread_attr_setdetachstate.3
|
|
|
|
MLINKS+= pthread_attr.3 pthread_attr_getdetachstate.3
|
2005-06-17 22:37:24 +04:00
|
|
|
MLINKS+= pthread_attr.3 pthread_attr_setschedparam.3
|
|
|
|
MLINKS+= pthread_attr.3 pthread_attr_getschedparam.3
|
2005-06-17 22:23:19 +04:00
|
|
|
MLINKS+= pthread_barrierattr.3 pthread_barrierattr_init.3
|
|
|
|
MLINKS+= pthread_barrierattr.3 pthread_barrierattr_destroy.3
|
2003-06-04 01:34:00 +04:00
|
|
|
MLINKS+= pthread_cleanup_push.3 pthread_cleanup_pop.3
|
|
|
|
MLINKS+= pthread_cond_broadcast.3 pthread_cond_signal.3
|
|
|
|
MLINKS+= pthread_cond_wait.3 pthread_cond_timedwait.3
|
|
|
|
MLINKS+= pthread_condattr.3 pthread_condattr_init.3
|
|
|
|
MLINKS+= pthread_condattr.3 pthread_condattr_destroy.3
|
|
|
|
MLINKS+= pthread_mutex_lock.3 pthread_mutex_trylock.3
|
|
|
|
MLINKS+= pthread_mutexattr.3 pthread_mutexattr_init.3
|
|
|
|
MLINKS+= pthread_mutexattr.3 pthread_mutexattr_destroy.3
|
|
|
|
MLINKS+= pthread_mutexattr.3 pthread_mutexattr_settype.3
|
|
|
|
MLINKS+= pthread_mutexattr.3 pthread_mutexattr_gettype.3
|
|
|
|
MLINKS+= pthread_rwlock_rdlock.3 pthread_rwlock_timedrdlock.3
|
|
|
|
MLINKS+= pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3
|
|
|
|
MLINKS+= pthread_rwlock_wrlock.3 pthread_rwlock_timedwrlock.3
|
|
|
|
MLINKS+= pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
|
|
|
|
MLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_init.3
|
|
|
|
MLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_destroy.3
|
|
|
|
MLINKS+= pthread_schedparam.3 pthread_setschedparam.3
|
|
|
|
MLINKS+= pthread_schedparam.3 pthread_getschedparam.3
|
2004-06-02 18:07:07 +04:00
|
|
|
MLINKS+= pthread_spin_lock.3 pthread_spin_trylock.3
|
2003-11-12 05:44:22 +03:00
|
|
|
MLINKS+= pthread_suspend_np.3 pthread_resume_np.3
|
2003-06-04 01:34:00 +04:00
|
|
|
MLINKS+= pthread_testcancel.3 pthread_setcancelstate.3
|
|
|
|
MLINKS+= pthread_testcancel.3 pthread_setcanceltype.3
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
.include <bsd.lib.mk>
|
|
|
|
|
|
|
|
.else
|
|
|
|
|
|
|
|
.include <bsd.man.mk>
|
2003-01-19 22:55:13 +03:00
|
|
|
.include <bsd.files.mk>
|
|
|
|
.include <bsd.inc.mk>
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# WARNS=2 sets -Wcast-qual. This causes problems for one of
|
|
|
|
# pthread_setspecific() and pthread_getspecific(), since the constness
|
|
|
|
# of the argument to setspecific() has to be discarded *somewhere*
|
|
|
|
# before returning it from getspecific().
|
|
|
|
CFLAGS+= -Wno-cast-qual
|