Makefile.commonarch 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. $(libpthread_arch_OUT)/tcb-offsets.h: $(top_srcdir)extra/scripts/gen-as-const.awk | headers
  37. $(libpthread_arch_OUT)/tcb-offsets.h: $(libpthread_arch_DIR)/tcb-offsets.sym
  38. @$(disp_gen)
  39. $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
  40. | $(CC) $(CFLAGS) -x c - -S -o - \
  41. | $(SED) $(PTHREAD_GENERATE_MANGLE) > $@
  42. @if test ! -s $@ ; then rm -f $@ ; false ; fi
  43. pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_arch_OUT)/tcb-offsets.h
  44. objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT))
  45. headers_clean-y+= HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT))
  46. CLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)):
  47. $(do_rm) $(addprefix $(libpthread_arch_OUT)/*., o os oS)
  48. HEADERCLEAN_$(subst $(top_builddir),,$(libpthread_arch_OUT)):
  49. $(do_rm) $(libpthread_arch_OUT)/tcb-offsets.h
  50. ifneq ($(TARGET_SUBARCH),)
  51. objclean-y += CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT))
  52. CLEAN_$(subst $(top_builddir),,$(libpthread_subarch_OUT)):
  53. $(do_rm) $(addprefix $(libpthread_subarch_OUT)/*., o os oS)
  54. endif