Makefile.in 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000 by Lineo, inc.
  4. # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  5. #
  6. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. #
  8. # Check if the target architecture has a version script for
  9. # libc, and if so, include it when linking.
  10. VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map)
  11. ifneq ($(VERSION_SCRIPT),)
  12. VERSION_SCRIPT := --version-script $(VERSION_SCRIPT)
  13. endif
  14. LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -init __uClibc_init
  15. LIBS-libc.so := $(interp) $(ldso)
  16. # we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak
  17. libc_FULL_NAME := libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  18. libc_DIR := $(top_srcdir)libc
  19. libc_OUT := $(top_builddir)libc
  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. libc-a-y += $(libc-static-y)
  32. libc-so-y += $(libc-shared-y)
  33. ifeq ($(DOPIC),y)
  34. libc-a-y := $(libc-a-y:.o=.os)
  35. endif
  36. libc-nomulti-y += $(libc-shared-y)
  37. lib-a-y += $(top_builddir)lib/libc.a
  38. lib-so-y += $(libc)
  39. objclean-y += libc_clean
  40. $(libc): $(libc_OUT)/libc_so.a $(LIBS-libc.so)
  41. $(call link.so,$(libc_FULL_NAME),$(MAJOR_VERSION))
  42. $(Q)$(RM) $@
  43. $(Q)echo "/* GNU ld script" > $@
  44. $(Q)echo " * Use the shared library, but some functions are only in" >> $@
  45. $(Q)echo " * the static library, so try that secondarily. */" >> $@
  46. ifeq ($(COMPAT_ATEXIT),y)
  47. $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_MAJORNAME) $(ASNEEDED) )" >> $@
  48. else
  49. $(Q)echo "GROUP ( $(SHARED_MAJORNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@
  50. endif
  51. $(libc_OUT)/libc_so.a: $(libc-so-y) | $(top_builddir)lib/libc.a $(top_builddir)lib/$(NONSHARED_LIBNAME)
  52. $(Q)$(RM) $@
  53. ifeq ($(DOPIC),y)
  54. $(Q)$(STRIPTOOL) $(STRIP_FLAGS) $(libc-shared-y)
  55. else
  56. $(do_strip)
  57. endif
  58. $(do_ar)
  59. $(top_builddir)lib/libc.a: $(libc-a-y) | $(crt-y)
  60. $(Q)$(INSTALL) -d $(dir $@)
  61. $(Q)$(RM) $@
  62. $(do_strip)
  63. $(do_ar)
  64. libc_clean:
  65. $(RM) $(libc_OUT)/*.{o,os,a}