Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # $Id$
  2. #-
  3. # This file is part of the OpenADK project. OpenADK is copyrighted
  4. # material, please see the LICENCE file in the top-level directory.
  5. include $(TOPDIR)/rules.mk
  6. include ../rules.mk
  7. include Makefile.inc
  8. ifeq ($(ADK_CXX),y)
  9. TARGET_LANGUAGES:= c,c++
  10. else
  11. TARGET_LANGUAGES:= c
  12. endif
  13. GCC_CONFOPTS= --prefix=$(STAGING_TOOLS) \
  14. --build=$(GNU_HOST_NAME) \
  15. --host=$(GNU_HOST_NAME) \
  16. --target=$(REAL_GNU_TARGET_NAME) \
  17. --with-gmp=$(STAGING_TOOLS) \
  18. --with-mpfr=$(STAGING_TOOLS) \
  19. --disable-__cxa_atexit \
  20. --enable-target-optspace \
  21. --with-gnu-ld \
  22. --disable-libmudflap \
  23. --disable-libgomp \
  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. include ${TOPDIR}/mk/buildhlp.mk
  35. GCC_BUILD_DIR1:= $(WRKBUILD)-initial
  36. GCC_BUILD_DIR2:= $(WRKBUILD)-final
  37. $(WRKBUILD)/.headers:
  38. $(GCC_BUILD_DIR1)/.configured:
  39. rm -rf $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
  40. ln -sf ${STAGING_DIR}/include $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
  41. rm -rf ${STAGING_TOOLS}/$(REAL_GNU_TARGET_NAME)/lib
  42. ln -sf ${STAGING_DIR}/lib $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/lib
  43. mkdir -p $(GCC_BUILD_DIR1)
  44. (cd $(GCC_BUILD_DIR1); rm -f config.cache; PATH=$(TARGET_PATH) \
  45. $(WRKBUILD)/configure \
  46. ${GCC_CONFOPTS} \
  47. --enable-languages=c \
  48. --disable-shared \
  49. --with-sysroot=$(TOOLCHAIN_SYSROOT) \
  50. );
  51. touch $@
  52. $(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
  53. PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc all-target-libgcc
  54. touch $@
  55. $(WRKBUILD)/.configure_done: $(GCC_BUILD_DIR1)/.compiled
  56. PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc install-target-libgcc
  57. touch $@
  58. $(GCC_BUILD_DIR2)/.configured:
  59. mkdir -p $(GCC_BUILD_DIR2)
  60. (cd $(GCC_BUILD_DIR2); rm -f config.cache; PATH=$(TARGET_PATH) \
  61. $(WRKBUILD)/configure \
  62. ${GCC_CONFOPTS} \
  63. --enable-languages=$(TARGET_LANGUAGES) \
  64. --with-sysroot=$(STAGING_DIR) \
  65. --enable-shared \
  66. );
  67. touch $@
  68. $(WRKBUILD)/.compiled: $(GCC_BUILD_DIR2)/.configured
  69. PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all
  70. touch $@
  71. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  72. PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install
  73. echo $(GCC_VERSION) > $(STAGING_TOOLS)/gcc_version
  74. # Set up the symlinks to enable lying about target name.
  75. set -e; \
  76. (cd $(STAGING_TOOLS); \
  77. ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
  78. cd bin; \
  79. for app in $(REAL_GNU_TARGET_NAME)-* ; do \
  80. ln -sf $${app} \
  81. $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
  82. done; \
  83. )
  84. touch $@
  85. include ${TOPDIR}/mk/toolchain.mk