Makefile 3.0 KB

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