Makefile.in 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000 by Lineo, inc.
  4. # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. #
  6. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. #
  8. libc_DIR := $(top_srcdir)libc
  9. libc_OUT := $(top_builddir)libc
  10. # Check if the target architecture has a version script for
  11. # libc, and if so, include it when linking.
  12. VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map)
  13. ifneq ($(VERSION_SCRIPT),)
  14. VERSION_SCRIPT := --version-script $(VERSION_SCRIPT)
  15. endif
  16. LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -init __uClibc_init
  17. LIBS-libc.so := $(interp) $(ldso) $(top_builddir)lib/$(NONSHARED_LIBNAME)
  18. # we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak
  19. libc_FULL_NAME := libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  20. # this comes first, so duplicate removal works correctly
  21. include $(libc_DIR)/sysdeps/Makefile.in
  22. include $(libc_DIR)/misc/Makefile.in
  23. include $(libc_DIR)/pwd_grp/Makefile.in
  24. include $(libc_DIR)/stdio/Makefile.in
  25. include $(libc_DIR)/string/Makefile.in
  26. include $(libc_DIR)/termios/Makefile.in
  27. include $(libc_DIR)/inet/Makefile.in
  28. include $(libc_DIR)/signal/Makefile.in
  29. include $(libc_DIR)/stdlib/Makefile.in
  30. include $(libc_DIR)/unistd/Makefile.in
  31. ifeq ($(DOPIC),y)
  32. libc-a-y = $(libc-y:.o=.os) $(libc-static-y:.o=.os)
  33. else
  34. libc-a-y = $(libc-y) $(libc-static-y)
  35. endif
  36. ifneq ($(DOMULTI),y)
  37. libc-so-y = $(libc-y:.o=.os) $(libc-shared-y)
  38. else
  39. all_sources = $(libc-y:.o=.c)
  40. all_sources += $(libc-shared-y:.oS=.c)
  41. libc-multi-y = $(filter-out $(libc-nomulti-y:.o=.c),$(all_sources))
  42. endif
  43. lib-a-y += $(top_builddir)lib/libc.a
  44. lib-so-y += $(libc)
  45. objclean-y += libc_clean
  46. ifneq ($(DOMULTI),y)
  47. $(libc:.$(MAJOR_VERSION)=): $(libc_OUT)/libc_so.a $(LIBS-libc.so)
  48. $(call link.so,$(libc_FULL_NAME),$(MAJOR_VERSION))
  49. else
  50. $(libc:.$(MAJOR_VERSION)=): $(libc_OUT)/libc.oS $(libc-nomulti-y:.o=.os) $(LIBS-libc.so)
  51. $(call linkm.so,$(libc_FULL_NAME),$(MAJOR_VERSION))
  52. endif
  53. $(Q)$(RM) $@
  54. $(Q)echo "/* GNU ld script" > $@
  55. $(Q)echo " * Use the shared library, but some functions are only in" >> $@
  56. $(Q)echo " * the static library, so try that secondarily. */" >> $@
  57. ifeq ($(COMPAT_ATEXIT),y)
  58. $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_MAJORNAME) $(ASNEEDED) )" >> $@
  59. else
  60. $(Q)echo "GROUP ( $(SHARED_MAJORNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@
  61. endif
  62. $(libc_OUT)/libc_so.a: $(libc-so-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  63. $(Q)$(RM) $@
  64. ifeq ($(DOPIC),y)
  65. $(Q)$(STRIPTOOL) $(STRIP_FLAGS) $(libc-shared-y)
  66. else
  67. $(do_strip)
  68. endif
  69. $(do_ar)
  70. $(libc_OUT)/libc.oS: $(libc-multi-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  71. $(Q)$(RM) $@
  72. $(compile-m)
  73. $(do_t_strip)
  74. $(top_builddir)lib/libc.a: $(libc-a-y) | $(crt-y)
  75. $(Q)$(INSTALL) -d $(dir $@)
  76. $(Q)$(RM) $@
  77. $(do_strip)
  78. $(do_ar)
  79. libc_clean:
  80. $(RM) $(libc_OUT)/*.{o,os,oS,a}