| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 | # Makefile for uClibc NPTL## Copyright (C) 2005-2006 Steven J. Hill <sjhill@realitydiluted.com>## Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.#subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH) \	libpthread/nptl/sysdeps/unix/sysv/linux \	libpthread/nptl/sysdeps/pthreadlibpthread-routines-y = init vars events version \		      pthread_create pthread_exit pthread_detach \		      pthread_join pthread_tryjoin pthread_timedjoin \		      pthread_self pthread_equal pthread_yield \		      pthread_getconcurrency pthread_setconcurrency \		      pthread_getschedparam pthread_setschedparam \		      pthread_setschedprio \		      pthread_attr_init pthread_attr_destroy \		      pthread_attr_getdetachstate pthread_attr_setdetachstate \		      pthread_attr_getguardsize pthread_attr_setguardsize \		      pthread_attr_getschedparam pthread_attr_setschedparam \		      pthread_attr_getschedpolicy pthread_attr_setschedpolicy \		      pthread_attr_getinheritsched \		      pthread_attr_setinheritsched \		      pthread_attr_getscope pthread_attr_setscope \		      pthread_attr_getstackaddr pthread_attr_setstackaddr \		      pthread_attr_getstacksize pthread_attr_setstacksize \		      pthread_attr_getstack pthread_attr_setstack \		      pthread_getattr_np \		      pthread_mutex_init pthread_mutex_destroy \		      pthread_mutex_lock pthread_mutex_trylock \		      pthread_mutex_timedlock pthread_mutex_unlock \		      pthread_mutex_consistent \		      pthread_mutexattr_init pthread_mutexattr_destroy \		      pthread_mutexattr_getpshared \		      pthread_mutexattr_setpshared \		      pthread_mutexattr_getrobust \		      pthread_mutexattr_setrobust \		      pthread_mutexattr_getprotocol \		      pthread_mutexattr_setprotocol \		      pthread_mutexattr_getprioceiling \		      pthread_mutexattr_setprioceiling \		      pthread_mutexattr_gettype pthread_mutexattr_settype \		      pthread_rwlock_init pthread_rwlock_destroy \		      pthread_rwlock_rdlock pthread_rwlock_timedrdlock \		      pthread_rwlock_wrlock pthread_rwlock_timedwrlock \		      pthread_rwlock_tryrdlock pthread_rwlock_trywrlock \		      pthread_rwlock_unlock \		      pthread_rwlockattr_init pthread_rwlockattr_destroy \		      pthread_rwlockattr_getpshared \		      pthread_rwlockattr_setpshared \		      pthread_rwlockattr_getkind_np \		      pthread_rwlockattr_setkind_np \		      pthread_cond_init pthread_cond_destroy \		      pthread_cond_wait pthread_cond_timedwait \		      pthread_cond_signal pthread_cond_broadcast \		      pthread_condattr_init pthread_condattr_destroy \		      pthread_condattr_getpshared pthread_condattr_setpshared \		      pthread_condattr_getclock pthread_condattr_setclock \		      pthread_spin_init pthread_spin_destroy \		      pthread_spin_lock pthread_spin_trylock \		      pthread_spin_unlock \		      pthread_barrier_init pthread_barrier_destroy \		      pthread_barrier_wait \		      pthread_barrierattr_init pthread_barrierattr_destroy \		      pthread_barrierattr_getpshared \		      pthread_barrierattr_setpshared \		      pthread_key_create pthread_key_delete \		      pthread_getspecific pthread_setspecific \		      pthread_sigmask pthread_kill \		      pthread_cancel pthread_testcancel \		      pthread_setcancelstate pthread_setcanceltype \		      pthread_once \		      pthread_atfork \		      pthread_getcpuclockid \		      pthread_clock_gettime pthread_clock_settime \		      sem_init sem_destroy \		      sem_open sem_close sem_unlink \		      sem_getvalue \		      sem_wait sem_trywait sem_timedwait sem_post \		      cleanup cleanup_defer cleanup_compat \		      cleanup_defer_compat unwind \		      pt-longjmp pt-cleanup\		      cancellation \		      lowlevellock \		      pt-vfork \		      ptw-write ptw-read ptw-close ptw-fcntl ptw-accept \		      ptw-connect ptw-recv ptw-recvfrom ptw-recvmsg ptw-send \		      ptw-sendmsg ptw-sendto ptw-fsync ptw-lseek ptw-llseek \		      ptw-msync ptw-nanosleep ptw-open ptw-open64 ptw-pause \		      ptw-pread ptw-pread64 ptw-pwrite ptw-pwrite64 \		      ptw-tcdrain ptw-wait ptw-waitpid ptw-msgrcv ptw-msgsnd \		      ptw-sigwait \		      pt-raise pt-system \		      flockfile ftrylockfile funlockfile \		      sigaction \		      herrno \		      pthread_kill_other_threads \		      pthread_getaffinity pthread_setaffinity \		      pthread_attr_getaffinity pthread_attr_setaffinity \		      cleanup_routine unwind-forcedunwindlibpthread-routines-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += reslibpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwindifeq ($(TARGET_ARCH),x86_64)libpthread-routines-y := $(filter-out cancellation,$(libpthread-routines-y))endifCFLAGS-pthread_atfork.c = -DNOT_IN_libc# Since cancellation handling is in large parts handled using exceptions# we have to compile some files with exception handling enabled, some# even with asynchronous unwind tables.# init.c contains sigcancel_handler().CFLAGS-init.c = -fexceptions -fasynchronous-unwind-tables# The unwind code itself,CFLAGS-unwind.c = -fexceptionsCFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables# The following three functions must be async-cancel safe.CFLAGS-pthread_cancel.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pthread_setcancelstate.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pthread_setcanceltype.c = -fexceptions -fasynchronous-unwind-tables# These are internal functions which similar functionality as setcancelstate# and setcanceltype.CFLAGS-cancellation.c = -fasynchronous-unwind-tablesCFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables# Calling pthread_exit() must cause the registered cancel handlers to# be executed.  Therefore exceptions have to be thrown through this# function.CFLAGS-pthread_exit.c = -fexceptions# Among others, __pthread_unwind is forwarded.  This function must handle# exceptions.CFLAGS-forward.c = -fexceptions# The following are cancellation points.  Some of the functions can# block and therefore temporarily enable asynchronous cancellation.# Those must be compiled asynchronous unwind tables.CFLAGS-pthread_testcancel.c = -fexceptionsCFLAGS-pthread_join.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \			-fasynchronous-unwind-tablesCFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables# These are the function wrappers we have to duplicate here.CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-lockf.c = -fexceptionsCFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pwrite64.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tablesCFLAGS-pt-system.c = -fexceptions -I./libc/stdlib## The rest of this file is uClibc specific.#CFLAGS-pthread_barrier_init.c = -D_GNU_SOURCECFLAGS-pthread_barrier_destroy.c = -D_GNU_SOURCECFLAGS-pthread_barrierattr_init.c = -D_GNU_SOURCECFLAGS-pthread_barrierattr_destroy.c = -D_GNU_SOURCECFLAGS-pthread_barrierattr_getpshared.c = -D_GNU_SOURCECFLAGS-pthread_barrierattr_setpshared.c = -D_GNU_SOURCECFLAGS-sem_open.c = -D_GNU_SOURCECFLAGS-nptl = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS)CFLAGS-OMIT-alloca_cutoff.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1CFLAGS-OMIT-forward.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1CFLAGS-OMIT-libc-lowlevelock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1CFLAGS-OMIT-libc-cancellation.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1libpthread-os-routines = pthread_yieldlibpthread-misc-routines = pthread_rwlock_rdlock pthread_rwlock_timedrdlock \			   pthread_rwlock_wrlock pthread_rwlock_timedwrlock \			   pthread_rwlock_unlock pthread_cond_wait \			   pthread_cond_timedwait pthread_cond_signal \			   pthread_cond_broadcast pthread_spin_init \			   pthread_spin_destroy pthread_spin_lock \			   pthread_spin_trylock pthread_spin_unlock \			   pthread_barrier_init pthread_barrier_destroy \			   pthread_barrier_wait pthread_sigmask \			   pthread_kill pthread_once \			   pthread_getcpuclockid sem_wait \			   sem_trywait sem_timedwait \			   sem_post pt-longjmp \			   lowlevellock pt-vfork \			   ptw-close ptw-read ptw-write \			   ptw-fcntl ptw-accept ptw-connect \			   ptw-recv ptw-recvfrom ptw-recvmsg \			   ptw-send ptw-sendmsg ptw-sendto \			   ptw-fsync ptw-lseek ptw-llseek \			   ptw-msync ptw-nanosleep ptw-open \			   ptw-open64 ptw-pause ptw-pread \			   ptw-pread64 ptw-pwrite ptw-pwrite64 \			   ptw-tcdrain ptw-wait ptw-waitpid \			   ptw-msgrcv ptw-msgsnd ptw-sigwait \			   pt-raise flockfile ftrylockfile \			   funlockfile sigaction \			   pthread_getaffinity \			   pthread_setaffinity \			   pthread_attr_getaffinity \			   pthread_attr_setaffinity \			   unwind-forcedunwindifeq ($(PTHREADS_DEBUG_SUPPORT),y)LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defselseLDFLAGS-libpthread.so := $(LDFLAGS)endifLDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internalLIBS-libpthread.so := $(LIBS)ifneq ($(UCLIBC_CTOR_DTOR),y)START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o $(SHARED_START_FILES)END_FILE-libpthread.so := $(SHARED_END_FILES) $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.oendiflibpthread_FULL_NAME := libpthread-$(VERSION).soPTHREAD_DIR := $(top_srcdir)libpthread/nptlPTHREAD_OUT := $(top_builddir)libpthread/nptllibpthread_static_SRC := pthread_atforklibpthread_a_SRC = $(patsubst %, $(PTHREAD_DIR)/%.c,			\		$(filter-out $(libpthread-os-routines)			\			$(libpthread-misc-routines)			\			$(libpthread-shared-only-routines),		\		$(libpthread-routines-y)))libpthread_so_SRC = $(patsubst %, $(PTHREAD_DIR)/%.c,			\		$(filter-out $(libpthread-os-routines)			\			$(libpthread-misc-routines), $(libpthread-routines-y)))ifeq ($(TARGET_ARCH),x86_64)libc-static-y += $(patsubst %.c, $(PTHREAD_OUT)/%.o, alloca_cutoff.c)libc-shared-y += $(patsubst %.c, $(PTHREAD_OUT)/%.oS, forward.c)elselibc-static-y += $(patsubst %.c, $(PTHREAD_OUT)/%.o, alloca_cutoff.c	\	libc-cancellation.c)libc-shared-y += $(patsubst %.c, $(PTHREAD_OUT)/%.oS, forward.c		\	libc-cancellation.c)endiflibpthread-nonshared-y += $(patsubst %,$(PTHREAD_OUT)/%.oS,$(libpthread_static_SRC))ifeq ($(DOPIC),y)libpthread-a-y := $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.os,$(libpthread_a_SRC))elselibpthread-a-y := $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.o,$(libpthread_a_SRC))endiflibpthread-so-y := $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.oS,$(libpthread_so_SRC))libpthread-static-y += $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.o,$(libpthread_a_SRC) $(libpthread_static_SRC))objclean-y += CLEAN_libpthread/nptlheaders_clean-y += HEADERCLEAN_libpthread/nptl-include $(PTHREAD_DIR)/sysdeps/generic/Makefile.in-include $(PTHREAD_DIR)/sysdeps/pthread/Makefile.in-include $(PTHREAD_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch-include $(PTHREAD_DIR)/sysdeps/unix/sysv/linux/Makefile.in-include $(PTHREAD_DIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/Makefile.archlib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.alib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so$(top_builddir)lib/libpthread.so: $(PTHREAD_OUT)/libpthread_so.a $(libc.depend) $(libdl.depend) $(top_builddir)lib/libpthread_nonshared.a	$(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION))	$(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp	$(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp	$(Q)mv $@.tmp $@ifeq ($(PTHREADS_DEBUG_SUPPORT),y)$(PTHREAD_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)endif$(PTHREAD_OUT)/libpthread_so.a: $(libpthread-so-y)	$(Q)$(RM) $@	$(do_ar)$(top_builddir)lib/libpthread.a: $(libpthread-a-y)	$(Q)$(INSTALL) -d $(dir $@)	$(Q)$(RM) $@	$(do_ar)## Create 'pthread-errnos.h' header file.#CFLAGS-pthread-errnos.c = -S$(PTHREAD_OUT)/pthread-errnos.c: $(PTHREAD_DIR)/pthread-errnos.sym	$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@$(PTHREAD_OUT)/pthread-errnos.s: $(PTHREAD_OUT)/pthread-errnos.c	$(compile.c)$(PTHREAD_OUT)/pthread-errnos.h: $(PTHREAD_OUT)/pthread-errnos.s	$(do_sed) -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(PTHREAD_OUT)/pthread-errnos.hheaders-$(UCLIBC_HAS_THREADS_NATIVE) += $(nptl_headers_bootstrap)LIBPTHREAD_H := $(addprefix $(top_builddir)include/,semaphore.h)LIBPTHREAD_INCLUDE_H := $(addprefix $(top_builddir)include/,pthread.h)LIBPTHREAD_INCLUDE_BITS_H := $(addprefix $(top_builddir)include/bits/,libc-lock.h stdio-lock.h)LIBPTHREAD_INCLUDE_STD_IMPL_OS_ARCH_BITS_H := $(addprefix $(top_builddir)include/bits/,pthreadtypes.h semaphore.h)$(LIBPTHREAD_INCLUDE_STD_IMPL_OS_ARCH_BITS_H): $(top_builddir)include/bits/%: | $(top_builddir)include/bits	$(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/$(@F) $@$(LIBPTHREAD_INCLUDE_BITS_H): $(top_builddir)include/bits/%: | $(top_builddir)include/bits	$(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@$(LIBPTHREAD_INCLUDE_H): $(top_builddir)include/%: | $(top_builddir)include	$(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@$(LIBPTHREAD_H): $(top_builddir)include/%: | $(top_builddir)include	$(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@nptl_headers_bootstrap = $(LIBPTHREAD_H) $(LIBPTHREAD_INCLUDE_H) $(LIBPTHREAD_INCLUDE_BITS_H) $(LIBPTHREAD_INCLUDE_STD_IMPL_OS_ARCH_BITS_H)HEADERCLEAN_libpthread/nptl:	$(do_rm) $(nptl_headers_bootstrap) \	      $(addprefix $(PTHREAD_OUT)/pthread-errnos., c h s)CLEAN_libpthread/nptl:	$(do_rm) $(addprefix $(PTHREAD_OUT)/*., o os oS a)
 |