1
0

Makefile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 $(ADK_TOPDIR)/rules.mk
  4. include ../rules.mk
  5. TARGET_CFLAGS:= $(filter-out -ffast-math,$(TARGET_CFLAGS))
  6. # glibc does not compile with Os
  7. TARGET_CFLAGS:= $(subst Os,O2,$(TARGET_CFLAGS))
  8. ifneq ($(ADK_DEBUG),)
  9. TARGET_CFLAGS+= -O2
  10. endif
  11. include Makefile.inc
  12. include ${ADK_TOPDIR}/mk/buildhlp.mk
  13. GLIBC_MAKEOPTS+= cross-compiling=yes
  14. ifeq (${ADK_MAKE_PARALLEL},y)
  15. GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j$(ADK_MAKE_JOBS)"
  16. endif
  17. GLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
  18. GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  19. $(WRKBUILD)/.headers_configure:
  20. mkdir -p $(GLIBC_BUILD_DIR_INITIAL)
  21. (cd $(GLIBC_BUILD_DIR_INITIAL); \
  22. ${GLIBC_ENV} \
  23. $(WRKBUILD)/configure \
  24. --prefix=$(STAGING_TARGET_DIR)/usr \
  25. --with-sysroot=$(STAGING_TARGET_DIR) \
  26. ${GLIBC_CONFOPTS} \
  27. );
  28. touch $@
  29. $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
  30. (cd $(GLIBC_BUILD_DIR_INITIAL); \
  31. ${GLIBC_ENV} \
  32. $(MAKE) ${GLIBC_MAKEOPTS} install-headers \
  33. );
  34. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  35. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,soft,hard}.h
  36. touch $@
  37. $(WRKBUILD)/.configured:
  38. mkdir -p $(GLIBC_BUILD_DIR_FINAL)
  39. (cd $(GLIBC_BUILD_DIR_FINAL); \
  40. ${GLIBC_ENV} \
  41. $(WRKBUILD)/configure \
  42. --prefix=/usr \
  43. --enable-shared \
  44. --enable-stackguard-randomization \
  45. ${GLIBC_CONFOPTS} \
  46. );
  47. touch $@
  48. $(WRKBUILD)/.compiled:
  49. ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} asm-CPPFLAGS='$${CFLAGS}' -C $(GLIBC_BUILD_DIR_FINAL) all
  50. touch $@
  51. $(WRKBUILD)/.installed:
  52. ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  53. mkdir -p ${STAGING_TARGET_DIR}/etc
  54. ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
  55. ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
  56. touch $@
  57. $(WRKBUILD)/.fixup:
  58. -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -exec rm {} \;
  59. rm -rf $(STAGING_TARGET_DIR)/usr/share/locale $(STAGING_TARGET_DIR)/usr/share/i18n
  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 ${ADK_TOPDIR}/mk/toolchain.mk