Makefile 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. --disable-sanity-checks \
  19. --disable-werror \
  20. --disable-nscd \
  21. --enable-shared
  22. ifeq ($(ADK_TARGET_LINUX_ARCH_SPARC64),y)
  23. GLIBC_CONFOPTS+= --disable-default-pie
  24. else
  25. GLIBC_CONFOPTS+= --enable-default-pie
  26. endif
  27. ifeq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
  28. GLIBC_CONFOPTS+= --enable-static-nss
  29. endif
  30. GLIBC_ENV:= PATH='${HOST_PATH}:${TARGET_PATH}' \
  31. BUILD_CC='${CC_FOR_BUILD}' \
  32. CFLAGS="$(TARGET_CFLAGS)" \
  33. CXXFLAGS="$(TARGET_CXXFLAGS)" \
  34. CC="${TARGET_CC}" \
  35. CXX="${TARGET_CXX}" \
  36. AR="${TARGET_AR}" \
  37. RANLIB="${TARGET_RANLIB}" \
  38. libc_cv_gnu99_inline=yes \
  39. libc_cv_initfini_array=yes
  40. ifeq ($(ADK_TARGET_ARCH_RISCV64),y)
  41. GLIBC_ENV+= libc_cv_slibdir=/lib libc_cv_rtlddir=/lib
  42. endif
  43. ifeq ($(ADK_TARGET_ARCH_RISCV32),y)
  44. GLIBC_ENV+= libc_cv_slibdir=/lib libc_cv_rtlddir=/lib
  45. endif
  46. GLIBC_MAKEOPTS+= cross-compiling=yes
  47. ifeq (${ADK_MAKE_PARALLEL},y)
  48. GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j$(ADK_MAKE_JOBS)"
  49. endif
  50. GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  51. $(WRKBUILD)/.configured:
  52. mkdir -p $(GLIBC_BUILD_DIR_FINAL)
  53. (cd $(GLIBC_BUILD_DIR_FINAL); \
  54. ${GLIBC_ENV} \
  55. $(WRKBUILD)/configure \
  56. --prefix=/usr \
  57. ${GLIBC_CONFOPTS} \
  58. );
  59. touch $@
  60. $(WRKBUILD)/.compiled:
  61. ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL) all
  62. touch $@
  63. $(WRKBUILD)/.installed:
  64. ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  65. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  66. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,lp64,soft,hard}.h
  67. mkdir -p ${STAGING_TARGET_DIR}/etc
  68. ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
  69. ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
  70. touch $@
  71. include ${ADK_TOPDIR}/mk/toolchain.mk