Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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-nls
  24. ifeq ($(ADK_TARGET_NO_FPU),y)
  25. GCC_CONFOPTS+= --with-float=soft
  26. endif
  27. ifeq ($(ADK_LINUX_64),y)
  28. GCC_CONFOPTS+= --with-abi=64
  29. endif
  30. ifeq ($(ADK_TARGET_LIB_UCLIBC),y)
  31. GCC_CONFOPTS+= --disable-tls
  32. else
  33. GCC_CONFOPTS+= --enable-tls
  34. endif
  35. ifeq (${ADK_MAKE_PARALLEL},y)
  36. GCC_MAKEOPTS+= -j${ADK_MAKE_JOBS}
  37. endif
  38. include ${TOPDIR}/mk/buildhlp.mk
  39. GCC_BUILD_DIR_MINIMAL:= $(WRKBUILD)-minimal
  40. GCC_BUILD_DIR_INITIAL:= $(WRKBUILD)-initial
  41. GCC_BUILD_DIR_FINAL:= $(WRKBUILD)-final
  42. $(GCC_BUILD_DIR_MINIMAL)/.configured:
  43. mkdir -p $(GCC_BUILD_DIR_MINIMAL)
  44. (cd $(GCC_BUILD_DIR_MINIMAL); rm -f config.cache; \
  45. PATH=$(TARGET_PATH) \
  46. $(WRKBUILD)/configure \
  47. ${GCC_CONFOPTS} \
  48. --enable-languages=c \
  49. --disable-shared \
  50. --with-newlib \
  51. --without-headers \
  52. );
  53. touch $@
  54. $(GCC_BUILD_DIR_MINIMAL)/.compiled: $(GCC_BUILD_DIR_MINIMAL)/.configured
  55. PATH=$(TARGET_PATH) \
  56. $(MAKE) ${GCC_MAKEOPTS} -C $(GCC_BUILD_DIR_MINIMAL) all-gcc
  57. touch $@
  58. $(WRKBUILD)/.headers: $(GCC_BUILD_DIR_MINIMAL)/.compiled
  59. PATH=$(TARGET_PATH) \
  60. $(MAKE) -C $(GCC_BUILD_DIR_MINIMAL) install-gcc
  61. touch $@
  62. $(GCC_BUILD_DIR_INITIAL)/.configured:
  63. rm -rf $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
  64. ln -sf ${STAGING_DIR}/include $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
  65. rm -rf ${STAGING_TOOLS}/$(REAL_GNU_TARGET_NAME)/lib
  66. ln -sf ${STAGING_DIR}/lib $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/lib
  67. mkdir -p $(GCC_BUILD_DIR_INITIAL)
  68. (cd $(GCC_BUILD_DIR_INITIAL); rm -f config.cache; \
  69. PATH=$(TARGET_PATH) \
  70. $(WRKBUILD)/configure \
  71. ${GCC_CONFOPTS} \
  72. --enable-languages=c \
  73. --disable-shared \
  74. --disable-threads \
  75. --with-newlib \
  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) ${GCC_MAKEOPTS} -C $(GCC_BUILD_DIR_INITIAL) all-gcc all-target-libgcc
  82. touch $@
  83. $(WRKBUILD)/.configured: $(GCC_BUILD_DIR_INITIAL)/.compiled
  84. PATH=$(TARGET_PATH) \
  85. $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install-gcc install-target-libgcc
  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=c,c++ \
  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) ${GCC_MAKEOPTS} -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