Makefile.commonarch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Makefile template to be included by sysdeps/linux/<ARCH>/Makefile.arch
  2. #
  3. # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. ARCH_DIR := $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
  8. ARCH_OUT := $(top_builddir)libc/sysdeps/linux/$(TARGET_ARCH)
  9. ARCH_CSRC := $(addprefix $(ARCH_DIR)/,$(CSRC-y))
  10. ARCH_COBJ := $(addprefix $(ARCH_OUT)/,$(CSRC-y:.c=.o))
  11. ARCH_SSRC = $(addprefix $(ARCH_DIR)/,$(SSRC-y))
  12. ARCH_SOBJ = $(patsubst %.s,%.o,$(patsubst %.S,%.o,$(addprefix $(ARCH_OUT)/,$(SSRC-y))))
  13. ARCH_OBJS-y = $(ARCH_COBJ) $(ARCH_SOBJ)
  14. libc-y += $(ARCH_OBJS-y)
  15. libc-nomulti-y += $(ARCH_SOBJ)
  16. objclean-y += CLEAN_$(subst $(top_builddir),,$(ARCH_OUT))
  17. CFLAGS-OMIT-crt1.S := -D_LIBC_REENTRANT
  18. CFLAGS-OMIT-crti.S := -D_LIBC_REENTRANT
  19. CFLAGS-OMIT-crtn.S := -D_LIBC_REENTRANT
  20. CFLAGS-OMIT-crtreloc.c := -D_LIBC_REENTRANT
  21. CFLAGS-crti.S += $(PICFLAG)
  22. CFLAGS-crtn.S += $(PICFLAG)
  23. # Due to a "bug" in make these order_only prereqs inherit per-target flags.
  24. # Attempt to workaround this inconvenient behaviour:
  25. CFLAGS-OMIT-crt1.S += $(CFLAGS-rtld) -DIN_LIB=%
  26. CFLAGS-OMIT-crtreloc.c += $(CFLAGS-rtld) -DIN_LIB=%
  27. CLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
  28. $(do_rm) $(addprefix $(ARCH_OUT)/*., o os oS) $(CTOR_TARGETS) $(CRTS)
  29. ifneq ($(ARCH_HEADERS),)
  30. ARCH_HEADERS_OUT := $(patsubst %,$(top_builddir)include/%,$(ARCH_HEADERS))
  31. $(ARCH_HEADERS_OUT):
  32. $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@
  33. headers-y += $(ARCH_HEADERS_OUT)
  34. headers_clean-y += HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT))
  35. HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
  36. $(do_rm) $(ARCH_HEADERS_OUT)
  37. endif
  38. $(ARCH_OUT)/ucontext_i.h: $(top_srcdir)extra/scripts/gen-as-const.awk
  39. $(ARCH_OUT)/ucontext_i.h: $(ARCH_DIR)/ucontext_i.sym
  40. @$(disp_gen)
  41. $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
  42. | $(CC) $(CFLAGS) -x c - -S -o - \
  43. | $(SED) $(PTHREAD_GENERATE_MANGLE) > $@
  44. @if test ! -s $@ ; then rm -f $@ ; false ; fi
  45. pregen-headers-$(UCLIBC_HAS_CONTEXT_FUNCS) += $(ARCH_OUT)/ucontext_i.h
  46. headers_clean-$(UCLIBC_HAS_CONTEXT_FUNCS) += \
  47. HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)/ucontext_i)
  48. HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)/ucontext_i):
  49. $(do_rm) $(addprefix $(ARCH_OUT)/ucontext_i., c h s)