Makefile revision 1.77
11.77Smatt#	$NetBSD: Makefile,v 1.77 2012/08/04 15:13:09 matt Exp $
21.9Sthorpej#
31.9Sthorpej
41.75SmattWARNS?=	5
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.71SskrllLDFLAGS+=	-Wl,-znodlopen
371.71Sskrll
381.9Sthorpej#
391.9Sthorpej# NOTE: When you create a new file for libpthread, make sure that pthread.c
401.9Sthorpej# gets a reference to a symbol in that file.  Otherwise, Unix's stupid static
411.9Sthorpej# library semantics will end up discarding potentially important objects.
421.9Sthorpej#
431.9SthorpejSRCS=	pthread.c 
441.18SnathanwSRCS+=	pthread_attr.c
451.9SthorpejSRCS+=	pthread_barrier.c
461.9SthorpejSRCS+=	pthread_cancelstub.c
471.9SthorpejSRCS+=	pthread_cond.c
481.9SthorpejSRCS+=	pthread_lock.c 
491.40SadSRCS+=	pthread_misc.c
501.9SthorpejSRCS+=	pthread_mutex.c
511.74SjoergSRCS+=	pthread_once.c
521.9SthorpejSRCS+=	pthread_rwlock.c
531.9SthorpejSRCS+=	pthread_specific.c
541.42SadSRCS+=	pthread_spin.c
551.21SnathanwSRCS+=	pthread_tsd.c
561.26SchristosSRCS+=	res_state.c
571.11SchristosSRCS+=	sem.c
581.9Sthorpej# Architecture-dependent files
591.56Sad.if exists(${ARCHDIR}/pthread_md.S)
601.56SadSRCS+= pthread_md.S
611.9Sthorpej.endif
621.21Snathanw
631.53Sad.if defined(PTHREAD__COMPAT)
641.53SadSRCS+=		pthread_compat.c
651.53Sad.PATH.c:	${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
661.53Sad.PATH.S:	${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic
671.53Sad.PATH.c:	${.CURDIR}/../../common/lib/libc/atomic
681.53Sad.PATH.c:	${.CURDIR}/../libc/misc
691.53Sad.include "../../common/lib/libc/arch/${ARCHSUBDIR}/atomic/Makefile.inc"
701.53Sad.endif
711.53Sad
721.76SjoergALIGN_FUNCTIONS=	${${ACTIVE_CC} == "gcc":? -falign-functions=32 :}
731.76Sjoerg
741.21Snathanw# The TSD routines are used in the implementation of profiling, and so
751.21Snathanw# can't be profiled themselves.
761.76SjoergCOPTS.pthread_specific.c+=	-fomit-frame-pointer ${ALIGN_FUNCTIONS}
771.21Snathanwpthread_specific.po: pthread_specific.o
781.25Slukem	${_MKTARGET_CREATE}
791.21Snathanw	cp pthread_specific.o pthread_specific.po
801.21Snathanw
811.42Sad# Internal spinlock routines are performance critical.  Don't profile them,
821.42Sad# it's incompatibile with -fomit-frame-pointer.
831.76SjoergCOPTS.pthread_lock.c+=	-fomit-frame-pointer ${ALIGN_FUNCTIONS}
841.42Sadpthread_lock.po: pthread_lock.o
851.42Sad	${_MKTARGET_CREATE}
861.42Sad	cp pthread_lock.o pthread_lock.po
871.42Sad
881.76SjoergCOPTS.pthread_mutex.c+=	-fomit-frame-pointer ${ALIGN_FUNCTIONS}
891.50Sadpthread_mutex.po: pthread_mutex.o
901.46Sad	${_MKTARGET_CREATE}
911.50Sad	cp pthread_mutex.o pthread_mutex.po
921.46Sad
931.72SchristosCOPTS.pthread.c += -Wno-stack-protector -Wno-format-nonliteral
941.72SchristosCOPTS.pthread_attr.c += -Wno-format-nonliteral
951.45Sjnemeth
961.52SrmindMAN+=	affinity.3 pthread.3 \
971.48Syamt	pthread_attr.3 \
981.58Sjruoho	pthread_attr_get_np.3 \
991.60Sjruoho	pthread_attr_getdetachstate.3 \
1001.62Sjruoho	pthread_attr_getguardsize.3 \
1011.63Sjruoho	pthread_attr_getinheritsched.3 \
1021.48Syamt	pthread_attr_getname_np.3 \
1031.64Sjruoho	pthread_attr_getschedparam.3 \
1041.59Sjruoho	pthread_attr_getscope.3 \
1051.61Sjruoho	pthread_attr_getstack.3 \
1061.48Syamt	pthread_attr_setcreatesuspend_np.3 \
1071.66Srmind	pthread_barrier.3 pthread_barrierattr.3 \
1081.17Snathanw	pthread_cancel.3 pthread_cleanup_push.3 \
1091.66Srmind	pthread_cond.3 pthread_condattr.3 \
1101.66Srmind	pthread_create.3 pthread_detach.3 pthread_equal.3 \
1111.73Syamt	pthread_curcpu_np.3 \
1121.48Syamt	pthread_exit.3 \
1131.48Syamt	pthread_getname_np.3 \
1141.48Syamt	pthread_getspecific.3 pthread_join.3 \
1151.69Sjruoho	pthread_key_create.3 pthread_kill.3 \
1161.66Srmind	pthread_mutex.3 pthread_mutexattr.3 \
1171.66Srmind	pthread_once.3 pthread_rwlock.3 pthread_rwlockattr.3 \
1181.17Snathanw	pthread_schedparam.3 pthread_self.3 \
1191.69Sjruoho	pthread_sigmask.3 pthread_spin.3 \
1201.51Srmind	pthread_suspend_np.3 pthread_testcancel.3
1211.17Snathanw
1221.70SchristosMLINKS+=	pthread_attr_get_np.3 pthread_getattr_np.3
1231.52SrmindMLINKS+=	affinity.3 pthread_setaffinity_np.3
1241.52SrmindMLINKS+=	affinity.3 pthread_getaffinity_np.3
1251.57Sjruoho
1261.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_init.3
1271.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_destroy.3
1281.59Sjruoho
1291.60SjruohoMLINKS+=	pthread_attr_getdetachstate.3 pthread_attr_setdetachstate.3
1301.62SjruohoMLINKS+=	pthread_attr_getguardsize.3 pthread_attr_setguardsize.3
1311.63SjruohoMLINKS+=	pthread_attr_getinheritsched.3 pthread_attr_setinheritsched.3
1321.68SjruohoMLINKS+=	pthread_attr_getname_np.3 pthread_attr_setname_np.3
1331.67Sjruoho
1341.67SjruohoMLINKS+=	pthread_attr_getschedparam.3 pthread_attr_setschedparam.3 \
1351.67Sjruoho		pthread_attr_getschedparam.3 pthread_attr_getschedpolicy.3 \
1361.67Sjruoho		pthread_attr_getschedparam.3 pthread_attr_setschedpolicy.3
1371.67Sjruoho
1381.59SjruohoMLINKS+=	pthread_attr_getscope.3 pthread_attr_setscope.3
1391.67Sjruoho
1401.61SjruohoMLINKS+=	pthread_attr_getstack.3 pthread_attr_setstack.3 \
1411.61Sjruoho		pthread_attr_getstack.3 pthread_attr_getstacksize.3 \
1421.61Sjruoho		pthread_attr_getstack.3 pthread_attr_setstacksize.3 \
1431.61Sjruoho		pthread_attr_getstack.3 pthread_attr_getstackaddr.3 \
1441.61Sjruoho		pthread_attr_getstack.3 pthread_attr_setstackaddr.3
1451.57Sjruoho
1461.66SrmindMLINKS+=	pthread_cleanup_push.3 pthread_cleanup_pop.3
1471.66Srmind
1481.66SrmindMLINKS+=	pthread_barrier.3 pthread_barrier_init.3
1491.66SrmindMLINKS+=	pthread_barrier.3 pthread_barrier_destroy.3
1501.66SrmindMLINKS+=	pthread_barrier.3 pthread_barrier_wait.3
1511.66Srmind
1521.32SpeterMLINKS+=	pthread_barrierattr.3 pthread_barrierattr_init.3
1531.32SpeterMLINKS+=	pthread_barrierattr.3 pthread_barrierattr_destroy.3
1541.66Srmind
1551.66SrmindMLINKS+=	pthread_cond.3 pthread_cond_init.3
1561.66SrmindMLINKS+=	pthread_cond.3 pthread_cond_destroy.3
1571.66SrmindMLINKS+=	pthread_cond.3 pthread_cond_broadcast.3
1581.66SrmindMLINKS+=	pthread_cond.3 pthread_cond_wait.3
1591.66SrmindMLINKS+=	pthread_cond.3 pthread_cond_signal.3
1601.66SrmindMLINKS+=	pthread_cond.3 pthread_cond_timedwait.3
1611.66Srmind
1621.17SnathanwMLINKS+=	pthread_condattr.3 pthread_condattr_init.3
1631.17SnathanwMLINKS+=	pthread_condattr.3 pthread_condattr_destroy.3
1641.66Srmind
1651.68SjruohoMLINKS+=	pthread_getname_np.3 pthread_setname_np.3
1661.69SjruohoMLINKS+=	pthread_getspecific.3 pthread_setspecific.3
1671.69SjruohoMLINKS+=	pthread_key_create.3 pthread_key_delete.3
1681.68Sjruoho
1691.66SrmindMLINKS+=	pthread_mutex.3 pthread_mutex_init.3
1701.66SrmindMLINKS+=	pthread_mutex.3 pthread_mutex_destroy.3
1711.66SrmindMLINKS+=	pthread_mutex.3 pthread_mutex_lock.3
1721.66SrmindMLINKS+=	pthread_mutex.3 pthread_mutex_trylock.3
1731.66SrmindMLINKS+=	pthread_mutex.3 pthread_mutex_unlock.3
1741.66Srmind
1751.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_init.3
1761.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_destroy.3
1771.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_settype.3
1781.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_gettype.3
1791.66Srmind
1801.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_init.3
1811.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_destroy.3
1821.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_rdlock.3
1831.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_wrlock.3
1841.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_unlock.3
1851.66Srmind
1861.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_timedrdlock.3
1871.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_timedwrlock.3
1881.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_tryrdlock.3
1891.66SrmindMLINKS+=	pthread_rwlock.3 pthread_rwlock_trywrlock.3
1901.66Srmind
1911.17SnathanwMLINKS+=	pthread_rwlockattr.3 pthread_rwlockattr_init.3
1921.17SnathanwMLINKS+=	pthread_rwlockattr.3 pthread_rwlockattr_destroy.3
1931.66Srmind
1941.66SrmindMLINKS+=	pthread_spin.3 pthread_spin_init.3
1951.66SrmindMLINKS+=	pthread_spin.3 pthread_spin_destroy.3
1961.66SrmindMLINKS+=	pthread_spin.3 pthread_spin_lock.3
1971.66SrmindMLINKS+=	pthread_spin.3 pthread_spin_trylock.3
1981.66SrmindMLINKS+=	pthread_spin.3 pthread_spin_unlock.3
1991.66Srmind
2001.17SnathanwMLINKS+=	pthread_schedparam.3 pthread_setschedparam.3
2011.17SnathanwMLINKS+=	pthread_schedparam.3 pthread_getschedparam.3
2021.23SchristosMLINKS+=	pthread_suspend_np.3 pthread_resume_np.3
2031.17SnathanwMLINKS+=	pthread_testcancel.3 pthread_setcancelstate.3
2041.17SnathanwMLINKS+=	pthread_testcancel.3 pthread_setcanceltype.3
2051.9Sthorpej
2061.1Sproven.include <bsd.lib.mk>
2071.1Sproven
2081.9Sthorpej.else
2091.9Sthorpej
2101.9Sthorpej.include <bsd.man.mk>
2111.10Sthorpej.include <bsd.files.mk>
2121.10Sthorpej.include <bsd.inc.mk>
2131.9Sthorpej
2141.9Sthorpej.endif
2151.9Sthorpej
2161.9Sthorpej# WARNS=2 sets -Wcast-qual. This causes problems for one of
2171.9Sthorpej# pthread_setspecific() and pthread_getspecific(), since the constness
2181.9Sthorpej# of the argument to setspecific() has to be discarded *somewhere*
2191.9Sthorpej# before returning it from getspecific().
2201.77SmattCWARNFLAGS+= -Wno-cast-qual
221