Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS))
  5. TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS))
  6. include $(TOPDIR)/toolchain/glibc/Makefile.inc
  7. PKG_NAME:= glibc
  8. PKG_DESCR:= GNU C library
  9. PKG_SECTION:= base
  10. PKG_OPTS:= noremove
  11. PKG_SUBPKGS:= GLIBC GLIBC_DEV GLIBC_STATIC
  12. NO_DISTFILES:= 1
  13. include $(TOPDIR)/mk/package.mk
  14. $(eval $(call PKG_template,GLIBC,glibc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  15. $(eval $(call PKG_template,GLIBC_DEV,glibc-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  16. $(eval $(call PKG_template,GLIBC_STATIC,$(PKG_NAME)-static,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  17. XAKE_FLAGS+= GCC_HONOUR_COPTS=s
  18. CONFIG_STYLE:= manual
  19. BUILD_STYLE:= manual
  20. INSTALL_STYLE:= manual
  21. # compile nothing, glibc is already build in toolchain directory
  22. do-install:
  23. ${INSTALL_DIR} ${IDIR_GLIBC}/$(ADK_TARGET_LIBC_PATH)
  24. $(CP) $(STAGING_TARGET_DIR)/lib/ld*.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH)
  25. for file in libc libcrypt libdl libm libnsl libresolv libutil libnss_dns libnss_files; do \
  26. $(CP) $(STAGING_TARGET_DIR)/lib/$$file.so* $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
  27. $(CP) $(STAGING_TARGET_DIR)/lib/$$file-$(PKG_VERSION).so $(IDIR_GLIBC)/$(ADK_TARGET_LIBC_PATH); \
  28. done
  29. ${INSTALL_DIR} $(IDIR_GLIBC)/usr/bin
  30. $(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_GLIBC)/usr/bin
  31. ${INSTALL_DIR} ${IDIR_GLIBC}/etc
  32. ${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/gai.conf ${IDIR_GLIBC}/etc
  33. ${INSTALL_DATA} ./files/nsswitch.conf ${IDIR_GLIBC}/etc
  34. glibc-static-install:
  35. ${INSTALL_DIR} $(IDIR_GLIBC_STATIC)/usr/lib
  36. $(CP) $(STAGING_TARGET_DIR)/usr/lib/libc.a $(IDIR_GLIBC_STATIC)/usr/lib
  37. glibc-dev-install:
  38. echo $(TARGET_CFLAGS)
  39. ${INSTALL_DIR} $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH) $(IDIR_GLIBC_DEV)/usr/lib
  40. # install linker script
  41. cp ./files/libc.so.$(CPU_ARCH) $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  42. ifeq ($(ADK_TARGET_ABI_O32),y)
  43. ifeq ($(ADK_big),y)
  44. $(SED) "s#@@ELFTARGET@@#elf32-tradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  45. else
  46. $(SED) "s#@@ELFTARGET@@#elf32-tradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  47. endif
  48. endif
  49. ifeq ($(ADK_TARGET_ABI_N32),y)
  50. ifeq ($(ADK_big),y)
  51. $(SED) "s#@@ELFTARGET@@#elf32-ntradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  52. else
  53. $(SED) "s#@@ELFTARGET@@#elf32-ntradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  54. endif
  55. endif
  56. ifeq ($(ADK_TARGET_ABI_N64),y)
  57. ifeq ($(ADK_big),y)
  58. $(SED) "s#@@ELFTARGET@@#elf64-tradbigmips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  59. else
  60. $(SED) "s#@@ELFTARGET@@#elf64-tradlittlemips#" $(IDIR_GLIBC_DEV)/usr/lib/libc.so
  61. endif
  62. endif
  63. ${CP} ${STAGING_TARGET_DIR}/usr/lib/crt* ${IDIR_GLIBC_DEV}/usr/lib
  64. ${CP} ${STAGING_TARGET_DIR}/usr/lib/libc_nonshared.a ${IDIR_GLIBC_DEV}/usr/lib
  65. -for file in libcrypt libdl libm libresolv libutil; do \
  66. cd $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH); ln -sf $$file-$(PKG_VERSION).so $$file.so; \
  67. done
  68. # header package
  69. $(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)-$(KERNEL_RELEASE)/linux-$(KERNEL_VERSION) \
  70. HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
  71. INSTALL_HDR_PATH=$(IDIR_GLIBC_DEV)/usr \
  72. headers_install
  73. (cd $(WRKBUILD); \
  74. $(GLIBC_ENV) \
  75. GCC_HONOUR_COPTS=s \
  76. $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/configure \
  77. --prefix=$(IDIR_GLIBC_DEV)/usr \
  78. --with-sysroot=$(IDIR_GLIBC_DEV) \
  79. ${GLIBC_CONFOPTS} \
  80. );
  81. $(GLIBC_ENV) $(MAKE) -C $(WRKBUILD) cross-compiling=yes install-headers
  82. touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs.h
  83. touch $(IDIR_GLIBC_DEV)/usr/include/gnu/stubs-{32,x32,64}.h
  84. touch $(IDIR_GLIBC_DEV)/usr/include/bits/stdio_lim.h
  85. # WORKAROUND: bits/syscall.h is only installed via install-others target
  86. $(CP) $(STAGING_TARGET_DIR)/usr/include/bits/syscall.h \
  87. $(IDIR_GLIBC_DEV)/usr/include/bits
  88. @find $(IDIR_GLIBC_DEV) -name .install -exec rm {} \;
  89. include ${TOPDIR}/mk/pkg-bottom.mk