Makefile revision 1.29
11.29Syamt#	$NetBSD: Makefile,v 1.29 2004/12/14 01:47:13 yamt Exp $
21.9Sthorpej#
31.9Sthorpej
41.9SthorpejWARNS=	2
51.24Scl
61.24Scl# Define PT_FIXEDSTACKSIZE_LG to set a fixed stacksize
71.24Scl#CPPFLAGS+=-DPT_FIXEDSTACKSIZE_LG=18
81.9Sthorpej
91.9Sthorpej.include <bsd.own.mk>
101.9Sthorpej
111.9Sthorpej.if 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.28SnathanwCPPFLAGS+=	-D__LIBPTHREAD_SOURCE__
301.9Sthorpej
311.9SthorpejDPSRCS+=	assym.h
321.20SlukemCLEANFILES+=	assym.h
331.9Sthorpej
341.25Slukemassym.h: genassym.sh ${ARCHDIR}/genassym.cf \
351.25Slukem		pthread.h pthread_int.h pthread_md.h
361.25Slukem	${_MKTARGET_CREATE}
371.22Slukem	${HOST_SH} ${.CURDIR}/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
381.9Sthorpej		< ${ARCHDIR}/genassym.cf > assym.h.tmp && \
391.9Sthorpej	mv -f assym.h.tmp assym.h
401.9Sthorpej
411.9SthorpejLIB=	pthread
421.9Sthorpej
431.9Sthorpej#
441.9Sthorpej# NOTE: When you create a new file for libpthread, make sure that pthread.c
451.9Sthorpej# gets a reference to a symbol in that file.  Otherwise, Unix's stupid static
461.9Sthorpej# library semantics will end up discarding potentially important objects.
471.9Sthorpej#
481.9SthorpejSRCS=	pthread.c 
491.9SthorpejSRCS+=	pthread_alarms.c
501.18SnathanwSRCS+=	pthread_attr.c
511.9SthorpejSRCS+=	pthread_barrier.c
521.9SthorpejSRCS+=	pthread_cancelstub.c
531.9SthorpejSRCS+=	pthread_cond.c
541.9SthorpejSRCS+=	pthread_lock.c 
551.9SthorpejSRCS+=	pthread_mutex.c
561.9SthorpejSRCS+=	pthread_run.c
571.9SthorpejSRCS+=	pthread_rwlock.c
581.9SthorpejSRCS+=	pthread_sa.c
591.9SthorpejSRCS+=	pthread_sig.c
601.16SnathanwSRCS+=	pthread_sleep.c
611.9SthorpejSRCS+=	pthread_specific.c
621.9SthorpejSRCS+=  pthread_stack.c
631.21SnathanwSRCS+=	pthread_tsd.c
641.9SthorpejSRCS+=  pthread_debug.c
651.26SchristosSRCS+=	res_state.c
661.9SthorpejSRCS+=	sched.c
671.11SchristosSRCS+=	sem.c
681.9Sthorpej# Architecture-dependent files
691.9SthorpejSRCS+=	pthread_switch.S _context_u.S
701.9Sthorpej.if exists(${ARCHDIR}/pthread_md.c)
711.9SthorpejSRCS+= pthread_md.c
721.9Sthorpej.endif
731.21Snathanw
741.21Snathanw# The TSD routines are used in the implementation of profiling, and so
751.21Snathanw# can't be profiled themselves.
761.21Snathanwpthread_specific.po: pthread_specific.o
771.25Slukem	${_MKTARGET_CREATE}
781.21Snathanw	cp pthread_specific.o pthread_specific.po
791.21Snathanw
801.21Snathanw_context_u.po: _context_u.o
811.25Slukem	${_MKTARGET_CREATE}
821.21Snathanw	cp _context_u.o _context_u.po
831.17Snathanw
841.19SwizMAN+=	pthread.3 \
851.23Schristos	pthread_attr.3 pthread_attr_setcreatesuspend_np.3 \
861.17Snathanw	pthread_barrier_destroy.3 pthread_barrier_init.3 \
871.17Snathanw	pthread_barrier_wait.3 pthread_barrierattr.3 \
881.17Snathanw	pthread_cancel.3 pthread_cleanup_push.3 \
891.17Snathanw	pthread_cond_broadcast.3 pthread_cond_destroy.3 pthread_cond_init.3 \
901.17Snathanw	pthread_cond_wait.3 \
911.17Snathanw	pthread_condattr.3 pthread_create.3 pthread_detach.3 pthread_equal.3 \
921.17Snathanw	pthread_exit.3 pthread_getspecific.3 pthread_join.3 \
931.17Snathanw	pthread_key_create.3 pthread_key_delete.3 pthread_kill.3 \
941.17Snathanw	pthread_mutex_destroy.3 pthread_mutex_init.3 pthread_mutex_lock.3 \
951.17Snathanw	pthread_mutex_unlock.3 pthread_mutexattr.3 \
961.17Snathanw	pthread_once.3 pthread_rwlock_destroy.3 pthread_rwlock_init.3 \
971.17Snathanw	pthread_rwlock_rdlock.3 pthread_rwlock_unlock.3 \
981.17Snathanw	pthread_rwlock_wrlock.3 pthread_rwlockattr.3 \
991.17Snathanw	pthread_schedparam.3 pthread_self.3 \
1001.17Snathanw	pthread_setspecific.3 pthread_sigmask.3 pthread_spin_destroy.3 \
1011.17Snathanw	pthread_spin_init.3 pthread_spin_lock.3 pthread_spin_unlock.3 \
1021.29Syamt	pthread_suspend_np.3 pthread_testcancel.3 \
1031.29Syamt	sched_yield.3
1041.17Snathanw
1051.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_init.3
1061.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_destroy.3
1071.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_setdetachstate.3
1081.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_getdetachstate.3
1091.17SnathanwMLINKS+=	pthread_barrierattr.3 pthread_barierattr_init.3
1101.17SnathanwMLINKS+=	pthread_barrierattr.3 pthread_barierattr_destroy.3
1111.17SnathanwMLINKS+=	pthread_cleanup_push.3 pthread_cleanup_pop.3
1121.17SnathanwMLINKS+=	pthread_cond_broadcast.3 pthread_cond_signal.3
1131.17SnathanwMLINKS+=	pthread_cond_wait.3 pthread_cond_timedwait.3
1141.17SnathanwMLINKS+=	pthread_condattr.3 pthread_condattr_init.3
1151.17SnathanwMLINKS+=	pthread_condattr.3 pthread_condattr_destroy.3
1161.17SnathanwMLINKS+=	pthread_mutex_lock.3 pthread_mutex_trylock.3
1171.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_init.3
1181.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_destroy.3
1191.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_settype.3
1201.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_gettype.3
1211.17SnathanwMLINKS+=	pthread_rwlock_rdlock.3 pthread_rwlock_timedrdlock.3
1221.17SnathanwMLINKS+=	pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3
1231.17SnathanwMLINKS+=	pthread_rwlock_wrlock.3 pthread_rwlock_timedwrlock.3
1241.17SnathanwMLINKS+=	pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
1251.17SnathanwMLINKS+=	pthread_rwlockattr.3 pthread_rwlockattr_init.3
1261.17SnathanwMLINKS+=	pthread_rwlockattr.3 pthread_rwlockattr_destroy.3
1271.17SnathanwMLINKS+=	pthread_schedparam.3 pthread_setschedparam.3
1281.17SnathanwMLINKS+=	pthread_schedparam.3 pthread_getschedparam.3
1291.27SpookaMLINKS+=	pthread_spin_lock.3 pthread_spin_trylock.3
1301.23SchristosMLINKS+=	pthread_suspend_np.3 pthread_resume_np.3
1311.17SnathanwMLINKS+=	pthread_testcancel.3 pthread_setcancelstate.3
1321.17SnathanwMLINKS+=	pthread_testcancel.3 pthread_setcanceltype.3
1331.9Sthorpej
1341.9Sthorpejpthread_switch.S _context_u.S: assym.h
1351.9Sthorpej
1361.9Sthorpejdebuglog: debuglog.o
1371.9Sthorpej	$(CC) -o debuglog debuglog.o -lpthread
1381.1Sproven
1391.1Sproven.include <bsd.lib.mk>
1401.1Sproven
1411.9Sthorpej.else
1421.9Sthorpej
1431.9Sthorpej.include <bsd.man.mk>
1441.10Sthorpej.include <bsd.files.mk>
1451.10Sthorpej.include <bsd.inc.mk>
1461.9Sthorpej
1471.9Sthorpej.endif
1481.9Sthorpej
1491.9Sthorpej# WARNS=2 sets -Wcast-qual. This causes problems for one of
1501.9Sthorpej# pthread_setspecific() and pthread_getspecific(), since the constness
1511.9Sthorpej# of the argument to setspecific() has to be discarded *somewhere*
1521.9Sthorpej# before returning it from getspecific().
1531.9SthorpejCFLAGS+= -Wno-cast-qual
154