Makefile 3.6 KB

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