Makefile revision 1.88
11.88Schs# $NetBSD: Makefile,v 1.88 2018/02/25 18:51:18 chs Exp $ 21.9Sthorpej# 31.9Sthorpej 41.75SmattWARNS?= 5 51.85SpookaLIB= pthread 61.24Scl 71.9Sthorpej.include <bsd.own.mk> 81.9Sthorpej 91.55Smrg.if defined(PTHREAD_MACHINE_ARCH) && !empty(PTHREAD_MACHINE_ARCH) && \ 101.55Smrg exists(${.CURDIR}/arch/${PTHREAD_MACHINE_ARCH}) 111.55SmrgARCHSUBDIR= ${PTHREAD_MACHINE_ARCH} 121.84Smatt.elif defined(PTHREAD_MACHINE_CPU) && !empty(PTHREAD_MACHINE_CPU) && \ 131.84Smatt exists(${.CURDIR}/arch/${PTHREAD_MACHINE_CPU}) 141.84SmattARCHSUBDIR= ${PTHREAD_MACHINE_CPU} 151.55Smrg.elif exists(${.CURDIR}/arch/${MACHINE_ARCH}) 161.9SthorpejARCHSUBDIR= ${MACHINE_ARCH} 171.9Sthorpej.elif exists(${.CURDIR}/arch/${MACHINE_CPU}) 181.9SthorpejARCHSUBDIR= ${MACHINE_CPU} 191.9Sthorpej.else 201.9Sthorpej.BEGIN: 211.10Sthorpej @echo "WARNING: no ARCHSUBDIR for ${MACHINE_ARCH}/${MACHINE_CPU}; skipping..." 221.9Sthorpej.endif 231.9Sthorpej 241.10SthorpejINCS= pthread.h pthread_types.h pthread_queue.h 251.10SthorpejINCSDIR=/usr/include 261.10Sthorpej 271.9Sthorpej.if defined(ARCHSUBDIR) 281.9Sthorpej 291.9SthorpejARCHDIR= ${.CURDIR}/arch/${ARCHSUBDIR} 301.9Sthorpej.PATH: ${ARCHDIR} 311.9Sthorpej 321.80SchristosCPPFLAGS+= -I${ARCHDIR} -I${.CURDIR} -I${.OBJDIR} -D_LIBC -D_REENTRANT 331.80SchristosCPPFLAGS+= -I${.CURDIR}/../libc/include 341.80SchristosCPPFLAGS+= -D__LIBPTHREAD_SOURCE__ -D__LIBC_THREAD_STUBS 351.9Sthorpej 361.35Schristos# XXX: This crappy poke at libc's internals needs to be fixed. 371.35SchristosCPPFLAGS+=-I${NETBSDSRCDIR}/sys -I${.CURDIR}/../libc 381.35Schristos 391.85Spooka# providing alternative MI implementations for creating an lwp is 401.85Spooka# possible by setting PTHREAD_MAKELWP. Currently, alternatives are 411.85Spooka# set by the rumprun software stacks (see repo.rumpkernel.org) 421.85SpookaPTHREAD_MAKELWP?= pthread_makelwp_netbsd.c 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.85Spooka# used by rumprun-posix to work around symbol collisions 531.85Spooka.if ${PTHREAD_CANCELSTUB:Uyes} != "no" 541.9SthorpejSRCS+= pthread_cancelstub.c 551.85Spooka.endif 561.9SthorpejSRCS+= pthread_cond.c 571.86SchristosSRCS+= pthread_getcpuclockid.c 581.9SthorpejSRCS+= pthread_lock.c 591.85SpookaSRCS+= ${PTHREAD_MAKELWP} 601.40SadSRCS+= pthread_misc.c 611.9SthorpejSRCS+= pthread_mutex.c 621.74SjoergSRCS+= pthread_once.c 631.9SthorpejSRCS+= pthread_rwlock.c 641.9SthorpejSRCS+= pthread_specific.c 651.42SadSRCS+= pthread_spin.c 661.21SnathanwSRCS+= pthread_tsd.c 671.26SchristosSRCS+= res_state.c 681.11SchristosSRCS+= sem.c 691.9Sthorpej# Architecture-dependent files 701.56Sad.if exists(${ARCHDIR}/pthread_md.S) 711.56SadSRCS+= pthread_md.S 721.9Sthorpej.endif 731.82Smatt.if exists(${ARCHDIR}/Makefile.inc) 741.82Smatt.include "${ARCHDIR}/Makefile.inc" 751.82Smatt.endif 761.21Snathanw 771.79Sapb# The PTHREAD__COMPAT flag builds a libpthread that can be dropped 781.79Sapb# into a NetBSD 2/3/4 chroot with a NetBSD 5 or later kernel. 791.79Sapb# This makes threading work in the chroot, no other modifications 801.79Sapb# required. 811.79Sapb# 821.53Sad.if defined(PTHREAD__COMPAT) 831.53SadSRCS+= pthread_compat.c 841.53Sad.PATH.c: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic 851.53Sad.PATH.S: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic 861.53Sad.PATH.c: ${.CURDIR}/../../common/lib/libc/atomic 871.53Sad.PATH.c: ${.CURDIR}/../libc/misc 881.53Sad.include "../../common/lib/libc/arch/${ARCHSUBDIR}/atomic/Makefile.inc" 891.53Sad.endif 901.53Sad 911.76SjoergALIGN_FUNCTIONS= ${${ACTIVE_CC} == "gcc":? -falign-functions=32 :} 921.76Sjoerg 931.21Snathanw# The TSD routines are used in the implementation of profiling, and so 941.21Snathanw# can't be profiled themselves. 951.88SchsCOPTS.pthread_specific.c+= ${ALIGN_FUNCTIONS} 961.21Snathanwpthread_specific.po: pthread_specific.o 971.25Slukem ${_MKTARGET_CREATE} 981.21Snathanw cp pthread_specific.o pthread_specific.po 991.21Snathanw 1001.72SchristosCOPTS.pthread.c += -Wno-stack-protector -Wno-format-nonliteral 1011.72SchristosCOPTS.pthread_attr.c += -Wno-format-nonliteral 1021.45Sjnemeth 1031.52SrmindMAN+= affinity.3 pthread.3 \ 1041.48Syamt pthread_attr.3 \ 1051.58Sjruoho pthread_attr_get_np.3 \ 1061.60Sjruoho pthread_attr_getdetachstate.3 \ 1071.62Sjruoho pthread_attr_getguardsize.3 \ 1081.63Sjruoho pthread_attr_getinheritsched.3 \ 1091.48Syamt pthread_attr_getname_np.3 \ 1101.64Sjruoho pthread_attr_getschedparam.3 \ 1111.59Sjruoho pthread_attr_getscope.3 \ 1121.61Sjruoho pthread_attr_getstack.3 \ 1131.48Syamt pthread_attr_setcreatesuspend_np.3 \ 1141.66Srmind pthread_barrier.3 pthread_barrierattr.3 \ 1151.17Snathanw pthread_cancel.3 pthread_cleanup_push.3 \ 1161.66Srmind pthread_cond.3 pthread_condattr.3 \ 1171.66Srmind pthread_create.3 pthread_detach.3 pthread_equal.3 \ 1181.73Syamt pthread_curcpu_np.3 \ 1191.48Syamt pthread_exit.3 \ 1201.86Schristos pthread_getcpuclockid.3 \ 1211.48Syamt pthread_getname_np.3 \ 1221.48Syamt pthread_getspecific.3 pthread_join.3 \ 1231.69Sjruoho pthread_key_create.3 pthread_kill.3 \ 1241.66Srmind pthread_mutex.3 pthread_mutexattr.3 \ 1251.66Srmind pthread_once.3 pthread_rwlock.3 pthread_rwlockattr.3 \ 1261.17Snathanw pthread_schedparam.3 pthread_self.3 \ 1271.69Sjruoho pthread_sigmask.3 pthread_spin.3 \ 1281.51Srmind pthread_suspend_np.3 pthread_testcancel.3 1291.17Snathanw 1301.70SchristosMLINKS+= pthread_attr_get_np.3 pthread_getattr_np.3 1311.52SrmindMLINKS+= affinity.3 pthread_setaffinity_np.3 1321.52SrmindMLINKS+= affinity.3 pthread_getaffinity_np.3 1331.57Sjruoho 1341.17SnathanwMLINKS+= pthread_attr.3 pthread_attr_init.3 1351.17SnathanwMLINKS+= pthread_attr.3 pthread_attr_destroy.3 1361.59Sjruoho 1371.60SjruohoMLINKS+= pthread_attr_getdetachstate.3 pthread_attr_setdetachstate.3 1381.62SjruohoMLINKS+= pthread_attr_getguardsize.3 pthread_attr_setguardsize.3 1391.63SjruohoMLINKS+= pthread_attr_getinheritsched.3 pthread_attr_setinheritsched.3 1401.68SjruohoMLINKS+= pthread_attr_getname_np.3 pthread_attr_setname_np.3 1411.67Sjruoho 1421.67SjruohoMLINKS+= pthread_attr_getschedparam.3 pthread_attr_setschedparam.3 \ 1431.67Sjruoho pthread_attr_getschedparam.3 pthread_attr_getschedpolicy.3 \ 1441.67Sjruoho pthread_attr_getschedparam.3 pthread_attr_setschedpolicy.3 1451.67Sjruoho 1461.59SjruohoMLINKS+= pthread_attr_getscope.3 pthread_attr_setscope.3 1471.67Sjruoho 1481.61SjruohoMLINKS+= pthread_attr_getstack.3 pthread_attr_setstack.3 \ 1491.61Sjruoho pthread_attr_getstack.3 pthread_attr_getstacksize.3 \ 1501.61Sjruoho pthread_attr_getstack.3 pthread_attr_setstacksize.3 \ 1511.61Sjruoho pthread_attr_getstack.3 pthread_attr_getstackaddr.3 \ 1521.61Sjruoho pthread_attr_getstack.3 pthread_attr_setstackaddr.3 1531.57Sjruoho 1541.66SrmindMLINKS+= pthread_cleanup_push.3 pthread_cleanup_pop.3 1551.66Srmind 1561.66SrmindMLINKS+= pthread_barrier.3 pthread_barrier_init.3 1571.66SrmindMLINKS+= pthread_barrier.3 pthread_barrier_destroy.3 1581.66SrmindMLINKS+= pthread_barrier.3 pthread_barrier_wait.3 1591.66Srmind 1601.32SpeterMLINKS+= pthread_barrierattr.3 pthread_barrierattr_init.3 1611.32SpeterMLINKS+= pthread_barrierattr.3 pthread_barrierattr_destroy.3 1621.87SchristosMLINKS+= pthread_barrierattr.3 pthread_barrierattr_getpshared.3 1631.87SchristosMLINKS+= pthread_barrierattr.3 pthread_barrierattr_setpshared.3 1641.66Srmind 1651.66SrmindMLINKS+= pthread_cond.3 pthread_cond_init.3 1661.66SrmindMLINKS+= pthread_cond.3 pthread_cond_destroy.3 1671.66SrmindMLINKS+= pthread_cond.3 pthread_cond_broadcast.3 1681.66SrmindMLINKS+= pthread_cond.3 pthread_cond_wait.3 1691.66SrmindMLINKS+= pthread_cond.3 pthread_cond_signal.3 1701.66SrmindMLINKS+= pthread_cond.3 pthread_cond_timedwait.3 1711.66Srmind 1721.17SnathanwMLINKS+= pthread_condattr.3 pthread_condattr_init.3 1731.17SnathanwMLINKS+= pthread_condattr.3 pthread_condattr_destroy.3 1741.78SriastradMLINKS+= pthread_condattr.3 pthread_condattr_setclock.3 1751.87SchristosMLINKS+= pthread_condattr.3 pthread_condattr_getclock.3 1761.87SchristosMLINKS+= pthread_condattr.3 pthread_condattr_getpshared.3 1771.87SchristosMLINKS+= pthread_condattr.3 pthread_condattr_setpshared.3 1781.66Srmind 1791.68SjruohoMLINKS+= pthread_getname_np.3 pthread_setname_np.3 1801.69SjruohoMLINKS+= pthread_getspecific.3 pthread_setspecific.3 1811.69SjruohoMLINKS+= pthread_key_create.3 pthread_key_delete.3 1821.68Sjruoho 1831.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_init.3 1841.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_destroy.3 1851.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_lock.3 1861.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_trylock.3 1871.66SrmindMLINKS+= pthread_mutex.3 pthread_mutex_unlock.3 1881.87SchristosMLINKS+= pthread_mutex.3 pthread_mutex_timedlock.3 1891.87SchristosMLINKS+= pthread_mutex.3 pthread_mutex_getprioceiling.3 1901.87SchristosMLINKS+= pthread_mutex.3 pthread_mutex_setprioceiling.3 1911.66Srmind 1921.17SnathanwMLINKS+= pthread_mutexattr.3 pthread_mutexattr_init.3 1931.17SnathanwMLINKS+= pthread_mutexattr.3 pthread_mutexattr_destroy.3 1941.87SchristosMLINKS+= pthread_mutexattr.3 pthread_mutexattr_getpshared.3 1951.87SchristosMLINKS+= pthread_mutexattr.3 pthread_mutexattr_setpshared.3 1961.17SnathanwMLINKS+= pthread_mutexattr.3 pthread_mutexattr_settype.3 1971.17SnathanwMLINKS+= pthread_mutexattr.3 pthread_mutexattr_gettype.3 1981.87SchristosMLINKS+= pthread_mutexattr.3 pthread_mutexattr_getprotocol.3 1991.87SchristosMLINKS+= pthread_mutexattr.3 pthread_mutexattr_setprotocol.3 2001.87SchristosMLINKS+= pthread_mutexattr.3 pthread_mutexattr_getprioceiling.3 2011.87SchristosMLINKS+= pthread_mutexattr.3 pthread_mutexattr_setprioceiling.3 2021.66Srmind 2031.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_init.3 2041.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_destroy.3 2051.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_rdlock.3 2061.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_wrlock.3 2071.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_unlock.3 2081.66Srmind 2091.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_timedrdlock.3 2101.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_timedwrlock.3 2111.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_tryrdlock.3 2121.66SrmindMLINKS+= pthread_rwlock.3 pthread_rwlock_trywrlock.3 2131.66Srmind 2141.17SnathanwMLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_init.3 2151.17SnathanwMLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_destroy.3 2161.87SchristosMLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_getpshared.3 2171.87SchristosMLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_setpshared.3 2181.66Srmind 2191.66SrmindMLINKS+= pthread_spin.3 pthread_spin_init.3 2201.66SrmindMLINKS+= pthread_spin.3 pthread_spin_destroy.3 2211.66SrmindMLINKS+= pthread_spin.3 pthread_spin_lock.3 2221.66SrmindMLINKS+= pthread_spin.3 pthread_spin_trylock.3 2231.66SrmindMLINKS+= pthread_spin.3 pthread_spin_unlock.3 2241.66Srmind 2251.17SnathanwMLINKS+= pthread_schedparam.3 pthread_setschedparam.3 2261.17SnathanwMLINKS+= pthread_schedparam.3 pthread_getschedparam.3 2271.23SchristosMLINKS+= pthread_suspend_np.3 pthread_resume_np.3 2281.17SnathanwMLINKS+= pthread_testcancel.3 pthread_setcancelstate.3 2291.17SnathanwMLINKS+= pthread_testcancel.3 pthread_setcanceltype.3 2301.9Sthorpej 2311.1Sproven.include <bsd.lib.mk> 2321.1Sproven 2331.9Sthorpej.else 2341.9Sthorpej 2351.9Sthorpej.include <bsd.man.mk> 2361.10Sthorpej.include <bsd.files.mk> 2371.10Sthorpej.include <bsd.inc.mk> 2381.9Sthorpej 2391.9Sthorpej.endif 2401.9Sthorpej 2411.9Sthorpej# WARNS=2 sets -Wcast-qual. This causes problems for one of 2421.9Sthorpej# pthread_setspecific() and pthread_getspecific(), since the constness 2431.9Sthorpej# of the argument to setspecific() has to be discarded *somewhere* 2441.9Sthorpej# before returning it from getspecific(). 2451.77SmattCWARNFLAGS+= -Wno-cast-qual 246