Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #
  2. # Copyright (C) 2007-2009 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. # Main makefile for the toolchain
  8. #
  9. # Steps:
  10. # 1) toolchain/binutils/install
  11. # build & install binutils
  12. # 2) toolchain/gcc/minimal/install
  13. # build & install a minimal gcc, needed for steps 3 & 4
  14. # 3) toolchain/kernel-headers/install
  15. # install kernel headers, needed for step 4
  16. # 4) toolchain/libc/headers/install
  17. # build & install libc headers & support files, needed for step 5
  18. # 5) toolchain/gcc/initial/install
  19. # build & install an initial gcc, needed for step 6
  20. # 6) toolchain/libc/install
  21. # build & install the final libc
  22. # 7) toolchain/gcc/final/install
  23. # build & install the final gcc
  24. # 8) toolchain/libc/utils/install
  25. # build & install libc utilities
  26. #
  27. curdir:=toolchain
  28. # subdirectories to descend into
  29. $(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal gcc/initial gcc/final $(LIBC)/headers $(LIBC))
  30. ifdef CONFIG_USE_UCLIBC
  31. $(curdir)/builddirs += $(LIBC)/utils
  32. endif
  33. $(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
  34. $(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
  35. # builddir dependencies
  36. ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
  37. $(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install
  38. $(curdir)/kernel-headers/install:=$(curdir)/gcc/minimal/install
  39. $(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare
  40. $(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare
  41. $(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/install
  42. $(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/install
  43. $(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/install
  44. $(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/install
  45. $(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/install
  46. $(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare
  47. $(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare
  48. endif
  49. ifdef CONFIG_GCC_VERSION_LLVM
  50. $(curdir)/builddirs += llvm
  51. $(curdir)/gcc/minimal/compile += $(curdir)/llvm/install
  52. endif
  53. ifndef DUMP_TARGET_DB
  54. ifneq ($(ARCH),)
  55. $(TOOLCHAIN_DIR)/info.mk: .config
  56. @for dir in $(TOOLCHAIN_DIR); do ( \
  57. $(if $(QUIET),,set -x;) \
  58. mkdir -p "$$dir"; \
  59. cd "$$dir"; \
  60. ln -nsf lib lib64; \
  61. ln -nsf lib lib32; \
  62. mkdir -p stamp lib usr/include usr/lib ; \
  63. ); done
  64. @grep GCC_VERSION $@ >/dev/null 2>&1 || $(INSTALL_DATA) $(TOPDIR)/toolchain/info.mk $@
  65. @touch $@
  66. endif
  67. endif
  68. # prerequisites for the individual targets
  69. $(curdir)/ := .config prereq
  70. $(curdir)//prepare = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk
  71. $(curdir)//compile = $(1)/prepare
  72. $(curdir)//install = $(1)/compile
  73. ifndef DUMP_TARGET_DB
  74. $(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed:
  75. endif
  76. $(eval $(call stampfile,$(curdir),toolchain,install,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR)))
  77. $(eval $(call subdir,$(curdir)))