Makefile revision 1.82
11.82Smatt# $NetBSD: Makefile,v 1.82 2013/08/15 22:38:24 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.80SchristosCPPFLAGS+= -I${ARCHDIR} -I${.CURDIR} -I${.OBJDIR} -D_LIBC -D_REENTRANT 291.80SchristosCPPFLAGS+= -I${.CURDIR}/../libc/include 301.80SchristosCPPFLAGS+= -D__LIBPTHREAD_SOURCE__ -D__LIBC_THREAD_STUBS 311.9Sthorpej 321.35Schristos# XXX: This crappy poke at libc's internals needs to be fixed. 331.35SchristosCPPFLAGS+=-I${NETBSDSRCDIR}/sys -I${.CURDIR}/../libc 341.35Schristos 351.9SthorpejLIB= pthread 361.9Sthorpej 371.9Sthorpej# 381.9Sthorpej# NOTE: When you create a new file for libpthread, make sure that pthread.c 391.9Sthorpej# gets a reference to a symbol in that file. Otherwise, Unix's stupid static 401.9Sthorpej# library semantics will end up discarding potentially important objects. 411.9Sthorpej# 421.9SthorpejSRCS= pthread.c 431.18SnathanwSRCS+= pthread_attr.c 441.9SthorpejSRCS+= pthread_barrier.c 451.9SthorpejSRCS+= pthread_cancelstub.c 461.9SthorpejSRCS+= pthread_cond.c 471.9SthorpejSRCS+= pthread_lock.c 481.40SadSRCS+= pthread_misc.c 491.9SthorpejSRCS+= pthread_mutex.c 501.74SjoergSRCS+= pthread_once.c 511.9SthorpejSRCS+= pthread_rwlock.c 521.9SthorpejSRCS+= pthread_specific.c 531.42SadSRCS+= pthread_spin.c 541.21SnathanwSRCS+= pthread_tsd.c 551.26SchristosSRCS+= res_state.c 561.11SchristosSRCS+= sem.c 571.9Sthorpej# Architecture-dependent files 581.56Sad.if exists(${ARCHDIR}/pthread_md.S) 591.56SadSRCS+= pthread_md.S 601.9Sthorpej.endif 611.82Smatt.if exists(${ARCHDIR}/Makefile.inc) 621.82Smatt.include "${ARCHDIR}/Makefile.inc" 631.82Smatt.endif 641.21Snathanw 651.79Sapb# The PTHREAD__COMPAT flag builds a libpthread that can be dropped 661.79Sapb# into a NetBSD 2/3/4 chroot with a NetBSD 5 or later kernel. 671.79Sapb# This makes threading work in the chroot, no other modifications 681.79Sapb# required. 691.79Sapb# 701.53Sad.if defined(PTHREAD__COMPAT) 711.53SadSRCS+= pthread_compat.c 721.53Sad.PATH.c: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic 731.53Sad.PATH.S: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic 741.53Sad.PATH.c: ${.CURDIR}/../../common/lib/libc/atomic 751.53Sad.PATH.c: ${.CURDIR}/../libc/misc 761.53Sad.include "../../common/lib/libc/arch/${ARCHSUBDIR}/atomic/Makefile.inc" 771.53Sad.endif 781.53Sad 791.76SjoergALIGN_FUNCTIONS= ${${ACTIVE_CC} == "gcc":? -falign-functions=32 :} 801.76Sjoerg 811.81Sjoerg.if ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "m68000" || \ 821.81Sjoerg ${MACHINE_CPU} == "sh3" || ${MACHINE_ARCH} == "vax" 831.81SjoergOMIT_FRAME_POINTER= 841.81Sjoerg.else 851.81SjoergOMIT_FRAME_POINTER= -fomit-frame-pointer 861.81Sjoerg.endif 871.81Sjoerg 881.21Snathanw# The TSD routines are used in the implementation of profiling, and so 891.21Snathanw# can't be profiled themselves. 901.81SjoergCOPTS.pthread_specific.c+= ${OMIT_FRAME_POINTER} ${ALIGN_FUNCTIONS} 911.21Snathanwpthread_specific.po: pthread_specific.o 921.25Slukem ${_MKTARGET_CREATE} 931.21Snathanw cp pthread_specific.o pthread_specific.po 941.21Snathanw 951.42Sad# Internal spinlock routines are performance critical. Don't profile them, 961.42Sad# it's incompatibile with -fomit-frame-pointer. 971.81SjoergCOPTS.pthread_lock.c+= ${OMIT_FRAME_POINTER} ${ALIGN_FUNCTIONS} 981.42Sadpthread_lock.po: pthread_lock.o 991.42Sad ${_MKTARGET_CREATE} 1001.42Sad cp pthread_lock.o pthread_lock.po 1011.42Sad 1021.81SjoergCOPTS.pthread_mutex.c+= ${OMIT_FRAME_POINTER} ${ALIGN_FUNCTIONS} 1031.50Sadpthread_mutex.po: pthread_mutex.o 1041.46Sad ${_MKTARGET_CREATE} 1051.50Sad cp pthread_mutex.o pthread_mutex.po 1061.46Sad 1071.72SchristosCOPTS.pthread.c += -Wno-stack-protector -Wno-format-nonliteral 1081.72SchristosCOPTS.pthread_attr.c += -Wno-format-nonliteral 1091.45Sjnemeth 1101.52SrmindMAN+= affinity.3 pthread.3 \ 1111.48Syamt pthread_attr.3 \ 1121.58Sjruoho pthread_attr_get_np.3 \ 1131.60Sjruoho pthread_attr_getdetachstate.3 \ 1141.62Sjruoho pthread_attr_getguardsize.3 \ 1151.63Sjruoho pthread_attr_getinheritsched.3 \ 1161.48Syamt pthread_attr_getname_np.3 \ 1171.64Sjruoho pthread_attr_getschedparam.3 \ 1181.59Sjruoho pthread_attr_getscope.3 \ 1191.61Sjruoho pthread_attr_getstack.3 \ 1201.48Syamt pthread_attr_setcreatesuspend_np.3 \ 1211.66Srmind pthread_barrier.3 pthread_barrierattr.3 \ 1221.17Snathanw pthread_cancel.3 pthread_cleanup_push.3 \ 1231.66Srmind pthread_cond.3 pthread_condattr.3 \ 1241.66Srmind pthread_create.3 pthread_detach.3 pthread_equal.3 \ 1251.73Syamt pthread_curcpu_np.3 \ 1261.48Syamt pthread_exit.3 \ 1271.48Syamt pthread_getname_np.3 \ 1281.48Syamt pthread_getspecific.3 pthread_join.3 \ 1291.69Sjruoho pthread_key_create.3 pthread_kill.3 \ 1301.66Srmind pthread_mutex.3 pthread_mutexattr.3 \ 1311.66Srmind pthread_once.3 pthread_rwlock.3 pthread_rwlockattr.3 \ 1321.17Snathanw pthread_schedparam.3 pthread_self.3 \ 1331.69Sjruoho pthread_sigmask.3 pthread_spin.3 \ 1341.51Srmind pthread_suspend_np.3 pthread_testcancel.3 1351.17Snathanw 1361.70SchristosMLINKS+= pthread_attr_get_np.3 pthread_getattr_np.3 1371.52SrmindMLINKS+= affinity.3 pthread_setaffinity_np.3 1381.52SrmindMLINKS+= affinity.3 pthread_getaffinity_np.3 1391.57Sjruoho 1401.17SnathanwMLINKS+= pthread_attr.3 pthread_attr_init.3 1411.17SnathanwMLINKS+= pthread_attr.3 pthread_attr_destroy.3 1421.59Sjruoho 1431.60SjruohoMLINKS+= pthread_attr_getdetachstate.3 pthread_attr_setdetachstate.3 1441.62SjruohoMLINKS+= pthread_attr_getguardsize.3 pthread_attr_setguardsize.3 1451.63SjruohoMLINKS+= pthread_attr_getinheritsched.3 pthread_attr_setinheritsched.3 1461.68SjruohoMLINKS+= pthread_attr_getname_np.3 pthread_attr_setname_np.3 1471.67Sjruoho 1481.67SjruohoMLINKS+= pthread_attr_getschedparam.3 pthread_attr_setschedparam.3 \ 1491.67Sjruoho pthread_attr_getschedparam.3 pthread_attr_getschedpolicy.3 \ 1501.67Sjruoho pthread_attr_getschedparam.3 pthread_attr_setschedpolicy.3 1511.67Sjruoho 1521.59SjruohoMLINKS+= pthread_attr_getscope.3 pthread_attr_setscope.3 1531.67Sjruoho 1541.61SjruohoMLINKS+= pthread_attr_getstack.3 pthread_attr_setstack.3 \ 1551.61Sjruoho pthread_attr_getstack.3 pthread_attr_getstacksize.3 \ 1561.61Sjruoho pthread_attr_getstack.3 pthread_attr_setstacksize.3 \ 1571.61Sjruoho pthread_attr_getstack.3 pthread_attr_getstackaddr.3 \ 1581.61Sjruoho pthread_attr_getstack.3 pthread_attr_setstackaddr.3 1591.57Sjruoho 1601.66SrmindMLINKS+= pthread_cleanup_push.3 pthread_cleanup_pop.3 1611.66Srmind 1621.66SrmindMLINKS+= pthread_barrier.3 pthread_barrier_init.3 1631.66SrmindMLINKS+= pthread_barrier.3 pthread_barrier_destroy.3 1641.66SrmindMLINKS+= pthread_barrier.3 pthread_barrier_wait.3 1651.66Srmind 1661.32SpeterMLINKS+= pthread_barrierattr.3 pthread_barrierattr_init.3 1671.32SpeterMLINKS+= pthread_barrierattr.3 pthread_barrierattr_destroy.3 1681.66Srmind 1691.66SrmindMLINKS+= pthread_cond.3 pthread_cond_init.3 1701.66SrmindMLINKS+= pthread_cond.3 pthread_cond_destroy.3 1711.66SrmindMLINKS+= pthread_cond.3 pthread_cond_broadcast.3 1721.66SrmindMLINKS+= pthread_cond.3 pthread_cond_wait.3 1731.66SrmindMLINKS+= pthread_cond.3 pthread_cond_signal.3 1741.66SrmindMLINKS+= pthread_cond.3 pthread_cond_timedwait.3 1751.66Srmind 1761.17SnathanwMLINKS+= pthread_condattr.3 pthread_condattr_init.3 1771.17SnathanwMLINKS+= pthread_condattr.3 pthread_condattr_destroy.3 1781.78SriastradMLINKS+= pthread_condattr.3 pthread_condattr_setclock.3 1791.66Srmind 1801.68SjruohoMLINKS+= pthread_getname_np.3 pthread_setname_np.3 1811.69SjruohoMLINKS+= pthread_getspecific.3 pthread_setspecific.3 1821.69SjruohoMLINKS+= pthread_key_create.3 pthread_key_delete.3 1831.68Sjruoho 1841.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_init.3 1851.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_destroy.3 1861.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_lock.3 1871.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_trylock.3 1881.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_unlock.3 1891.66Srmind 1901.17SnathanwMLINKS+= pthread_mutexattr.3 pthread_mutexattr_init.3 1911.17SnathanwMLINKS+= pthread_mutexattr.3 pthread_mutexattr_destroy.3 1921.17SnathanwMLINKS+= pthread_mutexattr.3 pthread_mutexattr_settype.3 1931.17SnathanwMLINKS+= pthread_mutexattr.3 pthread_mutexattr_gettype.3 1941.66Srmind 1951.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_init.3 1961.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_destroy.3 1971.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_rdlock.3 1981.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_wrlock.3 1991.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_unlock.3 2001.66Srmind 2011.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_timedrdlock.3 2021.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_timedwrlock.3 2031.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_tryrdlock.3 2041.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_trywrlock.3 2051.66Srmind 2061.17SnathanwMLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_init.3 2071.17SnathanwMLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_destroy.3 2081.66Srmind 2091.66SrmindMLINKS+= pthread_spin.3 pthread_spin_init.3 2101.66SrmindMLINKS+= pthread_spin.3 pthread_spin_destroy.3 2111.66SrmindMLINKS+= pthread_spin.3 pthread_spin_lock.3 2121.66SrmindMLINKS+= pthread_spin.3 pthread_spin_trylock.3 2131.66SrmindMLINKS+= pthread_spin.3 pthread_spin_unlock.3 2141.66Srmind 2151.17SnathanwMLINKS+= pthread_schedparam.3 pthread_setschedparam.3 2161.17SnathanwMLINKS+= pthread_schedparam.3 pthread_getschedparam.3 2171.23SchristosMLINKS+= pthread_suspend_np.3 pthread_resume_np.3 2181.17SnathanwMLINKS+= pthread_testcancel.3 pthread_setcancelstate.3 2191.17SnathanwMLINKS+= pthread_testcancel.3 pthread_setcanceltype.3 2201.9Sthorpej 2211.1Sproven.include <bsd.lib.mk> 2221.1Sproven 2231.9Sthorpej.else 2241.9Sthorpej 2251.9Sthorpej.include <bsd.man.mk> 2261.10Sthorpej.include <bsd.files.mk> 2271.10Sthorpej.include <bsd.inc.mk> 2281.9Sthorpej 2291.9Sthorpej.endif 2301.9Sthorpej 2311.9Sthorpej# WARNS=2 sets -Wcast-qual. This causes problems for one of 2321.9Sthorpej# pthread_setspecific() and pthread_getspecific(), since the constness 2331.9Sthorpej# of the argument to setspecific() has to be discarded *somewhere* 2341.9Sthorpej# before returning it from getspecific(). 2351.77SmattCWARNFLAGS+= -Wno-cast-qual 236