Makefile 3.9 KB

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