Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. # glibc does not boot with Os and CPU specific FLAGS for nios2
  8. ifeq ($(ADK_TARGET_ARCH_NIOS2),y)
  9. TARGET_CFLAGS:= -O2
  10. TARGET_CXXFLAGS:= -O2
  11. endif
  12. # glibc does not compile with NEON suggested CFLAGS/CXXFLAGS
  13. TARGET_CFLAGS:= $(filter-out -ffast-math,$(TARGET_CFLAGS))
  14. TARGET_CXXFLAGS:= $(filter-out -ffast-math,$(TARGET_CXXFLAGS))
  15. GLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
  16. --host=$(GNU_TARGET_NAME) \
  17. --with-headers=$(STAGING_TARGET_DIR)/usr/include \
  18. --enable-stackguard-randomization \
  19. --disable-sanity-checks \
  20. --disable-nls \
  21. --disable-werror \
  22. --disable-nscd \
  23. --enable-shared
  24. ifeq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
  25. GLIBC_CONFOPTS+= --enable-static-nss
  26. endif
  27. GLIBC_ENV:= PATH='${HOST_PATH}:${TARGET_PATH}' \
  28. BUILD_CC='${CC_FOR_BUILD}' \
  29. CFLAGS="$(TARGET_CFLAGS)" \
  30. CXXFLAGS="$(TARGET_CXXFLAGS)" \
  31. CC="${TARGET_CC}" \
  32. CXX="${TARGET_CXX}" \
  33. AR="${TARGET_AR}" \
  34. RANLIB="${TARGET_RANLIB}" \
  35. libc_cv_gnu99_inline=yes \
  36. libc_cv_initfini_array=yes
  37. ifeq ($(ADK_TARGET_ARCH_RISCV64),y)
  38. GLIBC_ENV+= libc_cv_slibdir=/lib libc_cv_rtlddir=/lib
  39. endif
  40. ifeq ($(ADK_TARGET_ARCH_RISCV32),y)
  41. GLIBC_ENV+= libc_cv_slibdir=/lib libc_cv_rtlddir=/lib
  42. endif
  43. GLIBC_MAKEOPTS+= cross-compiling=yes
  44. ifeq (${ADK_MAKE_PARALLEL},y)
  45. GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j$(ADK_MAKE_JOBS)"
  46. endif
  47. GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  48. $(WRKBUILD)/.configured:
  49. mkdir -p $(GLIBC_BUILD_DIR_FINAL)
  50. (cd $(GLIBC_BUILD_DIR_FINAL); \
  51. ${GLIBC_ENV} \
  52. $(WRKBUILD)/configure \
  53. --prefix=/usr \
  54. ${GLIBC_CONFOPTS} \
  55. );
  56. touch $@
  57. $(WRKBUILD)/.compiled:
  58. ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL) all
  59. touch $@
  60. $(WRKBUILD)/.installed:
  61. ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  62. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  63. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,lp64,soft,hard}.h
  64. mkdir -p ${STAGING_TARGET_DIR}/etc
  65. ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
  66. ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
  67. touch $@
  68. include ${ADK_TOPDIR}/mk/toolchain.mk