Makefile.in 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -Wl,-init,$(SYMBOL_PREFIX)__uClibc_init
  16. ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
  17. CFLAGS += -D__USE_STDIO_FUTEXES__
  18. endif
  19. LIBS-libc.so := $(interp) $(ldso) $(top_builddir)lib/$(NONSHARED_LIBNAME)
  20. # we have SHARED_LIBNAME=libc.so.$(ABI_VERSION) defined in Rules.mak
  21. libc_FULL_NAME := libuClibc-$(VERSION).so
  22. # this comes first, so duplicate removal works correctly
  23. include $(libc_DIR)/sysdeps/Makefile.in
  24. include $(libc_DIR)/misc/Makefile.in
  25. include $(libc_DIR)/pwd_grp/Makefile.in
  26. include $(libc_DIR)/stdio/Makefile.in
  27. include $(libc_DIR)/string/Makefile.in
  28. include $(libc_DIR)/termios/Makefile.in
  29. include $(libc_DIR)/inet/Makefile.in
  30. include $(libc_DIR)/signal/Makefile.in
  31. include $(libc_DIR)/stdlib/Makefile.in
  32. include $(libc_DIR)/unistd/Makefile.in
  33. ifeq ($(DOPIC),y)
  34. libc-a-y = $(libc-y:.o=.os) $(libc-static-y:.o=.os)
  35. else
  36. libc-a-y = $(libc-y) $(libc-static-y)
  37. endif
  38. ifeq ($(DOMULTI),n)
  39. libc-so-y = $(libc-y:.o=.os) $(libc-shared-y)
  40. else
  41. all_sources = $(libc-y:.o=.c)
  42. all_sources += $(libc-shared-y:.oS=.c)
  43. libc-multi-y = $(filter-out $(libc-nomulti-y:.o=.c),$(all_sources))
  44. endif
  45. lib-a-y += $(top_builddir)lib/libc.a
  46. lib-gdb-y += $(top_builddir)lib/libc.gdb
  47. lib-so-y += $(libc.depend)
  48. objclean-y += CLEAN_libc
  49. OUTPUT_FORMAT = $(CC) $(CFLAGS) -Wl,--verbose 2>&1 | $(SED) -n '/OUTPUT_FORMAT/,/)/p'
  50. ifeq ($(DOMULTI),n)
  51. $(libc.depend): $(libc_OUT)/libc_so.a $(LIBS-libc.so)
  52. $(call link.so,$(libc_FULL_NAME),$(ABI_VERSION))
  53. else
  54. $(libc.depend): $(libc_OUT)/libc.oS $(libc-nomulti-y:.o=.oS) | $(LIBS-libc.so)
  55. $(call linkm.so,$(libc_FULL_NAME),$(ABI_VERSION))
  56. endif
  57. $(Q)$(RM) $@
  58. $(Q)cp $(top_srcdir)extra/scripts/format.lds $@
  59. $(Q)$(OUTPUT_FORMAT) >> $@
  60. ifeq ($(COMPAT_ATEXIT),y)
  61. $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_LIBNAME) $(ASNEEDED) )" >> $@
  62. else
  63. $(Q)echo "GROUP ( $(SHARED_LIBNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@
  64. endif
  65. $(libc_OUT)/libc_so.a: $(libc-so-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  66. $(Q)$(RM) $@
  67. ifeq ($(DOPIC),y)
  68. $(Q)$(STRIPTOOL) $(STRIP_FLAGS) $(libc-shared-y)
  69. else
  70. $(do_strip)
  71. endif
  72. $(do_ar)
  73. $(libc_OUT)/libc.oS: $(libc-multi-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  74. $(Q)$(RM) $@
  75. $(compile-m)
  76. $(top_builddir)lib/libc.a: $(libc-a-y) | $(crt-y)
  77. $(Q)$(INSTALL) -d $(dir $@)
  78. $(Q)$(RM) $@
  79. $(do_ar)
  80. # We use libc_so.a so that we can compile the shared library with special
  81. # flags - i.e. -mleaf-id-shared-library. The static libc.a needs to be
  82. # compiled without it.
  83. $(top_builddir)lib/libc.gdb: $(libc_OUT)/libc_so.a $(LINK_FLAT_CRTS)
  84. $(call link-flat.so,$(@:.gdb=),$(UCLIBC_SHARED_FLAT_ID))
  85. CLEAN_libc:
  86. $(do_rm) $(addprefix $(libc_OUT)/*., o os oS a)