Makefile.commonarch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. crt-y := FORCE
  15. libc-y += $(ARCH_OBJS-y)
  16. libc-nomulti-y += $(ARCH_SOBJ)
  17. objclean-y += CLEAN_$(subst $(top_builddir),,$(ARCH_OUT))
  18. CFLAGS-OMIT-crt1.S := -D_LIBC_REENTRANT
  19. CFLAGS-OMIT-crti.S := -D_LIBC_REENTRANT
  20. CFLAGS-OMIT-crtn.S := -D_LIBC_REENTRANT
  21. CFLAGS-OMIT-crtreloc.c := -D_LIBC_REENTRANT
  22. CFLAGS-crti.S += $(PICFLAG)
  23. CFLAGS-crtn.S += $(PICFLAG)
  24. # Due to a "bug" in make these order_only prereqs inherit per-target flags.
  25. # Attempt to workaround this inconvenient behaviour:
  26. CFLAGS-OMIT-crt1.S += $(CFLAGS-rtld) -DIN_LIB=%
  27. CFLAGS-OMIT-crtreloc.c += $(CFLAGS-rtld) -DIN_LIB=%
  28. CLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
  29. $(do_rm) $(addprefix $(ARCH_OUT)/*., o os oS) $(CTOR_TARGETS) $(CRTS)
  30. ifneq ($(ARCH_HEADERS),)
  31. ARCH_HEADERS_OUT := $(patsubst %,$(top_builddir)include/%,$(ARCH_HEADERS))
  32. $(ARCH_HEADERS_OUT):
  33. $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@
  34. headers-y += $(ARCH_HEADERS_OUT)
  35. headers_clean-y += HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT))
  36. HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)):
  37. $(do_rm) $(ARCH_HEADERS_OUT)
  38. endif
  39. CFLAGS-ucontext_i.c = -S
  40. $(ARCH_OUT)/ucontext_i.c: $(ARCH_DIR)/ucontext_i.sym
  41. $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
  42. $(ARCH_OUT)/ucontext_i.s: $(ARCH_OUT)/ucontext_i.c
  43. $(compile.c)
  44. $(ARCH_OUT)/ucontext_i.h: $(ARCH_OUT)/ucontext_i.s
  45. $(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
  46. pregen-headers-$(UCLIBC_HAS_CONTEXT_FUNCS) += $(ARCH_OUT)/ucontext_i.h
  47. headers_clean-$(UCLIBC_HAS_CONTEXT_FUNCS) += \
  48. HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)/ucontext_i)
  49. HEADERCLEAN_$(subst $(top_builddir),,$(ARCH_OUT)/ucontext_i):
  50. $(do_rm) $(addprefix $(ARCH_OUT)/ucontext_i., c h s)