Makefile.in 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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) $(top_builddir)lib/$(NONSHARED_LIBPTHREAD)
  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-a-y += $(libnsl-a-y)
  38. libc-a-y += $(libresolv-a-y)
  39. libc-a-$(HAVE_SHARED) += $(libdl-a-y)
  40. libc-a-y += $(libm-a-y)
  41. libc-a-$(UCLIBC_HAS_LIBUTIL) += $(libutil-a-y)
  42. libc-a-$(UCLIBC_HAS_CRYPT) += $(libcrypt-a-y)
  43. libc-a-$(UCLIBC_HAS_ARGP) += $(libuargp-a-y)
  44. libc-a-$(UCLIBC_HAS_THREADS) += $(libpthread-a-y)
  45. libc-a-$(UCLIBC_HAS_REALTIME) += $(librt-a-y)
  46. libc-a-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(libintl-a-y)
  47. libc-a-$(UCLIBC_HAS_BACKTRACE) += $(libubacktrace-a-y)
  48. libc-so-y = $(libc-y:.o=.os) $(libc-shared-y)
  49. libc-so-y += $(libnsl-so-y)
  50. libc-so-y += $(libresolv-so-y)
  51. libc-so-y += $(libdl-so-y)
  52. libc-so-y += $(libm-so-y)
  53. libc-so-$(UCLIBC_HAS_LIBUTIL) += $(libutil-so-y)
  54. libc-so-$(UCLIBC_HAS_CRYPT) += $(libcrypt-so-y)
  55. libc-so-$(UCLIBC_HAS_ARGP) += $(libuargp-so-y)
  56. libc-so-$(UCLIBC_HAS_THREADS) += $(libpthread-so-y)
  57. libc-so-$(UCLIBC_HAS_REALTIME) += $(librt-so-y)
  58. libc-so-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(libintl-so-y)
  59. libc-so-$(UCLIBC_HAS_BACKTRACE) += $(libubacktrace-so-y)
  60. lib-a-y += $(top_builddir)lib/libc.a
  61. lib-gdb-y += $(top_builddir)lib/libc.gdb
  62. lib-so-y += $(libc.depend)
  63. objclean-y += CLEAN_libc
  64. OUTPUT_FORMAT = $(CC) $(CFLAGS) -Wl,--verbose 2>&1 | $(SED) -n '/OUTPUT_FORMAT/,/)/p'
  65. $(libc.depend): $(libc_OUT)/libc_so.a $(LIBS-libc.so)
  66. $(call link.so,$(libc_FULL_NAME),$(ABI_VERSION))
  67. # link for backward compatibility
  68. $(call link.so,$(libc_FULL_NAME),0)
  69. $(Q)$(RM) $@
  70. $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
  71. $(Q)$(OUTPUT_FORMAT) >> $@.tmp
  72. ifeq ($(COMPAT_ATEXIT),y)
  73. $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(NONSHARED_LIBPTHREAD) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@.tmp
  74. else
  75. $(Q)echo "GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(NONSHARED_LIBPTHREAD) $(ASNEEDED) )" >> $@.tmp
  76. endif
  77. $(Q)mv $@.tmp $@
  78. $(libc_OUT)/libc_so.a: $(libc-so-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  79. $(Q)$(RM) $@
  80. ifeq ($(DOPIC),y)
  81. $(Q)$(STRIPTOOL) $(STRIP_FLAGS) $(libc-shared-y)
  82. else
  83. $(do_strip)
  84. endif
  85. $(do_ar)
  86. $(libc_OUT)/libc.oS: $(libc-multi-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  87. $(Q)$(RM) $@
  88. $(compile-m)
  89. $(top_builddir)lib/libc.a: $(libc-a-y)
  90. $(Q)$(RM) $@
  91. $(do_ar)
  92. # We use libc_so.a so that we can compile the shared library with special
  93. # flags - i.e. -mleaf-id-shared-library. The static libc.a needs to be
  94. # compiled without it.
  95. $(top_builddir)lib/libc.gdb: $(libc_OUT)/libc_so.a $(LINK_FLAT_CRTS)
  96. $(call link-flat.so,$(@:.gdb=),$(UCLIBC_SHARED_FLAT_ID))
  97. CLEAN_libc:
  98. $(do_rm) $(addprefix $(libc_OUT)/*., o os oS a)