Makefile revision 1.55
1# $NetBSD: Makefile,v 1.55 2008/10/26 00:00:27 mrg Exp $ 2# 3 4WARNS= 4 5 6.include <bsd.own.mk> 7 8.if defined(PTHREAD_MACHINE_ARCH) && !empty(PTHREAD_MACHINE_ARCH) && \ 9 exists(${.CURDIR}/arch/${PTHREAD_MACHINE_ARCH}) 10ARCHSUBDIR= ${PTHREAD_MACHINE_ARCH} 11.elif exists(${.CURDIR}/arch/${MACHINE_ARCH}) 12ARCHSUBDIR= ${MACHINE_ARCH} 13.elif exists(${.CURDIR}/arch/${MACHINE_CPU}) 14ARCHSUBDIR= ${MACHINE_CPU} 15.else 16.BEGIN: 17 @echo "WARNING: no ARCHSUBDIR for ${MACHINE_ARCH}/${MACHINE_CPU}; skipping..." 18.endif 19 20INCS= pthread.h pthread_types.h pthread_queue.h 21INCSDIR=/usr/include 22 23.if defined(ARCHSUBDIR) 24 25ARCHDIR= ${.CURDIR}/arch/${ARCHSUBDIR} 26.PATH: ${ARCHDIR} 27 28CPPFLAGS+= -I${ARCHDIR} -I${.CURDIR} -I${.OBJDIR} -D_LIBC 29CPPFLAGS+= -D__LIBPTHREAD_SOURCE__ 30 31# XXX: This crappy poke at libc's internals needs to be fixed. 32# We need to put this *after our own includes, so that our "assym.h" 33# gets picked, instead of the libc one 34CPPFLAGS+=-I${NETBSDSRCDIR}/sys -I${.CURDIR}/../libc 35 36DPSRCS+= assym.h 37CLEANFILES+= assym.h 38 39assym.h: ${ARCHDIR}/genassym.cf pthread.h pthread_int.h pthread_md.h 40 ${_MKTARGET_CREATE} 41 ${TOOL_GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 42 < ${ARCHDIR}/genassym.cf > assym.h.tmp && \ 43 mv -f assym.h.tmp assym.h 44 45LIB= pthread 46 47# 48# NOTE: When you create a new file for libpthread, make sure that pthread.c 49# gets a reference to a symbol in that file. Otherwise, Unix's stupid static 50# library semantics will end up discarding potentially important objects. 51# 52SRCS= pthread.c 53SRCS+= pthread_attr.c 54SRCS+= pthread_barrier.c 55SRCS+= pthread_cancelstub.c 56SRCS+= pthread_cond.c 57SRCS+= pthread_lock.c 58SRCS+= pthread_misc.c 59SRCS+= pthread_mutex.c 60SRCS+= pthread_rwlock.c 61SRCS+= pthread_specific.c 62SRCS+= pthread_spin.c 63SRCS+= pthread_tsd.c 64SRCS+= res_state.c 65SRCS+= sem.c 66# Architecture-dependent files 67SRCS+= _context_u.S 68.if exists(${ARCHDIR}/pthread_md.c) 69SRCS+= pthread_md.c 70.endif 71 72.if defined(PTHREAD__COMPAT) 73SRCS+= pthread_compat.c 74.PATH.c: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic 75.PATH.S: ${.CURDIR}/../../common/lib/libc/arch/${ARCHSUBDIR}/atomic 76.PATH.c: ${.CURDIR}/../../common/lib/libc/atomic 77.PATH.c: ${.CURDIR}/../libc/misc 78.include "../../common/lib/libc/arch/${ARCHSUBDIR}/atomic/Makefile.inc" 79.endif 80 81# The TSD routines are used in the implementation of profiling, and so 82# can't be profiled themselves. 83COPTS.pthread_specific.c+= -fomit-frame-pointer -falign-functions=32 84pthread_specific.po: pthread_specific.o 85 ${_MKTARGET_CREATE} 86 cp pthread_specific.o pthread_specific.po 87 88# Internal spinlock routines are performance critical. Don't profile them, 89# it's incompatibile with -fomit-frame-pointer. 90COPTS.pthread_lock.c+= -fomit-frame-pointer -falign-functions=32 91pthread_lock.po: pthread_lock.o 92 ${_MKTARGET_CREATE} 93 cp pthread_lock.o pthread_lock.po 94 95COPTS.pthread_mutex.c+= -fomit-frame-pointer -falign-functions=32 96pthread_mutex.po: pthread_mutex.o 97 ${_MKTARGET_CREATE} 98 cp pthread_mutex.o pthread_mutex.po 99 100COPTS.pthread.c += -Wno-stack-protector 101 102_context_u.po: _context_u.o 103 ${_MKTARGET_CREATE} 104 cp _context_u.o _context_u.po 105 106MAN+= affinity.3 pthread.3 \ 107 pthread_attr.3 \ 108 pthread_attr_getname_np.3 \ 109 pthread_attr_setcreatesuspend_np.3 \ 110 pthread_attr_setname_np.3 \ 111 pthread_barrier_destroy.3 pthread_barrier_init.3 \ 112 pthread_barrier_wait.3 pthread_barrierattr.3 \ 113 pthread_cancel.3 pthread_cleanup_push.3 \ 114 pthread_cond_broadcast.3 pthread_cond_destroy.3 pthread_cond_init.3 \ 115 pthread_cond_wait.3 \ 116 pthread_condattr.3 pthread_create.3 pthread_detach.3 pthread_equal.3 \ 117 pthread_exit.3 \ 118 pthread_getname_np.3 \ 119 pthread_getspecific.3 pthread_join.3 \ 120 pthread_key_create.3 pthread_key_delete.3 pthread_kill.3 \ 121 pthread_mutex_destroy.3 pthread_mutex_init.3 pthread_mutex_lock.3 \ 122 pthread_mutex_unlock.3 pthread_mutexattr.3 \ 123 pthread_once.3 pthread_rwlock_destroy.3 pthread_rwlock_init.3 \ 124 pthread_rwlock_rdlock.3 pthread_rwlock_unlock.3 \ 125 pthread_rwlock_wrlock.3 pthread_rwlockattr.3 \ 126 pthread_schedparam.3 pthread_self.3 \ 127 pthread_setname_np.3 \ 128 pthread_setspecific.3 pthread_sigmask.3 pthread_spin_destroy.3 \ 129 pthread_spin_init.3 pthread_spin_lock.3 pthread_spin_unlock.3 \ 130 pthread_suspend_np.3 pthread_testcancel.3 131 132MLINKS+= affinity.3 pthread_setaffinity_np.3 133MLINKS+= affinity.3 pthread_getaffinity_np.3 134MLINKS+= pthread_attr.3 pthread_attr_init.3 135MLINKS+= pthread_attr.3 pthread_attr_destroy.3 136MLINKS+= pthread_attr.3 pthread_attr_setdetachstate.3 137MLINKS+= pthread_attr.3 pthread_attr_getdetachstate.3 138MLINKS+= pthread_attr.3 pthread_attr_setschedparam.3 139MLINKS+= pthread_attr.3 pthread_attr_getschedparam.3 140MLINKS+= pthread_barrierattr.3 pthread_barrierattr_init.3 141MLINKS+= pthread_barrierattr.3 pthread_barrierattr_destroy.3 142MLINKS+= pthread_cleanup_push.3 pthread_cleanup_pop.3 143MLINKS+= pthread_cond_broadcast.3 pthread_cond_signal.3 144MLINKS+= pthread_cond_wait.3 pthread_cond_timedwait.3 145MLINKS+= pthread_condattr.3 pthread_condattr_init.3 146MLINKS+= pthread_condattr.3 pthread_condattr_destroy.3 147MLINKS+= pthread_mutex_lock.3 pthread_mutex_trylock.3 148MLINKS+= pthread_mutexattr.3 pthread_mutexattr_init.3 149MLINKS+= pthread_mutexattr.3 pthread_mutexattr_destroy.3 150MLINKS+= pthread_mutexattr.3 pthread_mutexattr_settype.3 151MLINKS+= pthread_mutexattr.3 pthread_mutexattr_gettype.3 152MLINKS+= pthread_rwlock_rdlock.3 pthread_rwlock_timedrdlock.3 153MLINKS+= pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3 154MLINKS+= pthread_rwlock_wrlock.3 pthread_rwlock_timedwrlock.3 155MLINKS+= pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3 156MLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_init.3 157MLINKS+= pthread_rwlockattr.3 pthread_rwlockattr_destroy.3 158MLINKS+= pthread_schedparam.3 pthread_setschedparam.3 159MLINKS+= pthread_schedparam.3 pthread_getschedparam.3 160MLINKS+= pthread_spin_lock.3 pthread_spin_trylock.3 161MLINKS+= pthread_suspend_np.3 pthread_resume_np.3 162MLINKS+= pthread_testcancel.3 pthread_setcancelstate.3 163MLINKS+= pthread_testcancel.3 pthread_setcanceltype.3 164 165pthread_switch.S _context_u.S: assym.h 166 167.include <bsd.lib.mk> 168 169.else 170 171.include <bsd.man.mk> 172.include <bsd.files.mk> 173.include <bsd.inc.mk> 174 175.endif 176 177# WARNS=2 sets -Wcast-qual. This causes problems for one of 178# pthread_setspecific() and pthread_getspecific(), since the constness 179# of the argument to setspecific() has to be discarded *somewhere* 180# before returning it from getspecific(). 181CFLAGS+= -Wno-cast-qual 182