Makefile 2.9 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 $(TOPDIR)/rules.mk
  4. include ../rules.mk
  5. # eglibc does not compile with Os on sparc
  6. ifeq ($(ADK_LINUX_SPARC),y)
  7. TARGET_CFLAGS_LIBC:= $(subst Os,O2,$(TARGET_CFLAGS))
  8. endif
  9. # ssp not supported
  10. TARGET_CFLAGS_LIBC:= $(filter-out -fstack-protector,$(TARGET_CFLAGS_LIBC))
  11. include Makefile.inc
  12. include ${TOPDIR}/mk/buildhlp.mk
  13. ifeq ($(ADK_TARGET_NO_FPU),y)
  14. EGLIBC_CONFOPTS+= --without-fp
  15. endif
  16. EGLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
  17. EGLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  18. $(WRKBUILD)/.headers_configure:
  19. mkdir -p $(EGLIBC_BUILD_DIR_INITIAL)
  20. $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
  21. $(EGLIBC_BUILD_DIR_INITIAL)/option-groups.config
  22. (cd $(EGLIBC_BUILD_DIR_INITIAL); \
  23. ${EGLIBC_ENV} \
  24. CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
  25. $(WRKBUILD)/libc/configure \
  26. --prefix=$(STAGING_TARGET_DIR)/usr \
  27. --with-headers=$(STAGING_TARGET_DIR)/usr/include \
  28. --host=$(REAL_GNU_TARGET_NAME) \
  29. ${EGLIBC_CONFOPTS} \
  30. );
  31. touch $@
  32. $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
  33. (cd $(EGLIBC_BUILD_DIR_INITIAL); \
  34. ${EGLIBC_ENV} \
  35. CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
  36. $(MAKE) install-headers install-bootstrap-headers=yes cross-compiling=yes \
  37. );
  38. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  39. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,o32,n32,soft,hard}.h
  40. touch $@
  41. ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
  42. EGLIBC_ENV+= libc_cv_ssp=yes
  43. else
  44. EGLIBC_ENV+= libc_cv_ssp=no
  45. endif
  46. $(WRKBUILD)/.configured:
  47. mkdir -p $(EGLIBC_BUILD_DIR_FINAL)
  48. $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
  49. $(EGLIBC_BUILD_DIR_FINAL)/option-groups.config
  50. (cd $(EGLIBC_BUILD_DIR_FINAL); \
  51. ${EGLIBC_ENV} \
  52. CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
  53. $(WRKBUILD)/libc/configure \
  54. --prefix=/usr \
  55. --enable-shared \
  56. --enable-stackguard-randomization \
  57. --host=$(REAL_GNU_TARGET_NAME) \
  58. ${EGLIBC_CONFOPTS} \
  59. );
  60. touch $@
  61. $(EGLIBC_BUILD_DIR_FINAL)/libc.so:
  62. $(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
  63. ${EGLIBC_ENV} \
  64. CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
  65. $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) cross-compiling=yes all
  66. touch $@
  67. $(WRKBUILD)/.installed: $(EGLIBC_BUILD_DIR_FINAL)/libc.so
  68. ${EGLIBC_ENV} \
  69. CC="${REAL_GNU_TARGET_NAME}-gcc $(ADK_TARGET_ABI_CFLAGS)" \
  70. $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  71. ${INSTALL_DIR} ${STAGING_TARGET_DIR}/etc
  72. ${INSTALL_DATA} ${WRKBUILD}/libc/posix/gai.conf ${STAGING_TARGET_DIR}/etc/
  73. ${INSTALL_DATA} ${WRKBUILD}/libc/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/
  74. ${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/
  75. touch $@
  76. $(WRKBUILD)/.fixup:
  77. touch $@
  78. include ${TOPDIR}/mk/toolchain.mk