lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # Makefile template to be included by libpthread/nptl/sysdeps/<ARCH>/Makefile.arch |
| 2 | # |
| 3 | # Copyright (C) 2010 Erik Andersen <andersen@uclibc.org> |
| 4 | # |
| 5 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 6 | # |
| 7 | subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH) |
| 8 | libpthread_arch_DIR := $(top_srcdir)libpthread/nptl/sysdeps/$(TARGET_ARCH) |
| 9 | libpthread_arch_OUT := $(top_builddir)libpthread/nptl/sysdeps/$(TARGET_ARCH) |
| 10 | |
| 11 | ifneq ($(abspath libpthread/nptl/sysdeps/$(TARGET_ARCH)),$(abspath libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH))) |
| 12 | subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH) |
| 13 | libpthread_subarch_DIR := $(libpthread_arch_DIR)/$(TARGET_SUBARCH) |
| 14 | libpthread_subarch_OUT := $(libpthread_arch_OUT)/$(TARGET_SUBARCH) |
| 15 | endif |
| 16 | |
| 17 | -include $(libpthread_arch_DIR)/Makefile.arch |
| 18 | libpthread_arch_SSRC := $(filter-out librt-%,$(filter-out libc-%,$(notdir $(wildcard $(libpthread_arch_DIR)/*.S)))) |
| 19 | libpthread_arch_CSRC := $(filter-out librt-%,$(filter-out libc-%,$(notdir $(wildcard $(libpthread_arch_DIR)/*.c)))) |
| 20 | libpthread_arch_CSRC := $(filter-out gen_%,$(libpthread_arch_CSRC)) |
| 21 | |
| 22 | ifneq ($(TARGET_SUBARCH),) |
| 23 | libpthread_subarch_SSRC := $(notdir $(wildcard $(libpthread_subarch_DIR)/*.S)) |
| 24 | libpthread_arch_SSRC := $(filter-out $(libpthread_subarch_SSRC),$(libpthread_arch_SSRC)) |
| 25 | libpthread_arch_CSRC := $(filter-out $(libpthread_subarch_SSRC:.S=.c),$(libpthread_arch_CSRC)) |
| 26 | libpthread_subarch_OBJS := $(patsubst %.S,$(libpthread_subarch_OUT)/%.o,$(libpthread_subarch_SSRC)) |
| 27 | endif |
| 28 | |
| 29 | libpthread_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libpthread_arch_CSRC)) |
| 30 | libpthread_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(libpthread_arch_SSRC)) |
| 31 | libpthread_arch_OBJS = $(libpthread_subarch_OBJS) $(libpthread_arch_COBJ) $(libpthread_arch_SOBJ) |
| 32 | |
| 33 | libc_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_CSRC)) |
| 34 | libc_arch_SOBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_SSRC)) |
| 35 | libc_arch_OBJS = $(libc_arch_COBJ) $(libc_arch_SOBJ) |
| 36 | libc_arch_a_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_a_CSRC)) |
| 37 | libc_arch_a_OBJS = $(libc_arch_a_COBJ) |
| 38 | |
| 39 | librt_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(librt_arch_CSRC)) |
| 40 | librt_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(librt_arch_SSRC)) |
| 41 | librt_arch_OBJS = $(librt_arch_COBJ) $(librt_arch_SOBJ) |
| 42 | |
| 43 | CFLAGS-gen_tcb-offsets.c = -S |
| 44 | $(libpthread_arch_OUT)/gen_tcb-offsets.c: $(libpthread_arch_DIR)/tcb-offsets.sym | $(libpthread_arch_OUT) |
| 45 | $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@ |
| 46 | |
| 47 | $(libpthread_arch_OUT)/gen_tcb-offsets.s: $(libpthread_arch_OUT)/gen_tcb-offsets.c | headers |
| 48 | $(compile.c) |
| 49 | libpthread-generated-y += $(libpthread_arch_OUT)/gen_tcb-offsets.s |
| 50 | 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" |
| 51 | $(libpthread_arch_OUT)/tcb-offsets.h: $(libpthread_arch_OUT)/gen_tcb-offsets.s |
| 52 | $(do_sed) $(PTHREAD_TCB_OFFSET_MANGLE) $< > $@ |
| 53 | @if test ! -s $@ ; then rm -f $@ ; false ; fi |
| 54 | |
| 55 | pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_arch_OUT)/tcb-offsets.h |
| 56 | |
| 57 | objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)) |
| 58 | headers_clean-y+= HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)) |
| 59 | |
| 60 | CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)): |
| 61 | $(do_rm) $(addprefix $(libpthread_arch_OUT)/*., o os oS) |
| 62 | HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)): |
| 63 | $(do_rm) $(libpthread_arch_OUT)/tcb-offsets.h \ |
| 64 | $(addprefix $(libpthread_arch_OUT)/gen_tcb-offsets., c h s) |
| 65 | ifneq ($(TARGET_SUBARCH),) |
| 66 | objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT)) |
| 67 | CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT)): |
| 68 | $(do_rm) $(addprefix $(libpthread_subarch_OUT)/*., o os oS) |
| 69 | endif |