Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. GCC_CONFOPTS= --prefix=$(STAGING_TOOLS) \
  7. --build=$(GNU_HOST_NAME) \
  8. --host=$(GNU_HOST_NAME) \
  9. --target=$(REAL_GNU_TARGET_NAME) \
  10. --with-gmp=$(STAGING_TOOLS) \
  11. --with-mpfr=$(STAGING_TOOLS) \
  12. --disable-__cxa_atexit \
  13. --enable-target-optspace \
  14. --with-gnu-ld \
  15. --disable-libmudflap \
  16. --disable-libgomp \
  17. --disable-biarch \
  18. --disable-multilib \
  19. --disable-sjlj-exceptions \
  20. --disable-libssp \
  21. --disable-nls
  22. ifeq ($(ADK_TARGET_NO_FPU),y)
  23. GCC_CONFOPTS+= --with-float=soft
  24. endif
  25. ifeq ($(ADK_LINUX_64),y)
  26. GCC_CONFOPTS+= --with-abi=64
  27. endif
  28. ifeq ($(ADK_TARGET_LIB_UCLIBC),y)
  29. GCC_CONFOPTS+= --disable-tls
  30. endif
  31. include ${TOPDIR}/mk/buildhlp.mk
  32. GCC_BUILD_DIR_MINIMAL:= $(WRKBUILD)-minimal
  33. GCC_BUILD_DIR_INITIAL:= $(WRKBUILD)-initial
  34. GCC_BUILD_DIR_FINAL:= $(WRKBUILD)-final
  35. $(GCC_BUILD_DIR_MINIMAL)/.configured:
  36. mkdir -p $(GCC_BUILD_DIR_MINIMAL)
  37. (cd $(GCC_BUILD_DIR_MINIMAL); rm -f config.cache; \
  38. PATH=$(TARGET_PATH) \
  39. $(WRKBUILD)/configure \
  40. ${GCC_CONFOPTS} \
  41. --enable-languages=c \
  42. --disable-shared \
  43. --with-newlib \
  44. --without-headers \
  45. );
  46. touch $@
  47. $(GCC_BUILD_DIR_MINIMAL)/.compiled: $(GCC_BUILD_DIR_MINIMAL)/.configured
  48. PATH=$(TARGET_PATH) \
  49. $(MAKE) -C $(GCC_BUILD_DIR_MINIMAL) all-gcc
  50. touch $@
  51. $(WRKBUILD)/.headers: $(GCC_BUILD_DIR_MINIMAL)/.compiled
  52. PATH=$(TARGET_PATH) \
  53. $(MAKE) -C $(GCC_BUILD_DIR_MINIMAL) install-gcc
  54. touch $@
  55. $(GCC_BUILD_DIR_INITIAL)/.configured:
  56. rm -rf $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
  57. ln -sf ${STAGING_DIR}/include $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
  58. rm -rf ${STAGING_TOOLS}/$(REAL_GNU_TARGET_NAME)/lib
  59. ln -sf ${STAGING_DIR}/lib $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/lib
  60. mkdir -p $(GCC_BUILD_DIR_INITIAL)
  61. (cd $(GCC_BUILD_DIR_INITIAL); rm -f config.cache; \
  62. PATH=$(TARGET_PATH) \
  63. $(WRKBUILD)/configure \
  64. ${GCC_CONFOPTS} \
  65. --enable-languages=c \
  66. --disable-shared \
  67. --with-sysroot=$(TOOLCHAIN_SYSROOT) \
  68. );
  69. touch $@
  70. $(GCC_BUILD_DIR_INITIAL)/.compiled: $(GCC_BUILD_DIR_INITIAL)/.configured
  71. PATH=$(TARGET_PATH) \
  72. $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) all
  73. touch $@
  74. $(WRKBUILD)/.configured: $(GCC_BUILD_DIR_INITIAL)/.compiled
  75. PATH=$(TARGET_PATH) \
  76. $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install
  77. touch $@
  78. $(GCC_BUILD_DIR_FINAL)/.configured:
  79. mkdir -p $(GCC_BUILD_DIR_FINAL)
  80. (cd $(GCC_BUILD_DIR_FINAL); rm -f config.cache; \
  81. PATH=$(TARGET_PATH) \
  82. $(WRKBUILD)/configure \
  83. ${GCC_CONFOPTS} \
  84. --enable-languages=c,c++ \
  85. --with-sysroot=$(STAGING_DIR) \
  86. --with-slibdir=$(STAGING_DIR)/lib \
  87. --enable-shared \
  88. );
  89. touch $@
  90. $(WRKBUILD)/.compiled: $(GCC_BUILD_DIR_FINAL)/.configured
  91. PATH=$(TARGET_PATH) \
  92. $(MAKE) -C $(GCC_BUILD_DIR_FINAL) all
  93. touch $@
  94. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  95. PATH=$(TARGET_PATH) \
  96. $(MAKE) -C $(GCC_BUILD_DIR_FINAL) install
  97. # workaround if you cross-compile binutils
  98. @-rm $(STAGING_DIR)/lib/libiberty.a
  99. # Set up the symlinks to enable lying about target name.
  100. set -e; \
  101. (cd $(STAGING_TOOLS); \
  102. ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
  103. cd bin; \
  104. for app in $(REAL_GNU_TARGET_NAME)-* ; do \
  105. ln -sf $${app} \
  106. $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
  107. done; \
  108. )
  109. touch $@
  110. include ${TOPDIR}/mk/toolchain.mk