Makefile 2.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 $(ADK_TOPDIR)/rules.mk
  4. include ../rules.mk
  5. include Makefile.inc
  6. include ${ADK_TOPDIR}/mk/buildhlp.mk
  7. TARGET_CFLAGS:= $(filter-out -ffast-math,$(TARGET_CFLAGS))
  8. TARGET_CFLAGS:= $(filter-out -fno-asynchronous-unwind-tables,$(TARGET_CFLAGS))
  9. TARGET_CFLAGS:= $(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
  10. TARGET_LDFLAGS:= $(filter-out -fstack-protector-all,$(TARGET_LDFLAGS))
  11. # glibc does not compile with Os
  12. TARGET_CFLAGS:= $(subst Os,O2,$(TARGET_CFLAGS))
  13. TARGET_CXXFLAGS:= $(subst Os,O2,$(TARGET_CXXFLAGS))
  14. ifneq ($(ADK_DEBUG),)
  15. TARGET_CFLAGS+= -O2
  16. TARGET_CXXFLAGS+= -O2
  17. endif
  18. GLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
  19. --host=$(GNU_TARGET_NAME) \
  20. --with-headers=$(STAGING_TARGET_DIR)/usr/include \
  21. --disable-sanity-checks \
  22. --disable-werror \
  23. --disable-nls \
  24. --disable-werror \
  25. --without-cvs \
  26. --disable-profile \
  27. --disable-debug \
  28. --without-gd \
  29. --disable-nscd \
  30. --with-__thread \
  31. --with-tls \
  32. --enable-kernel="2.6.32" \
  33. --enable-add-ons
  34. ifeq ($(ADK_TARGET_FLOAT),soft)
  35. GLIBC_CONFOPTS+= --without-fp
  36. endif
  37. ifeq ($(ADK_TARGET_FLOAT),hard)
  38. GLIBC_CONFOPTS+= --with-fp
  39. endif
  40. GLIBC_ENV:= PATH='${TARGET_PATH}' \
  41. BUILD_CC=${CC_FOR_BUILD} \
  42. CFLAGS="$(TARGET_CFLAGS)" \
  43. CXXFLAGS="$(TARGET_CXXFLAGS)" \
  44. CC="${TARGET_CC}" \
  45. CXX="${TARGET_CXX}" \
  46. AR="${TARGET_AR}" \
  47. RANLIB="${TARGET_RANLIB}" \
  48. libc_cv_forced_unwind=yes \
  49. libc_cv_cc_with_libunwind=yes \
  50. libc_cv_c_cleanup=yes \
  51. libc_cv_gnu99_inline=yes \
  52. libc_cv_initfini_array=yes
  53. GLIBC_MAKEOPTS+= cross-compiling=yes
  54. ifeq (${ADK_MAKE_PARALLEL},y)
  55. GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j$(ADK_MAKE_JOBS)"
  56. endif
  57. GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  58. $(WRKBUILD)/.configured:
  59. mkdir -p $(GLIBC_BUILD_DIR_FINAL)
  60. (cd $(GLIBC_BUILD_DIR_FINAL); \
  61. ${GLIBC_ENV} \
  62. $(WRKBUILD)/configure \
  63. --prefix=/usr \
  64. --enable-shared \
  65. --enable-stackguard-randomization \
  66. ${GLIBC_CONFOPTS} \
  67. );
  68. touch $@
  69. $(WRKBUILD)/.compiled:
  70. ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} asm-CPPFLAGS='$${CFLAGS}' -C $(GLIBC_BUILD_DIR_FINAL) all
  71. touch $@
  72. $(WRKBUILD)/.installed:
  73. ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  74. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  75. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,soft,hard}.h
  76. mkdir -p ${STAGING_TARGET_DIR}/etc
  77. ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
  78. ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
  79. touch $@
  80. include ${ADK_TOPDIR}/mk/toolchain.mk