Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 libreCMC 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. printdb:
  41. @true
  42. prepare: $(target/stamp-compile)
  43. clean: FORCE
  44. rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
  45. dirclean: clean
  46. rm -rf $(STAGING_DIR_HOST) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
  47. rm -rf $(TMP_DIR)
  48. ifndef DUMP_TARGET_DB
  49. $(BUILD_DIR)/.prepared: Makefile
  50. @mkdir -p $$(dirname $@)
  51. @touch $@
  52. tmp/.prereq_packages: .config
  53. unset ERROR; \
  54. for package in $(sort $(prereq-y) $(prereq-m)); do \
  55. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  56. done; \
  57. if [ -n "$$ERROR" ]; then \
  58. echo "Package prerequisite check failed."; \
  59. false; \
  60. fi
  61. touch $@
  62. endif
  63. # check prerequisites before starting to build
  64. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  65. @if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
  66. echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; \
  67. echo ' The missing file will cause configure scripts to fail during compilation.'; \
  68. echo ' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
  69. exit 1; \
  70. fi
  71. checksum: FORCE
  72. $(call sha256sums,$(BIN_DIR))
  73. prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
  74. world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
  75. $(_SINGLE)$(SUBMAKE) -r package/index
  76. $(_SINGLE)$(SUBMAKE) -r checksum
  77. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  78. endif