Makefile 2.4 KB

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