Makefile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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/prepare
  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/prepare
  17. # build & install libc headers & support files, needed for step 5
  18. # 5) toolchain/gcc/compile
  19. # build & install an initial gcc, needed for step 6
  20. # 6) toolchain/libc/compile
  21. # build & install the final libc
  22. # 7) toolchain/gcc/install
  23. # build & install the final gcc
  24. # 8) toolchain/libc/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) $(if $(CONFIG_GLIBC_PORTS),glibc-ports))
  30. $(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
  31. $(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
  32. # builddir dependencies
  33. ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
  34. $(curdir)/$(LIBC)/prepare:=$(curdir)/kernel-headers/install
  35. $(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install
  36. $(curdir)/kernel-headers/install:=$(curdir)/gcc/minimal/install
  37. $(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/prepare
  38. $(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare
  39. $(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare
  40. $(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/install
  41. $(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/compile
  42. $(curdir)/$(LIBC)/install:=$(curdir)/gcc/final/install
  43. ifneq ($(CONFIG_GLIBC_PORTS),)
  44. $(curdir)/glibc/prepare:=$(curdir)/glibc-ports/prepare
  45. endif
  46. endif
  47. ifdef CONFIG_GCC_VERSION_LLVM
  48. $(curdir)/builddirs += llvm
  49. $(curdir)/gcc/minimal/compile += $(curdir)/llvm/install
  50. endif
  51. ifndef DUMP_TARGET_DB
  52. ifneq ($(ARCH),)
  53. $(TOOLCHAIN_DIR)/info.mk: .config
  54. @for dir in $(TOOLCHAIN_DIR); do ( \
  55. $(if $(QUIET),,set -x;) \
  56. mkdir -p "$$dir"; \
  57. cd "$$dir"; \
  58. ln -sf lib lib64; \
  59. mkdir -p stamp lib usr/include usr/lib ; \
  60. ); done
  61. @grep GCC_VERSION $@ >/dev/null 2>&1 || $(INSTALL_DATA) $(TOPDIR)/toolchain/info.mk $@
  62. @touch $@
  63. endif
  64. endif
  65. # prerequisites for the individual targets
  66. $(curdir)/ := .config prereq
  67. $(curdir)//prepare = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk
  68. $(curdir)//compile = $(1)/prepare
  69. $(curdir)//install = $(1)/compile
  70. ifndef DUMP_TARGET_DB
  71. $(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed:
  72. endif
  73. $(eval $(call stampfile,$(curdir),toolchain,install,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR)))
  74. $(eval $(call subdir,$(curdir)))