From 9381d622e2411a35a5fd73a5a573eb269e2dd9c9 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 1 Jul 2010 10:28:46 +0200 Subject: nptl: fix buildsys Now automatically picks the correct (arch and subarch specific) impls in favour of generic impls. make O=/tmp/objs PREFIX=/my/sysroot -j works now as expected (both out-of-tree as well as parallel-safe). Signed-off-by: Bernhard Reutner-Fischer --- libpthread/nptl/sysdeps/pthread/Makefile.in | 212 ++++++++++------------------ 1 file changed, 71 insertions(+), 141 deletions(-) (limited to 'libpthread/nptl/sysdeps/pthread') diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in index a8e27f5cb..030a2b681 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -11,165 +11,95 @@ subdirs += libpthread/nptl/sysdeps/pthread # pt-longjmp.c in libc and libpthread. For uClibc, they are # in libc only. # -libpthread_CSRC = pthread_barrier_init.c pthread_barrier_destroy.c \ - pthread_barrier_wait.c pthread_cond_broadcast.c \ - pthread_cond_signal.c pthread_cond_timedwait.c \ - pthread_cond_wait.c pthread_rwlock_rdlock.c \ - pthread_rwlock_timedrdlock.c \ - pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c \ - pthread_rwlock_wrlock.c pthread_sigmask.c \ - pthread_spin_destroy.c pthread_spin_init.c \ - pthread_spin_unlock.c pt-sigfillset.c \ - pt-longjmp.c tpp.c - - -ifeq ($(TARGET_ARCH),i386) -X86_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \ - pthread_barrier_wait.c pthread_cond_broadcast.c \ - pthread_cond_signal.c pthread_rwlock_timedrdlock.c \ - pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c pthread_rwlock_wrlock.c \ - pthread_rwlock_rdlock.c - -libpthread_CSRC := $(filter-out $(X86_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC)) -endif - -ifeq ($(TARGET_ARCH),sh) -SH_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \ - pthread_rwlock_wrlock.c pthread_rwlock_rdlock.c \ - pthread_rwlock_unlock.c pt-longjmp.c \ - pthread_barrier_wait.c pthread_cond_broadcast.c \ - pthread_cond_signal.c \ - pthread_rwlock_timedrdlock.c \ - pthread_rwlock_timedwrlock.c - -libpthread_CSRC := $(filter-out $(SH_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC)) -endif -ifeq ($(TARGET_ARCH),powerpc) -#EXCLUDE_LIST := pthread_cond_broadcast.c \ -# pthread_cond_signal.c pthread_cond_timedwait.c \ -# pthread_cond_wait.c \ -# pthread_spin_init.c \ -# pthread_spin_unlock.c pt-sigfillset.c \ -# pt-longjmp.c -# -#libpthread_CSRC := $(filter-out $(EXCLUDE_LIST),$(libpthread_CSRC)) -endif - - -ifeq ($(TARGET_ARCH),sparc) -SPARC_PTHREAD_EXCLUDE_LIST = pthread_barrier_init.c pthread_barrier_wait.c \ - pthread_barrier_destroy.c - -libpthread_CSRC := $(filter-out $(SPARC_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC)) -endif - -ifeq ($(TARGET_ARCH),x86_64) -X64_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \ - pthread_barrier_wait.c pthread_cond_broadcast.c \ - pthread_cond_signal.c pthread_rwlock_timedrdlock.c \ - pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c pthread_rwlock_wrlock.c \ - pthread_rwlock_rdlock.c pthread_cond_timedwait.c pthread_cond_wait.c - -libpthread_CSRC := $(filter-out $(X64_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC)) -endif - - - -CFLAGS-pt-common = -DNOT_IN_libc=1 $(SSP_ALL_CFLAGS) -CFLAGS-pthread_barrier_init.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_barrier_destroy.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \ - -DIS_IN_libpthread=1 -CFLAGS-pthread_cond_broadcast.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_cond_signal.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_cond_timedwait.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_cond_wait.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_rwlock_rdlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_rwlock_timedrdlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_rwlock_timedwrlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_rwlock_unlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_rwlock_wrlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_sigmask.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \ - -DIS_IN_libpthread=1 -CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \ - -DIS_IN_libpthread=1 -CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \ - -DIS_IN_libpthread=1 -CFLAGS-pt-sigaction.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \ - -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \ - -I$(top_srcdir)libc/signal -CFLAGS-pt-sigfillset.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \ - -I$(top_srcdir)libc/signal -CFLAGS-pt-sigprocmask.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \ - -I$(top_srcdir)libc/sysdeps/linux/common -CFLAGS-unwind-forcedunwind.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -fexceptions -fasynchronous-unwind-tables -CFLAGS-librt-cancellation.c = -DIS_IN_librt=1 $(CFLAGS-pt-common) \ +libpthread_pthread_DIR = $(top_srcdir)libpthread/nptl/sysdeps/pthread +libpthread_pthread_OUT = $(top_builddir)libpthread/nptl/sysdeps/pthread + +libpthread_pthread_COBJ = $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(libpthread_pthread_CSRC)) +libpthread_pthread_CSRC = \ + pthread_barrier_destroy.c \ + pthread_barrier_init.c \ + pthread_barrier_wait.c \ + pthread_cond_broadcast.c \ + pthread_cond_signal.c \ + pthread_cond_timedwait.c \ + pthread_cond_wait.c \ + pthread_rwlock_rdlock.c \ + pthread_rwlock_timedrdlock.c \ + pthread_rwlock_timedwrlock.c \ + pthread_rwlock_unlock.c \ + pthread_rwlock_wrlock.c \ + pthread_sigmask.c \ + pthread_spin_destroy.c \ + pthread_spin_init.c \ + pthread_spin_unlock.c \ + pt-longjmp.c \ + pt-sigaction.c \ + pt-sigfillset.c \ + pt-sigprocmask.c \ + tpp.c +CFLAGS-pthread = $(SSP_ALL_CFLAGS) -DNOT_IN_libc=1 -DIS_IN_libpthread=1 +CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE +CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE +CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE +CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE +CFLAGS-pt-sigaction.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \ + -I$(top_srcdir)libc/signal +CFLAGS-pt-sigfillset.c = -I$(top_srcdir)libc/signal +CFLAGS-pt-sigprocmask.c = -I$(top_srcdir)libc/sysdeps/linux/common +CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables + +CFLAGS-OMIT-librt-cancellation.c = -DIS_IN_libpthread=1 +CFLAGS-OMIT-rt-unwind-resume.c = -DIS_IN_libpthread=1 +CFLAGS-librt-cancellation.c = -DIS_IN_librt=1 \ -fexceptions -fasynchronous-unwind-tables -CFLAGS-rt-unwind-resume.c = -DIS_IN_librt=1 $(CFLAGS-pt-common) \ +CFLAGS-rt-unwind-resume.c = -DIS_IN_librt=1 \ -fexceptions -fasynchronous-unwind-tables -CFLAGS-tpp.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -#CFLAGS:=$(CFLAGS:-O1=-O2) - -pthread_DIR := $(top_srcdir)libpthread/nptl/sysdeps/pthread -pthread_OUT := $(top_builddir)libpthread/nptl/sysdeps/pthread - -pthread_SRC = $(patsubst %.c, $(pthread_DIR)/%.c, $(libpthread_CSRC)) -pthread_OBJ = $(patsubst %.c, $(pthread_OUT)/%.o, $(libpthread_CSRC)) - -ifeq ($(DOPIC),y) -libpthread-a-y += $(pthread_OBJ:.o=.os) -else -libpthread-a-y += $(pthread_OBJ) -endif -libpthread-so-y += $(pthread_OBJ:.o=.oS) -libpthread-so-y += $(pthread_OUT)/pt-sigaction.oS $(pthread_OUT)/pt-sigprocmask.oS \ - $(pthread_OUT)/unwind-forcedunwind.oS +libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, \ + pt-sigaction pt-sigprocmask unwind-forcedunwind) +CFLAGS-OMIT-sigaction.c = $(CFLAGS-pthread) CFLAGS-sigaction.c = -I$(top_srcdir)libc/signal -libc-y += $(pthread_OUT)/sigaction.o +libc-y += $(libpthread_pthread_OUT)/sigaction.o -librt-a-y += $(pthread_OUT)/librt-cancellation.o -librt-so-y += $(pthread_OUT)/librt-cancellation.oS \ - $(pthread_OUT)/rt-unwind-resume.oS +librt-pt-routines-y = librt-cancellation.c +librt-pt-shared-only-routines-y = rt-unwind-resume.c ifeq ($(UCLIBC_CTOR_DTOR),y) +CFLAGS-OMIT-pt-initfini.c = $(CFLAGS-pthread) CFLAGS-pt-initfini.c = -S -g0 -fPIC -fno-inline-functions \ - $(call check_gcc,-fno-unit-at-a-time,) \ - -finhibit-size-directive \ - $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,)) + $(call check_gcc,-fno-unit-at-a-time,) \ + -finhibit-size-directive \ + $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,)) ASFLAGS-crti.S = -g0 ASFLAGS-crtn.S = -g0 -$(pthread_OUT)/pt-initfini.s: $(pthread_DIR)/pt-initfini.c +$(libpthread_pthread_OUT)/pt-initfini.s: $(libpthread_pthread_DIR)/pt-initfini.c $(compile.c) $(do_sed) '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \ - $(AWK) -f $(pthread_DIR)/defs.awk > $(pthread_OUT)/defs.h + $(do_awk) $(libpthread_pthread_DIR)/defs.awk > $(libpthread_pthread_OUT)/defs.h -$(pthread_OUT)/crti.S: $(pthread_OUT)/pt-initfini.s +$(libpthread_pthread_OUT)/crti.S $(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(do_sed) -e '1,/@HEADER_ENDS/p' \ - -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \ - -e '/@TRAILER_BEGINS/,$$p' $< > $@ - -$(pthread_OUT)/crtn.S: $(pthread_OUT)/pt-initfini.s - $(do_sed) -e '1,/@HEADER_ENDS/p' \ - -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \ - -e '/@TRAILER_BEGINS/,$$p' $< > $@ + -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \ + -e '/@TRAILER_BEGINS/,$$p' $< > $@ endif - -$(pthread_DIR)/pt-sigaction.c: - $(LN) -s sigaction.c $@ - -$(pthread_DIR)/pt-sigfillset.c: - $(LN) -s sigfillset.c $@ - -$(pthread_DIR)/pt-sigprocmask.c: - $(LN) -s sigprocmask.c $@ +# It would have been easier to just add dummy files that include the real +# impl, but ok. +# Special rules needed since we do objdir->objdir compilation for these 3. +# First symlink them, then build them. Rob would freak out on these. Sheesh! ;) +pthread-lc-fwd = sigaction sigfillset sigprocmask +$(patsubst %,$(libpthread_pthread_OUT)/pt-%.c,$(pthread-lc-fwd)): | $(libpthread_pthread_OUT) + $(do_ln) $(call rel_srcdir)$(patsubst pt-%,$(libpthread_pthread_DIR)/%,$(@F)) $@ +$(patsubst %,$(libpthread_pthread_OUT)/pt-%.oS,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.oS: $(libpthread_pthread_OUT)/pt-%.c + $(compile.c) +$(patsubst %,$(libpthread_pthread_OUT)/pt-%.o,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.o: $(libpthread_pthread_OUT)/pt-%.c + $(compile.c) objclean-y += CLEAN_libpthread/nptl/sysdeps/pthread CLEAN_libpthread/nptl/sysdeps/pthread: - $(do_rm) $(addprefix $(pthread_OUT)/*., o os oS s S) $(pthread_OUT)/defs.h \ - $(pthread_DIR)/pt-sigaction.c $(pthread_DIR)/pt-sigfillset.c \ - $(pthread_DIR)/pt-sigprocmask.c + $(do_rm) $(addprefix $(libpthread_pthread_OUT)/*., o os oS s S) \ + $(libpthread_pthread_OUT)/defs.h \ + $(addprefix $(libpthread_pthread_DIR)/,pt-sigaction.c \ + pt-sigfillset.c pt-sigprocmask.c) -- cgit v1.2.3