Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. ifeq ($(ADK_CXX),y)
  7. TARGET_LANGUAGES:= c,c++
  8. else
  9. TARGET_LANGUAGES:= c
  10. endif
  11. GCC_CONFOPTS= --prefix=$(STAGING_TOOLS) \
  12. --build=$(GNU_HOST_NAME) \
  13. --host=$(GNU_HOST_NAME) \
  14. --target=$(REAL_GNU_TARGET_NAME) \
  15. --with-gmp=$(STAGING_TOOLS) \
  16. --with-mpfr=$(STAGING_TOOLS) \
  17. --disable-__cxa_atexit \
  18. --enable-target-optspace \
  19. --with-gnu-ld \
  20. --without-headers \
  21. --disable-libmudflap \
  22. --disable-libgomp \
  23. --disable-biarch \
  24. --disable-multilib \
  25. --disable-nls
  26. ifeq ($(ADK_SSP),y)
  27. GCC_CONFOPTS+= --enable-libssp
  28. else
  29. GCC_CONFOPTS+= --disable-libssp
  30. endif
  31. ifeq ($(ADK_NO_FPU),y)
  32. GCC_CONFOPTS+= --with-float=soft
  33. endif
  34. ifeq ($(ADK_LINUX_MIPS64),y)
  35. GCC_CONFOPTS+= --with-abi=64
  36. endif
  37. include ${TOPDIR}/mk/buildhlp.mk
  38. GCC_BUILD_DIR1:= $(WRKBUILD)-initial
  39. GCC_BUILD_DIR2:= $(WRKBUILD)-final
  40. $(WRKBUILD)/.headers:
  41. $(GCC_BUILD_DIR1)/.configured:
  42. rm -rf $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
  43. ln -sf ${STAGING_DIR}/include $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
  44. rm -rf ${STAGING_TOOLS}/$(REAL_GNU_TARGET_NAME)/lib
  45. ln -sf ${STAGING_DIR}/lib $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/lib
  46. mkdir -p $(GCC_BUILD_DIR1)
  47. (cd $(GCC_BUILD_DIR1); rm -f config.cache; PATH=$(TARGET_PATH) \
  48. $(WRKBUILD)/configure \
  49. ${GCC_CONFOPTS} \
  50. --enable-languages=c \
  51. --disable-shared \
  52. --with-sysroot=$(TOOLCHAIN_SYSROOT) \
  53. );
  54. touch $@
  55. $(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
  56. PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc all-target-libgcc
  57. touch $@
  58. $(WRKBUILD)/.configure_done: $(GCC_BUILD_DIR1)/.compiled
  59. PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc install-target-libgcc
  60. touch $@
  61. $(GCC_BUILD_DIR2)/.configured:
  62. mkdir -p $(GCC_BUILD_DIR2)
  63. (cd $(GCC_BUILD_DIR2); rm -f config.cache; PATH=$(TARGET_PATH) \
  64. $(WRKBUILD)/configure \
  65. ${GCC_CONFOPTS} \
  66. --enable-languages=$(TARGET_LANGUAGES) \
  67. --with-sysroot=$(STAGING_DIR) \
  68. --with-slibdir=$(STAGING_DIR)/lib \
  69. --enable-shared \
  70. );
  71. touch $@
  72. $(WRKBUILD)/.compiled: $(GCC_BUILD_DIR2)/.configured
  73. PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all
  74. touch $@
  75. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  76. PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install
  77. # Set up the symlinks to enable lying about target name.
  78. set -e; \
  79. (cd $(STAGING_TOOLS); \
  80. ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
  81. cd bin; \
  82. for app in $(REAL_GNU_TARGET_NAME)-* ; do \
  83. ln -sf $${app} \
  84. $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
  85. done; \
  86. )
  87. touch $@
  88. include ${TOPDIR}/mk/toolchain.mk