Makefile revision 1.60
11.60Sjruoho#	$NetBSD: Makefile,v 1.60 2010/07/07 08:57:36 jruoho Exp $
21.9Sthorpej#
31.9Sthorpej
41.38SchristosWARNS=	4
51.24Scl
61.9Sthorpej.include <bsd.own.mk>
71.9Sthorpej
81.55Smrg.if defined(PTHREAD_MACHINE_ARCH) && !empty(PTHREAD_MACHINE_ARCH) && \
91.55Smrg    exists(${.CURDIR}/arch/${PTHREAD_MACHINE_ARCH})
101.55SmrgARCHSUBDIR=	${PTHREAD_MACHINE_ARCH}
111.55Smrg.elif exists(${.CURDIR}/arch/${MACHINE_ARCH})
121.9SthorpejARCHSUBDIR=	${MACHINE_ARCH}
131.9Sthorpej.elif exists(${.CURDIR}/arch/${MACHINE_CPU}) 
141.9SthorpejARCHSUBDIR=	${MACHINE_CPU}
151.9Sthorpej.else
161.9Sthorpej.BEGIN:
171.10Sthorpej	@echo "WARNING: no ARCHSUBDIR for ${MACHINE_ARCH}/${MACHINE_CPU}; skipping..."
181.9Sthorpej.endif
191.9Sthorpej
201.10SthorpejINCS=	pthread.h pthread_types.h pthread_queue.h
211.10SthorpejINCSDIR=/usr/include
221.10Sthorpej
231.9Sthorpej.if defined(ARCHSUBDIR)
241.9Sthorpej
251.9SthorpejARCHDIR=	${.CURDIR}/arch/${ARCHSUBDIR}
261.9Sthorpej.PATH:	${ARCHDIR}
271.9Sthorpej
281.11SchristosCPPFLAGS+=	-I${ARCHDIR} -I${.CURDIR} -I${.OBJDIR} -D_LIBC
291.37SadCPPFLAGS+=	-D__LIBPTHREAD_SOURCE__
301.9Sthorpej
311.35Schristos# XXX: This crappy poke at libc's internals needs to be fixed.
321.35SchristosCPPFLAGS+=-I${NETBSDSRCDIR}/sys -I${.CURDIR}/../libc
331.35Schristos
341.9SthorpejLIB=	pthread
351.9Sthorpej
361.9Sthorpej#
371.9Sthorpej# NOTE: When you create a new file for libpthread, make sure that pthread.c
381.9Sthorpej# gets a reference to a symbol in that file.  Otherwise, Unix's stupid static
391.9Sthorpej# library semantics will end up discarding potentially important objects.
401.9Sthorpej#
411.9SthorpejSRCS=	pthread.c 
421.18SnathanwSRCS+=	pthread_attr.c
431.9SthorpejSRCS+=	pthread_barrier.c
441.9SthorpejSRCS+=	pthread_cancelstub.c
451.9SthorpejSRCS+=	pthread_cond.c
461.9SthorpejSRCS+=	pthread_lock.c 
471.40SadSRCS+=	pthread_misc.c
481.9SthorpejSRCS+=	pthread_mutex.c
491.9SthorpejSRCS+=	pthread_rwlock.c
501.9SthorpejSRCS+=	pthread_specific.c
511.42SadSRCS+=	pthread_spin.c
521.21SnathanwSRCS+=	pthread_tsd.c
531.26SchristosSRCS+=	res_state.c
541.11SchristosSRCS+=	sem.c
551.9Sthorpej# Architecture-dependent files
561.56Sad.if exists(${ARCHDIR}/pthread_md.S)
571.56SadSRCS+= pthread_md.S
581.9Sthorpej.endif
591.21Snathanw
601.53Sad.if defined(PTHREAD__COMPAT)
611.53SadSRCS+=		pthread_compat.c
621.53Sad.PATH.c:	${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
631.53Sad.PATH.S:	${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
641.53Sad.PATH.c:	${.CURDIR}/../../common/lib/libc/atomic
651.53Sad.PATH.c:	${.CURDIR}/../libc/misc
661.53Sad.include "../../common/lib/libc/arch/${ARCHSUBDIR}/atomic/Makefile.inc"
671.53Sad.endif
681.53Sad
691.21Snathanw# The TSD routines are used in the implementation of profiling, and so
701.21Snathanw# can't be profiled themselves.
711.44SadCOPTS.pthread_specific.c+=	-fomit-frame-pointer -falign-functions=32
721.21Snathanwpthread_specific.po: pthread_specific.o
731.25Slukem	${_MKTARGET_CREATE}
741.21Snathanw	cp pthread_specific.o pthread_specific.po
751.21Snathanw
761.42Sad# Internal spinlock routines are performance critical.  Don't profile them,
771.42Sad# it's incompatibile with -fomit-frame-pointer.
781.42SadCOPTS.pthread_lock.c+=	-fomit-frame-pointer -falign-functions=32
791.42Sadpthread_lock.po: pthread_lock.o
801.42Sad	${_MKTARGET_CREATE}
811.42Sad	cp pthread_lock.o pthread_lock.po
821.42Sad
831.50SadCOPTS.pthread_mutex.c+=	-fomit-frame-pointer -falign-functions=32
841.50Sadpthread_mutex.po: pthread_mutex.o
851.46Sad	${_MKTARGET_CREATE}
861.50Sad	cp pthread_mutex.o pthread_mutex.po
871.46Sad
881.45SjnemethCOPTS.pthread.c += -Wno-stack-protector
891.45Sjnemeth
901.52SrmindMAN+=	affinity.3 pthread.3 \
911.48Syamt	pthread_attr.3 \
921.58Sjruoho	pthread_attr_get_np.3 \
931.60Sjruoho	pthread_attr_getdetachstate.3 \
941.48Syamt	pthread_attr_getname_np.3 \
951.59Sjruoho	pthread_attr_getscope.3 \
961.48Syamt	pthread_attr_setcreatesuspend_np.3 \
971.48Syamt	pthread_attr_setname_np.3 \
981.17Snathanw	pthread_barrier_destroy.3 pthread_barrier_init.3 \
991.17Snathanw	pthread_barrier_wait.3 pthread_barrierattr.3 \
1001.17Snathanw	pthread_cancel.3 pthread_cleanup_push.3 \
1011.17Snathanw	pthread_cond_broadcast.3 pthread_cond_destroy.3 pthread_cond_init.3 \
1021.17Snathanw	pthread_cond_wait.3 \
1031.17Snathanw	pthread_condattr.3 pthread_create.3 pthread_detach.3 pthread_equal.3 \
1041.48Syamt	pthread_exit.3 \
1051.48Syamt	pthread_getname_np.3 \
1061.48Syamt	pthread_getspecific.3 pthread_join.3 \
1071.17Snathanw	pthread_key_create.3 pthread_key_delete.3 pthread_kill.3 \
1081.17Snathanw	pthread_mutex_destroy.3 pthread_mutex_init.3 pthread_mutex_lock.3 \
1091.17Snathanw	pthread_mutex_unlock.3 pthread_mutexattr.3 \
1101.17Snathanw	pthread_once.3 pthread_rwlock_destroy.3 pthread_rwlock_init.3 \
1111.17Snathanw	pthread_rwlock_rdlock.3 pthread_rwlock_unlock.3 \
1121.17Snathanw	pthread_rwlock_wrlock.3 pthread_rwlockattr.3 \
1131.17Snathanw	pthread_schedparam.3 pthread_self.3 \
1141.48Syamt	pthread_setname_np.3 \
1151.17Snathanw	pthread_setspecific.3 pthread_sigmask.3 pthread_spin_destroy.3 \
1161.17Snathanw	pthread_spin_init.3 pthread_spin_lock.3 pthread_spin_unlock.3 \
1171.51Srmind	pthread_suspend_np.3 pthread_testcancel.3
1181.17Snathanw
1191.52SrmindMLINKS+=	affinity.3 pthread_setaffinity_np.3
1201.52SrmindMLINKS+=	affinity.3 pthread_getaffinity_np.3
1211.57Sjruoho
1221.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_init.3
1231.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_destroy.3
1241.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_setstacksize.3
1251.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_getstacksize.3
1261.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_setguardsize.3
1271.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_getguardsize.3
1281.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_setstackaddr.3
1291.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_getstackaddr.3
1301.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_setinheritsched.3
1311.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_getinheritsched.3
1321.33SpeterMLINKS+=	pthread_attr.3 pthread_attr_setschedparam.3
1331.33SpeterMLINKS+=	pthread_attr.3 pthread_attr_getschedparam.3
1341.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_setschedpolicy.3
1351.57SjruohoMLINKS+=	pthread_attr.3 pthread_attr_getschedpolicy.3
1361.59Sjruoho
1371.60SjruohoMLINKS+=	pthread_attr_getdetachstate.3 pthread_attr_setdetachstate.3
1381.59SjruohoMLINKS+=	pthread_attr_getscope.3 pthread_attr_setscope.3
1391.57Sjruoho
1401.32SpeterMLINKS+=	pthread_barrierattr.3 pthread_barrierattr_init.3
1411.32SpeterMLINKS+=	pthread_barrierattr.3 pthread_barrierattr_destroy.3
1421.17SnathanwMLINKS+=	pthread_cleanup_push.3 pthread_cleanup_pop.3
1431.17SnathanwMLINKS+=	pthread_cond_broadcast.3 pthread_cond_signal.3
1441.17SnathanwMLINKS+=	pthread_cond_wait.3 pthread_cond_timedwait.3
1451.17SnathanwMLINKS+=	pthread_condattr.3 pthread_condattr_init.3
1461.17SnathanwMLINKS+=	pthread_condattr.3 pthread_condattr_destroy.3
1471.17SnathanwMLINKS+=	pthread_mutex_lock.3 pthread_mutex_trylock.3
1481.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_init.3
1491.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_destroy.3
1501.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_settype.3
1511.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_gettype.3
1521.17SnathanwMLINKS+=	pthread_rwlock_rdlock.3 pthread_rwlock_timedrdlock.3
1531.17SnathanwMLINKS+=	pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3
1541.17SnathanwMLINKS+=	pthread_rwlock_wrlock.3 pthread_rwlock_timedwrlock.3
1551.17SnathanwMLINKS+=	pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
1561.17SnathanwMLINKS+=	pthread_rwlockattr.3 pthread_rwlockattr_init.3
1571.17SnathanwMLINKS+=	pthread_rwlockattr.3 pthread_rwlockattr_destroy.3
1581.17SnathanwMLINKS+=	pthread_schedparam.3 pthread_setschedparam.3
1591.17SnathanwMLINKS+=	pthread_schedparam.3 pthread_getschedparam.3
1601.27SpookaMLINKS+=	pthread_spin_lock.3 pthread_spin_trylock.3
1611.23SchristosMLINKS+=	pthread_suspend_np.3 pthread_resume_np.3
1621.17SnathanwMLINKS+=	pthread_testcancel.3 pthread_setcancelstate.3
1631.17SnathanwMLINKS+=	pthread_testcancel.3 pthread_setcanceltype.3
1641.9Sthorpej
1651.1Sproven.include <bsd.lib.mk>
1661.1Sproven
1671.9Sthorpej.else
1681.9Sthorpej
1691.9Sthorpej.include <bsd.man.mk>
1701.10Sthorpej.include <bsd.files.mk>
1711.10Sthorpej.include <bsd.inc.mk>
1721.9Sthorpej
1731.9Sthorpej.endif
1741.9Sthorpej
1751.9Sthorpej# WARNS=2 sets -Wcast-qual. This causes problems for one of
1761.9Sthorpej# pthread_setspecific() and pthread_getspecific(), since the constness
1771.9Sthorpej# of the argument to setspecific() has to be discarded *somewhere*
1781.9Sthorpej# before returning it from getspecific().
1791.9SthorpejCFLAGS+= -Wno-cast-qual
180