Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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_LINUX_ARM_TOMTOM),y)
  27. #GCC_CONFOPTS+= --enable-sjlj-exceptions
  28. #else
  29. #GCC_CONFOPTS+= --disable-sjlj-exceptions
  30. #endif
  31. ifeq ($(ADK_SSP),y)
  32. GCC_CONFOPTS+= --enable-libssp
  33. else
  34. GCC_CONFOPTS+= --disable-libssp
  35. endif
  36. ifeq ($(ADK_DEVICE_NO_FPU),y)
  37. GCC_CONFOPTS+= --with-float=soft
  38. endif
  39. ifeq ($(ADK_LINUX_64),y)
  40. GCC_CONFOPTS+= --with-abi=64
  41. endif
  42. ifeq ($(ADK_TARGET_LIB_UCLIBC),y)
  43. GCC_CONFOPTS+= --disable-tls
  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) -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. --with-sysroot=$(TOOLCHAIN_SYSROOT) \
  82. );
  83. touch $@
  84. $(GCC_BUILD_DIR_INITIAL)/.compiled: $(GCC_BUILD_DIR_INITIAL)/.configured
  85. PATH=$(TARGET_PATH) \
  86. $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) all
  87. touch $@
  88. $(WRKBUILD)/.configured: $(GCC_BUILD_DIR_INITIAL)/.compiled
  89. PATH=$(TARGET_PATH) \
  90. $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install
  91. touch $@
  92. $(GCC_BUILD_DIR_FINAL)/.configured:
  93. mkdir -p $(GCC_BUILD_DIR_FINAL)
  94. (cd $(GCC_BUILD_DIR_FINAL); rm -f config.cache; \
  95. PATH=$(TARGET_PATH) \
  96. $(WRKBUILD)/configure \
  97. ${GCC_CONFOPTS} \
  98. --enable-languages=$(TARGET_LANGUAGES) \
  99. --with-sysroot=$(STAGING_DIR) \
  100. --with-slibdir=$(STAGING_DIR)/lib \
  101. --enable-shared \
  102. );
  103. touch $@
  104. $(WRKBUILD)/.compiled: $(GCC_BUILD_DIR_FINAL)/.configured
  105. PATH=$(TARGET_PATH) \
  106. $(MAKE) -C $(GCC_BUILD_DIR_FINAL) all
  107. touch $@
  108. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  109. PATH=$(TARGET_PATH) \
  110. $(MAKE) -C $(GCC_BUILD_DIR_FINAL) install
  111. # workaround if you cross-compile binutils
  112. @-rm $(STAGING_DIR)/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