Makefile 3.9 KB

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