Makefile.in 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # Makefile for uClibc
  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. libc_DIR := $(top_srcdir)libc
  8. libc_OUT := $(top_builddir)libc
  9. # Check if the target architecture has a version script for
  10. # libc, and if so, include it when linking.
  11. VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map)
  12. ifneq ($(VERSION_SCRIPT),)
  13. VERSION_SCRIPT := -Wl,--version-script,$(VERSION_SCRIPT)
  14. endif
  15. CFLAGS-libc :=# intentionally left blank
  16. LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libc.so := -Wl,--dsbt-index=2
  17. LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -Wl,-init,$(SYMBOL_PREFIX)__uClibc_init
  18. LIBS-libc.so := $(interp) $(ldso) $(top_builddir)lib/$(NONSHARED_LIBNAME)
  19. # we have SHARED_LIBNAME=libc.so.$(ABI_VERSION) defined in Rules.mak
  20. libc_FULL_NAME := libuClibc-$(VERSION).so
  21. # this comes first, so duplicate removal works correctly
  22. include $(libc_DIR)/sysdeps/Makefile.in
  23. include $(libc_DIR)/misc/Makefile.in
  24. include $(libc_DIR)/pwd_grp/Makefile.in
  25. include $(libc_DIR)/stdio/Makefile.in
  26. include $(libc_DIR)/string/Makefile.in
  27. include $(libc_DIR)/termios/Makefile.in
  28. include $(libc_DIR)/inet/Makefile.in
  29. include $(libc_DIR)/signal/Makefile.in
  30. include $(libc_DIR)/stdlib/Makefile.in
  31. include $(libc_DIR)/unistd/Makefile.in
  32. ifeq ($(DOPIC),y)
  33. libc-a-y = $(libc-y:.o=.os) $(libc-static-y:.o=.os)
  34. else
  35. libc-a-y = $(libc-y) $(libc-static-y)
  36. endif
  37. libc-so-y = $(libc-y:.o=.os) $(libc-shared-y)
  38. lib-a-y += $(top_builddir)lib/libc.a
  39. lib-gdb-y += $(top_builddir)lib/libc.gdb
  40. lib-so-y += $(libc.depend)
  41. objclean-y += CLEAN_libc
  42. OUTPUT_FORMAT = $(CC) $(CFLAGS) -Wl,--verbose 2>&1 | $(SED) -n '/OUTPUT_FORMAT/,/)/p'
  43. $(libc.depend): $(libc_OUT)/libc_so.a $(LIBS-libc.so)
  44. $(call link.so,$(libc_FULL_NAME),$(ABI_VERSION))
  45. # link for backward compatibility
  46. $(call link.so,$(libc_FULL_NAME),0)
  47. $(Q)$(RM) $@
  48. $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
  49. $(Q)$(OUTPUT_FORMAT) >> $@.tmp
  50. ifeq ($(COMPAT_ATEXIT),y)
  51. $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
  52. else
  53. $(Q)echo "GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
  54. endif
  55. $(Q)mv $@.tmp $@
  56. $(libc_OUT)/libc_so.a: $(libc-so-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  57. $(Q)$(RM) $@
  58. ifeq ($(DOPIC),y)
  59. $(Q)$(STRIPTOOL) $(STRIP_FLAGS) $(libc-shared-y)
  60. else
  61. $(do_strip)
  62. endif
  63. $(do_ar)
  64. $(libc_OUT)/libc.oS: $(libc-multi-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  65. $(Q)$(RM) $@
  66. $(compile-m)
  67. $(top_builddir)lib/libc.a: $(libc-a-y)
  68. $(Q)$(RM) $@
  69. $(do_ar)
  70. # We use libc_so.a so that we can compile the shared library with special
  71. # flags - i.e. -mleaf-id-shared-library. The static libc.a needs to be
  72. # compiled without it.
  73. $(top_builddir)lib/libc.gdb: $(libc_OUT)/libc_so.a $(LINK_FLAT_CRTS)
  74. $(call link-flat.so,$(@:.gdb=),$(UCLIBC_SHARED_FLAT_ID))
  75. CLEAN_libc:
  76. $(do_rm) $(addprefix $(libc_OUT)/*., o os oS a)