Makefile 4.1 KB

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