1
0

Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 ../rules.mk
  5. # glibc does not compile with Os
  6. TARGET_CFLAGS:= $(subst Os,O2,$(TARGET_CFLAGS))
  7. ifneq ($(ADK_DEBUG),)
  8. TARGET_CFLAGS+= -O2
  9. endif
  10. # ssp unsupported
  11. TARGET_CFLAGS:= $(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
  12. include Makefile.inc
  13. include ${TOPDIR}/mk/buildhlp.mk
  14. GLIBC_MAKEOPTS+= cross-compiling=yes
  15. ifeq (${ADK_MAKE_PARALLEL},y)
  16. GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j1"
  17. endif
  18. GLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
  19. GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  20. $(WRKBUILD)/.headers_configure:
  21. mkdir -p $(GLIBC_BUILD_DIR_INITIAL)
  22. (cd $(GLIBC_BUILD_DIR_INITIAL); \
  23. ${GLIBC_ENV} \
  24. $(WRKBUILD)/configure \
  25. --prefix=$(STAGING_TARGET_DIR)/usr \
  26. --with-sysroot=$(STAGING_TARGET_DIR) \
  27. ${GLIBC_CONFOPTS} \
  28. );
  29. touch $@
  30. $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
  31. (cd $(GLIBC_BUILD_DIR_INITIAL); \
  32. ${GLIBC_ENV} \
  33. $(MAKE) ${GLIBC_MAKEOPTS} install-headers \
  34. );
  35. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  36. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,soft,hard}.h
  37. touch $@
  38. $(WRKBUILD)/.configured:
  39. mkdir -p $(GLIBC_BUILD_DIR_FINAL)
  40. (cd $(GLIBC_BUILD_DIR_FINAL); \
  41. ${GLIBC_ENV} \
  42. $(WRKBUILD)/configure \
  43. --prefix=/usr \
  44. --enable-shared \
  45. --enable-stackguard-randomization \
  46. ${GLIBC_CONFOPTS} \
  47. );
  48. touch $@
  49. $(WRKBUILD)/.compiled:
  50. ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL) all
  51. touch $@
  52. $(WRKBUILD)/.installed:
  53. ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  54. mkdir -p ${STAGING_TARGET_DIR}/etc
  55. ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
  56. ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
  57. touch $@
  58. $(WRKBUILD)/.fixup:
  59. -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -delete
  60. rm -rf $(STAGING_TARGET_DIR)/usr/share/locale $(STAGING_TARGET_DIR)/usr/share/i18n
  61. rm -rf $(STAGING_TARGET_DIR)/usr/lib/gconv
  62. ifeq ($(ADK_TARGET_TOOLCHAIN),y)
  63. # strip target libs and host tools for toolchain builds
  64. PATH="$(TARGET_PATH)" debug='0' prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh \
  65. $(STAGING_TARGET_DIR) $(TOOLCHAIN_DIR)/usr/lib/gcc/$(GNU_TARGET_NAME)
  66. debug='0' prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(TOOLCHAIN_DIR)/usr/bin
  67. endif
  68. touch $@
  69. include ${TOPDIR}/mk/toolchain.mk