Makefile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_c_cleanup=yes \
  50. libc_cv_gnu99_inline=yes \
  51. libc_cv_initfini_array=yes
  52. GLIBC_MAKEOPTS+= cross-compiling=yes
  53. ifeq (${ADK_MAKE_PARALLEL},y)
  54. GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j$(ADK_MAKE_JOBS)"
  55. endif
  56. GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  57. $(WRKBUILD)/.configured:
  58. mkdir -p $(GLIBC_BUILD_DIR_FINAL)
  59. (cd $(GLIBC_BUILD_DIR_FINAL); \
  60. ${GLIBC_ENV} \
  61. $(WRKBUILD)/configure \
  62. --prefix=/usr \
  63. --enable-shared \
  64. --enable-stackguard-randomization \
  65. ${GLIBC_CONFOPTS} \
  66. );
  67. touch $@
  68. $(WRKBUILD)/.compiled:
  69. ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL) all
  70. touch $@
  71. $(WRKBUILD)/.installed:
  72. ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  73. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  74. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,soft,hard}.h
  75. mkdir -p ${STAGING_TARGET_DIR}/etc
  76. ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
  77. ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
  78. touch $@
  79. include ${ADK_TOPDIR}/mk/toolchain.mk