Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. include Makefile.inc
  6. include ${TOPDIR}/mk/buildhlp.mk
  7. ifneq ($(ADK_DEBUG),)
  8. TARGET_CFLAGS+= -O2
  9. endif
  10. # ssp partially supported
  11. TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS))
  12. EGLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
  13. --host=$(REAL_GNU_TARGET_NAME) \
  14. --without-cvs \
  15. --disable-profile \
  16. --disable-debug \
  17. --enable-kernel=2.6.0 \
  18. --without-gd \
  19. --with-__thread \
  20. --with-tls \
  21. --enable-add-ons \
  22. $(NLS)
  23. EGLIBC_ENV:= PATH='${TARGET_PATH}' \
  24. BUILD_CC=${CC_FOR_BUILD} \
  25. CFLAGS="$(TARGET_CFLAGS)" \
  26. CC=${REAL_GNU_TARGET_NAME}-gcc \
  27. CXX=${REAL_GNU_TARGET_NAME}-g++ \
  28. AR=${REAL_GNU_TARGET_NAME}-ar \
  29. RANLIB=${REAL_GNU_TARGET_NAME}-ranlib \
  30. libc_cv_cc_with_libunwind=no \
  31. libc_cv_forced_unwind=yes \
  32. libc_cv_c_cleanup=yes \
  33. libc_cv_gnu99_inline=yes \
  34. libc_cv_initfini_array=yes \
  35. libc_cv_slibdir="/lib"
  36. ifeq ($(ADK_TARGET_NO_FPU),y)
  37. EGLIBC_CONFOPTS+= --without-fp
  38. endif
  39. EGLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
  40. EGLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  41. $(WRKBUILD)/.headers_configure:
  42. mkdir -p $(EGLIBC_BUILD_DIR_INITIAL)
  43. (cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \
  44. ln -sf ../ports ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)/libc);
  45. $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
  46. $(EGLIBC_BUILD_DIR_INITIAL)/option-groups.config
  47. (cd $(EGLIBC_BUILD_DIR_INITIAL); \
  48. ${EGLIBC_ENV} \
  49. $(WRKBUILD)/libc/configure \
  50. --prefix=$(STAGING_TARGET_DIR)/usr \
  51. --with-headers=$(STAGING_TARGET_DIR)/usr/include \
  52. ${EGLIBC_CONFOPTS} \
  53. );
  54. touch $@
  55. $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
  56. (cd $(EGLIBC_BUILD_DIR_INITIAL); \
  57. PATH='${TARGET_PATH}' \
  58. ${EGLIBC_ENV} \
  59. $(MAKE) install-headers install-bootstrap-headers=yes cross-compiling=yes \
  60. );
  61. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  62. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-64.h
  63. touch $@
  64. ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
  65. EGLIBC_ENV+= libc_cv_ssp=yes
  66. else
  67. EGLIBC_ENV+= libc_cv_ssp=no
  68. endif
  69. $(WRKBUILD)/.configured:
  70. mkdir -p $(EGLIBC_BUILD_DIR_FINAL)
  71. $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
  72. $(EGLIBC_BUILD_DIR_FINAL)/option-groups.config
  73. (cd $(EGLIBC_BUILD_DIR_FINAL); \
  74. ${EGLIBC_ENV} \
  75. $(WRKBUILD)/libc/configure \
  76. --prefix=/usr \
  77. --enable-shared \
  78. --enable-stackguard-randomization \
  79. ${EGLIBC_CONFOPTS} \
  80. );
  81. touch $@
  82. $(EGLIBC_BUILD_DIR_FINAL)/libc.so:
  83. $(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
  84. ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) cross-compiling=yes all
  85. touch $@
  86. $(WRKBUILD)/.installed: $(EGLIBC_BUILD_DIR_FINAL)/libc.so
  87. ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  88. ${INSTALL_DATA} ${WRKBUILD}/libc/posix/gai.conf ${STAGING_TARGET_DIR}/etc/
  89. ${INSTALL_DATA} ${WRKBUILD}/libc/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/
  90. ${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/
  91. touch $@
  92. include ${TOPDIR}/mk/toolchain.mk