Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Makefile for libreCMC
  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. export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
  18. ifneq ($(LIBRECMC_BUILD),1)
  19. _SINGLE=export MAKEFLAGS=$(space);
  20. override LIBRECMC_BUILD=1
  21. export LIBRECMC_BUILD
  22. GREP_OPTIONS=
  23. export GREP_OPTIONS
  24. CDPATH=
  25. export CDPATH
  26. include $(TOPDIR)/include/debug.mk
  27. include $(TOPDIR)/include/depends.mk
  28. include $(TOPDIR)/include/toplevel.mk
  29. else
  30. include rules.mk
  31. include $(INCLUDE_DIR)/depends.mk
  32. include $(INCLUDE_DIR)/subdir.mk
  33. include target/Makefile
  34. include package/Makefile
  35. include tools/Makefile
  36. include toolchain/Makefile
  37. $(toolchain/stamp-compile): $(tools/stamp-compile)
  38. $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
  39. $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
  40. $(package/stamp-install): $(package/stamp-compile)
  41. $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
  42. check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check)
  43. printdb:
  44. @true
  45. prepare: $(target/stamp-compile)
  46. clean: FORCE
  47. rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
  48. dirclean: clean
  49. rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/host $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
  50. rm -rf $(TMP_DIR)
  51. ifndef DUMP_TARGET_DB
  52. $(BUILD_DIR)/.prepared: Makefile
  53. @mkdir -p $$(dirname $@)
  54. @touch $@
  55. tmp/.prereq_packages: .config
  56. unset ERROR; \
  57. for package in $(sort $(prereq-y) $(prereq-m)); do \
  58. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  59. done; \
  60. if [ -n "$$ERROR" ]; then \
  61. echo "Package prerequisite check failed."; \
  62. false; \
  63. fi
  64. touch $@
  65. endif
  66. # check prerequisites before starting to build
  67. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  68. @if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
  69. echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; \
  70. echo ' The missing file will cause configure scripts to fail during compilation.'; \
  71. echo ' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
  72. exit 1; \
  73. fi
  74. checksum: FORCE
  75. $(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))
  76. ccsdisk: $(target/ccsdisk/install)
  77. diffconfig: FORCE
  78. mkdir -p $(BIN_DIR)
  79. $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed
  80. prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
  81. $(_SINGLE)$(SUBMAKE) -r diffconfig
  82. world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
  83. $(_SINGLE)$(SUBMAKE) -r package/index
  84. $(_SINGLE)$(SUBMAKE) -r checksum
  85. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  86. endif