Makefile.commonarch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. ifneq ($(abspath libpthread/nptl/sysdeps/$(TARGET_ARCH)),$(abspath libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)))
  11. subdirs += libpthread/nptl/sysdeps/$(TARGET_ARCH)/$(TARGET_SUBARCH)
  12. libpthread_subarch_DIR := $(libpthread_arch_DIR)/$(TARGET_SUBARCH)
  13. libpthread_subarch_OUT := $(libpthread_arch_OUT)/$(TARGET_SUBARCH)
  14. endif
  15. -include $(libpthread_arch_DIR)/Makefile.arch
  16. libpthread_arch_SSRC := $(filter-out librt-%,$(filter-out libc-%,$(notdir $(wildcard $(libpthread_arch_DIR)/*.S))))
  17. libpthread_arch_CSRC := $(filter-out librt-%,$(filter-out libc-%,$(notdir $(wildcard $(libpthread_arch_DIR)/*.c))))
  18. libpthread_arch_CSRC := $(filter-out gen_%,$(libpthread_arch_CSRC))
  19. ifneq ($(TARGET_SUBARCH),)
  20. libpthread_subarch_SSRC := $(notdir $(wildcard $(libpthread_subarch_DIR)/*.S))
  21. libpthread_arch_SSRC := $(filter-out $(libpthread_subarch_SSRC),$(libpthread_arch_SSRC))
  22. libpthread_arch_CSRC := $(filter-out $(libpthread_subarch_SSRC:.S=.c),$(libpthread_arch_CSRC))
  23. libpthread_subarch_OBJS := $(patsubst %.S,$(libpthread_subarch_OUT)/%.o,$(libpthread_subarch_SSRC))
  24. endif
  25. libpthread_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libpthread_arch_CSRC))
  26. libpthread_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(libpthread_arch_SSRC))
  27. libpthread_arch_OBJS = $(libpthread_subarch_OBJS) $(libpthread_arch_COBJ) $(libpthread_arch_SOBJ)
  28. libc_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_CSRC))
  29. libc_arch_SOBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_SSRC))
  30. libc_arch_OBJS = $(libc_arch_COBJ) $(libc_arch_SOBJ)
  31. libc_arch_a_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(libc_arch_a_CSRC))
  32. libc_arch_a_OBJS = $(libc_arch_a_COBJ)
  33. librt_arch_COBJ = $(patsubst %.c,$(libpthread_arch_OUT)/%.o,$(librt_arch_CSRC))
  34. librt_arch_SOBJ = $(patsubst %.S,$(libpthread_arch_OUT)/%.o,$(librt_arch_SSRC))
  35. librt_arch_OBJS = $(librt_arch_COBJ) $(librt_arch_SOBJ)
  36. CFLAGS-gen_tcb-offsets.c = -S
  37. $(libpthread_arch_OUT)/gen_tcb-offsets.c: $(libpthread_arch_DIR)/tcb-offsets.sym | $(libpthread_arch_OUT)
  38. $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
  39. $(libpthread_arch_OUT)/gen_tcb-offsets.s: $(libpthread_arch_OUT)/gen_tcb-offsets.c | headers
  40. $(compile.c)
  41. libpthread-generated-y += $(libpthread_arch_OUT)/gen_tcb-offsets.s
  42. 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"
  43. $(libpthread_arch_OUT)/tcb-offsets.h: $(libpthread_arch_OUT)/gen_tcb-offsets.s
  44. $(do_sed) $(PTHREAD_TCB_OFFSET_MANGLE) $< > $@
  45. @if test ! -s $@ ; then rm -f $@ ; false ; fi
  46. pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_arch_OUT)/tcb-offsets.h
  47. objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT))
  48. headers_clean-y+= HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT))
  49. CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)):
  50. $(do_rm) $(addprefix $(libpthread_arch_OUT)/*., o os oS)
  51. HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)):
  52. $(do_rm) $(libpthread_arch_OUT)/tcb-offsets.h \
  53. $(addprefix $(libpthread_arch_OUT)/gen_tcb-offsets., c h s)
  54. ifneq ($(TARGET_SUBARCH),)
  55. objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT))
  56. CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT)):
  57. $(do_rm) $(addprefix $(libpthread_subarch_OUT)/*., o os oS)
  58. endif