Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Makefile for OpenWrt
  2. #
  3. # Copyright (C) 2007 OpenWrt.org
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. TOPDIR:=${CURDIR}
  9. LC_ALL:=C
  10. LANG:=C
  11. TZ:=UTC
  12. export TOPDIR LC_ALL LANG TZ
  13. empty:=
  14. space:= $(empty) $(empty)
  15. $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the LEDE directory must not include any spaces))
  16. world:
  17. include $(TOPDIR)/include/host.mk
  18. ifneq ($(OPENWRT_BUILD),1)
  19. _SINGLE=export MAKEFLAGS=$(space);
  20. override OPENWRT_BUILD=1
  21. export OPENWRT_BUILD
  22. GREP_OPTIONS=
  23. export GREP_OPTIONS
  24. include $(TOPDIR)/include/debug.mk
  25. include $(TOPDIR)/include/depends.mk
  26. include $(TOPDIR)/include/toplevel.mk
  27. else
  28. include rules.mk
  29. include $(INCLUDE_DIR)/depends.mk
  30. include $(INCLUDE_DIR)/subdir.mk
  31. include target/Makefile
  32. include package/Makefile
  33. include tools/Makefile
  34. include toolchain/Makefile
  35. $(toolchain/stamp-install): $(tools/stamp-install)
  36. $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
  37. $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
  38. $(package/stamp-install): $(package/stamp-compile)
  39. $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
  40. check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check)
  41. printdb:
  42. @true
  43. prepare: $(target/stamp-compile)
  44. clean: FORCE
  45. rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
  46. dirclean: clean
  47. rm -rf $(STAGING_DIR_HOST) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
  48. rm -rf $(TMP_DIR)
  49. ifndef DUMP_TARGET_DB
  50. $(BUILD_DIR)/.prepared: Makefile
  51. @mkdir -p $$(dirname $@)
  52. @touch $@
  53. tmp/.prereq_packages: .config
  54. unset ERROR; \
  55. for package in $(sort $(prereq-y) $(prereq-m)); do \
  56. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  57. done; \
  58. if [ -n "$$ERROR" ]; then \
  59. echo "Package prerequisite check failed."; \
  60. false; \
  61. fi
  62. touch $@
  63. endif
  64. # check prerequisites before starting to build
  65. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  66. @if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
  67. echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; \
  68. echo ' The missing file will cause configure scripts to fail during compilation.'; \
  69. echo ' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
  70. exit 1; \
  71. fi
  72. checksum: FORCE
  73. $(call sha256sums,$(BIN_DIR))
  74. diffconfig: FORCE
  75. mkdir -p $(BIN_DIR)
  76. $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed
  77. prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
  78. world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
  79. $(_SINGLE)$(SUBMAKE) -r package/index
  80. $(_SINGLE)$(SUBMAKE) -r diffconfig
  81. $(_SINGLE)$(SUBMAKE) -r checksum
  82. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  83. endif