Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(TOPDIR)/rules.mk
  4. include $(TOPDIR)/toolchain/eglibc/Makefile.inc
  5. PKG_DESCR:= embedded GNU C library
  6. PKG_SECTION:= base
  7. PKG_OPTS:= noremove
  8. PKG_SUBPKGS:= EGLIBC EGLIBC_DEV EGLIBC_STATIC
  9. NO_DISTFILES:= 1
  10. include $(TOPDIR)/mk/package.mk
  11. $(eval $(call PKG_template,EGLIBC,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  12. $(eval $(call PKG_template,EGLIBC_DEV,$(PKG_NAME)-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  13. $(eval $(call PKG_template,EGLIBC_STATIC,$(PKG_NAME)-static,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  14. CONFIG_STYLE:= manual
  15. BUILD_STYLE:= manual
  16. INSTALL_STYLE:= manual
  17. # compile nothing, eglibc is already build in toolchain directory
  18. do-install:
  19. ${INSTALL_DIR} $(IDIR_EGLIBC)/$(ADK_TARGET_LIBC_PATH) \
  20. $(IDIR_EGLIBC)/usr/lib $(IDIR_EGLIBC)/usr/bin
  21. $(CP) $(STAGING_TARGET_DIR)/lib/ld* $(IDIR_EGLIBC)/$(ADK_TARGET_LIBC_PATH)
  22. -for file in libc libcrypt libdl libm libresolv libutil libnsl libnss_dns libnss_files; do \
  23. $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_EGLIBC)/$(ADK_TARGET_LIBC_PATH); \
  24. $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_EGLIBC)/$(ADK_TARGET_LIBC_PATH); \
  25. done
  26. $(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_EGLIBC)/usr/bin
  27. ${INSTALL_DIR} $(IDIR_EGLIBC)/etc
  28. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_EGLIBC}/etc
  29. ${INSTALL_DATA} ./files/nsswitch.conf ${IDIR_EGLIBC}/etc
  30. eglibc-static-install:
  31. ${INSTALL_DIR} $(IDIR_EGLIBC_STATIC)/usr/lib
  32. $(CP) $(STAGING_TARGET_DIR)/usr/lib/libc.a $(IDIR_EGLIBC_STATIC)/usr/lib
  33. eglibc-dev-install:
  34. ${INSTALL_DIR} $(IDIR_EGLIBC_DEV)/$(ADK_TARGET_LIBC_PATH) $(IDIR_EGLIBC_DEV)/usr/lib
  35. # install linker script
  36. cp ./files/libc.so.$(CPU_ARCH) $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  37. ifeq ($(ADK_TARGET_ABI_O32),y)
  38. ifeq ($(ADK_big),y)
  39. $(SED) "s#@@ELFTARGET@@#elf32-tradbigmips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  40. else
  41. $(SED) "s#@@ELFTARGET@@#elf32-tradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  42. endif
  43. endif
  44. ifeq ($(ADK_TARGET_ABI_N32),y)
  45. ifeq ($(ADK_big),y)
  46. $(SED) "s#@@ELFTARGET@@#elf32-ntradbigmips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  47. else
  48. $(SED) "s#@@ELFTARGET@@#elf32-ntradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  49. endif
  50. endif
  51. ifeq ($(ADK_TARGET_ABI_N64),y)
  52. ifeq ($(ADK_big),y)
  53. $(SED) "s#@@ELFTARGET@@#elf64-tradbigmips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  54. else
  55. $(SED) "s#@@ELFTARGET@@#elf64-tradlittlemips#" $(IDIR_EGLIBC_DEV)/usr/lib/libc.so
  56. endif
  57. endif
  58. ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_EGLIBC_DEV}/usr/lib
  59. ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_EGLIBC_DEV}/usr/lib
  60. -for file in libcrypt libdl libm libresolv libutil libnsl; do \
  61. cd $(IDIR_EGLIBC_DEV)/$(ADK_TARGET_LIBC_PATH)/; ln -sf $$file-$(PKG_VERSION).so $$file.so; \
  62. done
  63. # header package
  64. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
  65. HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
  66. INSTALL_HDR_PATH=$(IDIR_EGLIBC_DEV)/usr \
  67. headers_install
  68. (cd $(WRKBUILD); \
  69. ${EGLIBC_ENV} \
  70. $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/libc/configure \
  71. --host=$(REAL_GNU_TARGET_NAME) \
  72. --prefix=$(IDIR_EGLIBC_DEV)/usr \
  73. --with-headers=$(IDIR_EGLIBC_DEV)/usr/include \
  74. ${EGLIBC_CONFOPTS} \
  75. );
  76. PATH='${TARGET_PATH}' $(MAKE) -C $(WRKBUILD) install-headers install-bootstrap-headers=yes
  77. touch $(IDIR_EGLIBC_DEV)/usr/include/gnu/stubs.h
  78. touch $(IDIR_EGLIBC_DEV)/usr/include/gnu/stubs-{32,x32,64}.h
  79. @find $(IDIR_EGLIBC_DEV) -name .install -exec rm {} \;
  80. @find $(IDIR_EGLIBC_DEV) -name ..install.cmd -exec rm {} \;
  81. # conflicts with libiconv
  82. find $(IDIR_EGLIBC_DEV) -name iconv.h -exec rm {} \;
  83. include ${TOPDIR}/mk/pkg-bottom.mk