Makefile revision 1.45
11.45Sjnemeth#	$NetBSD: Makefile,v 1.45 2007/10/13 20:36:43 jnemeth Exp $
21.9Sthorpej#
31.9Sthorpej
41.38SchristosWARNS=	4
51.24Scl
61.9Sthorpej.include <bsd.own.mk>
71.9Sthorpej
81.9Sthorpej.if exists(${.CURDIR}/arch/${MACHINE_ARCH})
91.9SthorpejARCHSUBDIR=	${MACHINE_ARCH}
101.9Sthorpej.elif exists(${.CURDIR}/arch/${MACHINE_CPU}) 
111.9SthorpejARCHSUBDIR=	${MACHINE_CPU}
121.9Sthorpej.else
131.9Sthorpej.BEGIN:
141.10Sthorpej	@echo "WARNING: no ARCHSUBDIR for ${MACHINE_ARCH}/${MACHINE_CPU}; skipping..."
151.9Sthorpej.endif
161.9Sthorpej
171.10SthorpejINCS=	pthread.h pthread_types.h pthread_queue.h
181.10SthorpejINCSDIR=/usr/include
191.10Sthorpej
201.9Sthorpej.if defined(ARCHSUBDIR)
211.9Sthorpej
221.9SthorpejARCHDIR=	${.CURDIR}/arch/${ARCHSUBDIR}
231.9Sthorpej.PATH:	${ARCHDIR}
241.9Sthorpej
251.11SchristosCPPFLAGS+=	-I${ARCHDIR} -I${.CURDIR} -I${.OBJDIR} -D_LIBC
261.37SadCPPFLAGS+=	-D__LIBPTHREAD_SOURCE__
271.9Sthorpej
281.35Schristos# XXX: This crappy poke at libc's internals needs to be fixed.
291.35Schristos# We need to put this *after our own includes, so that our "assym.h"
301.35Schristos# gets picked, instead of the libc one
311.35SchristosCPPFLAGS+=-I${NETBSDSRCDIR}/sys -I${.CURDIR}/../libc
321.35Schristos
331.9SthorpejDPSRCS+=	assym.h
341.20SlukemCLEANFILES+=	assym.h
351.9Sthorpej
361.31Sthorpejassym.h: ${ARCHDIR}/genassym.cf pthread.h pthread_int.h pthread_md.h
371.25Slukem	${_MKTARGET_CREATE}
381.31Sthorpej	${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
391.9Sthorpej		< ${ARCHDIR}/genassym.cf > assym.h.tmp && \
401.9Sthorpej	mv -f assym.h.tmp assym.h
411.9Sthorpej
421.9SthorpejLIB=	pthread
431.9Sthorpej
441.9Sthorpej#
451.9Sthorpej# NOTE: When you create a new file for libpthread, make sure that pthread.c
461.9Sthorpej# gets a reference to a symbol in that file.  Otherwise, Unix's stupid static
471.9Sthorpej# library semantics will end up discarding potentially important objects.
481.9Sthorpej#
491.9SthorpejSRCS=	pthread.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.40SadSRCS+=	pthread_misc.c
561.9SthorpejSRCS+=	pthread_mutex.c
571.43SadSRCS+=	pthread_mutex2.c
581.9SthorpejSRCS+=	pthread_rwlock.c
591.43SadSRCS+=	pthread_rwlock2.c
601.9SthorpejSRCS+=	pthread_specific.c
611.42SadSRCS+=	pthread_spin.c
621.21SnathanwSRCS+=	pthread_tsd.c
631.9SthorpejSRCS+=  pthread_debug.c
641.26SchristosSRCS+=	res_state.c
651.9SthorpejSRCS+=	sched.c
661.11SchristosSRCS+=	sem.c
671.9Sthorpej# Architecture-dependent files
681.36SadSRCS+=	_context_u.S
691.9Sthorpej.if exists(${ARCHDIR}/pthread_md.c)
701.9SthorpejSRCS+= pthread_md.c
711.9Sthorpej.endif
721.21Snathanw
731.21Snathanw# The TSD routines are used in the implementation of profiling, and so
741.21Snathanw# can't be profiled themselves.
751.44SadCOPTS.pthread_specific.c+=	-fomit-frame-pointer -falign-functions=32
761.21Snathanwpthread_specific.po: pthread_specific.o
771.25Slukem	${_MKTARGET_CREATE}
781.21Snathanw	cp pthread_specific.o pthread_specific.po
791.21Snathanw
801.42Sad# Internal spinlock routines are performance critical.  Don't profile them,
811.42Sad# it's incompatibile with -fomit-frame-pointer.
821.42SadCOPTS.pthread_lock.c+=	-fomit-frame-pointer -falign-functions=32
831.42Sadpthread_lock.po: pthread_lock.o
841.42Sad	${_MKTARGET_CREATE}
851.42Sad	cp pthread_lock.o pthread_lock.po
861.42Sad
871.45SjnemethCOPTS.pthread.c += -Wno-stack-protector
881.45Sjnemeth
891.21Snathanw_context_u.po: _context_u.o
901.25Slukem	${_MKTARGET_CREATE}
911.21Snathanw	cp _context_u.o _context_u.po
921.17Snathanw
931.19SwizMAN+=	pthread.3 \
941.23Schristos	pthread_attr.3 pthread_attr_setcreatesuspend_np.3 \
951.17Snathanw	pthread_barrier_destroy.3 pthread_barrier_init.3 \
961.17Snathanw	pthread_barrier_wait.3 pthread_barrierattr.3 \
971.17Snathanw	pthread_cancel.3 pthread_cleanup_push.3 \
981.17Snathanw	pthread_cond_broadcast.3 pthread_cond_destroy.3 pthread_cond_init.3 \
991.17Snathanw	pthread_cond_wait.3 \
1001.17Snathanw	pthread_condattr.3 pthread_create.3 pthread_detach.3 pthread_equal.3 \
1011.17Snathanw	pthread_exit.3 pthread_getspecific.3 pthread_join.3 \
1021.17Snathanw	pthread_key_create.3 pthread_key_delete.3 pthread_kill.3 \
1031.17Snathanw	pthread_mutex_destroy.3 pthread_mutex_init.3 pthread_mutex_lock.3 \
1041.17Snathanw	pthread_mutex_unlock.3 pthread_mutexattr.3 \
1051.17Snathanw	pthread_once.3 pthread_rwlock_destroy.3 pthread_rwlock_init.3 \
1061.17Snathanw	pthread_rwlock_rdlock.3 pthread_rwlock_unlock.3 \
1071.17Snathanw	pthread_rwlock_wrlock.3 pthread_rwlockattr.3 \
1081.17Snathanw	pthread_schedparam.3 pthread_self.3 \
1091.17Snathanw	pthread_setspecific.3 pthread_sigmask.3 pthread_spin_destroy.3 \
1101.17Snathanw	pthread_spin_init.3 pthread_spin_lock.3 pthread_spin_unlock.3 \
1111.29Syamt	pthread_suspend_np.3 pthread_testcancel.3 \
1121.29Syamt	sched_yield.3
1131.17Snathanw
1141.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_init.3
1151.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_destroy.3
1161.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_setdetachstate.3
1171.17SnathanwMLINKS+=	pthread_attr.3 pthread_attr_getdetachstate.3
1181.33SpeterMLINKS+=	pthread_attr.3 pthread_attr_setschedparam.3
1191.33SpeterMLINKS+=	pthread_attr.3 pthread_attr_getschedparam.3
1201.32SpeterMLINKS+=	pthread_barrierattr.3 pthread_barrierattr_init.3
1211.32SpeterMLINKS+=	pthread_barrierattr.3 pthread_barrierattr_destroy.3
1221.17SnathanwMLINKS+=	pthread_cleanup_push.3 pthread_cleanup_pop.3
1231.17SnathanwMLINKS+=	pthread_cond_broadcast.3 pthread_cond_signal.3
1241.17SnathanwMLINKS+=	pthread_cond_wait.3 pthread_cond_timedwait.3
1251.17SnathanwMLINKS+=	pthread_condattr.3 pthread_condattr_init.3
1261.17SnathanwMLINKS+=	pthread_condattr.3 pthread_condattr_destroy.3
1271.17SnathanwMLINKS+=	pthread_mutex_lock.3 pthread_mutex_trylock.3
1281.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_init.3
1291.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_destroy.3
1301.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_settype.3
1311.17SnathanwMLINKS+=	pthread_mutexattr.3 pthread_mutexattr_gettype.3
1321.17SnathanwMLINKS+=	pthread_rwlock_rdlock.3 pthread_rwlock_timedrdlock.3
1331.17SnathanwMLINKS+=	pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3
1341.17SnathanwMLINKS+=	pthread_rwlock_wrlock.3 pthread_rwlock_timedwrlock.3
1351.17SnathanwMLINKS+=	pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
1361.17SnathanwMLINKS+=	pthread_rwlockattr.3 pthread_rwlockattr_init.3
1371.17SnathanwMLINKS+=	pthread_rwlockattr.3 pthread_rwlockattr_destroy.3
1381.17SnathanwMLINKS+=	pthread_schedparam.3 pthread_setschedparam.3
1391.17SnathanwMLINKS+=	pthread_schedparam.3 pthread_getschedparam.3
1401.27SpookaMLINKS+=	pthread_spin_lock.3 pthread_spin_trylock.3
1411.23SchristosMLINKS+=	pthread_suspend_np.3 pthread_resume_np.3
1421.17SnathanwMLINKS+=	pthread_testcancel.3 pthread_setcancelstate.3
1431.17SnathanwMLINKS+=	pthread_testcancel.3 pthread_setcanceltype.3
1441.9Sthorpej
1451.9Sthorpejpthread_switch.S _context_u.S: assym.h
1461.9Sthorpej
1471.9Sthorpejdebuglog: debuglog.o
1481.9Sthorpej	$(CC) -o debuglog debuglog.o -lpthread
1491.1Sproven
1501.1Sproven.include <bsd.lib.mk>
1511.1Sproven
1521.9Sthorpej.else
1531.9Sthorpej
1541.9Sthorpej.include <bsd.man.mk>
1551.10Sthorpej.include <bsd.files.mk>
1561.10Sthorpej.include <bsd.inc.mk>
1571.9Sthorpej
1581.9Sthorpej.endif
1591.9Sthorpej
1601.9Sthorpej# WARNS=2 sets -Wcast-qual. This causes problems for one of
1611.9Sthorpej# pthread_setspecific() and pthread_getspecific(), since the constness
1621.9Sthorpej# of the argument to setspecific() has to be discarded *somewhere*
1631.9Sthorpej# before returning it from getspecific().
1641.9SthorpejCFLAGS+= -Wno-cast-qual
165