summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/Makefile.commonarch
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/nptl/sysdeps/Makefile.commonarch')
-rw-r--r--libpthread/nptl/sysdeps/Makefile.commonarch83
1 files changed, 44 insertions, 39 deletions
diff --git a/libpthread/nptl/sysdeps/Makefile.commonarch b/libpthread/nptl/sysdeps/Makefile.commonarch
index 32fb99884..a7080c088 100644
--- a/libpthread/nptl/sysdeps/Makefile.commonarch
+++ b/libpthread/nptl/sysdeps/Makefile.commonarch
@@ -4,59 +4,64 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-subdirs += libpthread/nptl/sysdeps \
- libpthread/nptl/sysdeps/$(TARGET_ARCH)
+subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)
+libpthread_arch_DIR := $(top_srcdir)libpthread/nptl/sysdeps/$(TARGET_ARCH)
+libpthread_arch_OUT := $(top_builddir)libpthread/nptl/sysdeps/$(TARGET_ARCH)
+
ifneq ($(abspath libpthread/nptl/sysdeps/$(TARGET_ARCH)),$(abspath libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)))
subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)
+libpthread_subarch_DIR := $(libpthread_arch_DIR)/$(TARGET_SUBARCH)
+libpthread_subarch_OUT := $(libpthread_arch_OUT)/$(TARGET_SUBARCH)
endif
-PTHREAD_ARCH_DIR := $(top_srcdir)libpthread/nptl/sysdeps/$(TARGET_ARCH)
-PTHREAD_ARCH_OUT := $(top_builddir)libpthread/nptl/sysdeps/$(TARGET_ARCH)
-
-PTHREAD_ARCH_CSRC := $(patsubst %.c,$(PTHREAD_ARCH_DIR)/%.c,$(libpthread_CSRC))
-PTHREAD_ARCH_COBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(libpthread_CSRC))
-PTHREAD_ARCH_SSRC := $(patsubst %.s,$(PTHREAD_ARCH_DIR)/%.s,$(patsubst %.S,$(PTHREAD_ARCH_DIR)/%.S,$(libpthread_SSRC)))
-PTHREAD_ARCH_SOBJ := $(patsubst %.s,$(PTHREAD_ARCH_OUT)/%.o,$(patsubst %.S,$(PTHREAD_ARCH_OUT)/%.o,$(libpthread_SSRC)))
-PTHREAD_ARCH_OBJS := $(PTHREAD_ARCH_COBJ) $(PTHREAD_ARCH_SOBJ)
-
-LIBRT_ARCH_COBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(librt_CSRC))
-LIBRT_ARCH_SOBJ := $(patsubst %.S,$(PTHREAD_ARCH_OUT)/%.o,$(librt_SSRC))
-LIBRT_ARCH_OBJS := $(LIBRT_ARCH_COBJ) $(LIBRT_ARCH_SOBJ)
-
-LIBC_ARCH_COBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(libc_a_CSRC))
-LIBC_ARCH_SOBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(libc_a_SSRC))
-LIBC_ARCH_OBJS := $(LIBC_ARCH_COBJ) $(LIBC_ARCH_SOBJ)
-
-PTHREAD_LIBC_TLS_CSRC := $(filter-out $(notdir $(PTHREAD_ARCH_OBJS:.o=.c)),$(notdir $(PTHREAD_LIBC_TLS_CSRC)))
-PTHREAD_OBJS := $(PTHREAD_ARCH_OBJS)
+-include $(libpthread_arch_DIR)/Makefile.arch
+libpthread_arch_SSRC := $(filter-out librt-%,$(filter-out libc-%,$(notdir $(wildcard $(libpthread_arch_DIR)/*.S))))
+libpthread_arch_CSRC := $(filter-out librt-%,$(filter-out libc-%,$(notdir $(wildcard $(libpthread_arch_DIR)/*.c))))
+ifneq ($(TARGET_SUBARCH),)
+libpthread_subarch_SSRC := $(notdir $(wildcard $(libpthread_subarch_DIR)/*.S))
+libpthread_arch_SSRC := $(filter-out $(libpthread_subarch_SSRC),$(libpthread_arch_SSRC))
+libpthread_arch_CSRC := $(filter-out $(libpthread_subarch_SSRC:.S=.c),$(libpthread_arch_CSRC))
+libpthread_subarch_OBJS := $(patsubst %.S,$(libpthread_subarch_OUT)/%.o,$(libpthread_subarch_SSRC))
+endif
-libpthread-a-y += $(if $(DOPIC),$(PTHREAD_OBJS:.o=.os),$(PTHREAD_OBJS))
-libpthread-so-y += $(PTHREAD_OBJS:.o=.oS)
+libpthread_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libpthread_arch_CSRC))
+libpthread_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(libpthread_arch_SSRC))
+libpthread_arch_OBJS = $(libpthread_subarch_OBJS) $(libpthread_arch_COBJ) $(libpthread_arch_SOBJ)
-librt-a-y += $(LIBRT_ARCH_OBJS)
-librt-so-y += $(LIBRT_ARCH_OBJS:.o=.oS)
+libc_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_CSRC))
+libc_arch_SOBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_SSRC))
+libc_arch_OBJS = $(libc_arch_COBJ) $(libc_arch_SOBJ)
+libc_arch_a_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_a_CSRC))
+libc_arch_a_OBJS = $(libc_arch_a_COBJ)
-libc-static-y += $(LIBC_ARCH_OBJS) $(PTHREAD_LIBC_TLS_OBJS)
+librt_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(librt_arch_CSRC))
+librt_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(librt_arch_SSRC))
+librt_arch_OBJS = $(librt_arch_COBJ) $(librt_arch_SOBJ)
-CFLAGS-tcb-offsets.c = -S
-$(PTHREAD_ARCH_OUT)/tcb-offsets.c: $(PTHREAD_ARCH_DIR)/tcb-offsets.sym | $(PTHREAD_ARCH_OUT)
+CFLAGS-gen_tcb-offsets.c = -S
+$(libpthread_arch_OUT)/gen_tcb-offsets.c: $(libpthread_arch_DIR)/tcb-offsets.sym | $(libpthread_arch_OUT)
$(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
-$(PTHREAD_ARCH_OUT)/tcb-offsets.s: $(PTHREAD_ARCH_OUT)/tcb-offsets.c
+$(libpthread_arch_OUT)/gen_tcb-offsets.s: $(libpthread_arch_OUT)/gen_tcb-offsets.c | headers
$(compile.c)
-
+libpthread-generated-y += $(libpthread_arch_OUT)/gen_tcb-offsets.s
PTHREAD_TCB_OFFSET_MANGLE ?= -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*\$$/\#define \1 \2/p"
-$(PTHREAD_ARCH_OUT)/tcb-offsets.h: $(PTHREAD_ARCH_OUT)/tcb-offsets.s
+$(libpthread_arch_OUT)/tcb-offsets.h: $(libpthread_arch_OUT)/gen_tcb-offsets.s
$(do_sed) $(PTHREAD_TCB_OFFSET_MANGLE) $< > $@
@if test ! -s $@ ; then rm -f $@ ; false ; fi
-pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(PTHREAD_ARCH_OUT)/tcb-offsets.h
+pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_arch_OUT)/tcb-offsets.h
-objclean-y += CLEAN_$(subst $(top_builddir),,$(PTHREAD_ARCH_OUT))
-headers_clean-y+= HEADERCLEAN_$(subst $(top_builddir),,$(PTHREAD_ARCH_OUT))
-
-CLEAN_$(subst $(top_builddir),,$(PTHREAD_ARCH_OUT)):
- $(do_rm) $(addprefix $(PTHREAD_ARCH_OUT)/*., o os oS)
-HEADERCLEAN_$(subst $(top_builddir),,$(PTHREAD_ARCH_OUT)):
- $(do_rm) $(addprefix $(PTHREAD_ARCH_OUT)/tcb-offsets., c h s)
+objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT))
+headers_clean-y+= HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT))
+CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)):
+ $(do_rm) $(addprefix $(libpthread_arch_OUT)/*., o os oS)
+HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)):
+ $(do_rm) $(libpthread_arch_OUT)/tcb-offsets.h \
+ $(addprefix $(libpthread_arch_OUT)/gen_tcb-offsets., c h s)
+ifneq ($(TARGET_SUBARCH),)
+objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT))
+CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT)):
+ $(do_rm) $(addprefix $(libpthread_subarch_OUT)/*., o os oS)
+endif