Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. export TOPDIR LC_ALL LANG
  12. empty:=
  13. space:= $(empty) $(empty)
  14. $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the libreCMC directory must not include any spaces))
  15. world:
  16. include $(TOPDIR)/include/host.mk
  17. ifneq ($(LIBRECMC_BUILD),1)
  18. _SINGLE=export MAKEFLAGS=$(space);
  19. override LIBRECMC_BUILD=1
  20. export LIBRECMC_BUILD
  21. GREP_OPTIONS=
  22. export GREP_OPTIONS
  23. include $(TOPDIR)/include/debug.mk
  24. include $(TOPDIR)/include/depends.mk
  25. include $(TOPDIR)/include/toplevel.mk
  26. else
  27. include rules.mk
  28. include $(INCLUDE_DIR)/depends.mk
  29. include $(INCLUDE_DIR)/subdir.mk
  30. include target/Makefile
  31. include package/Makefile
  32. include tools/Makefile
  33. include toolchain/Makefile
  34. $(toolchain/stamp-install): $(tools/stamp-install)
  35. $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
  36. $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
  37. $(package/stamp-install): $(package/stamp-compile)
  38. $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
  39. printdb:
  40. @true
  41. prepare: $(target/stamp-compile)
  42. clean: FORCE
  43. rm -rf $(BUILD_DIR) $(BIN_DIR) $(BUILD_LOG_DIR)
  44. dirclean: clean
  45. rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
  46. rm -rf $(TMP_DIR)
  47. ifndef DUMP_TARGET_DB
  48. $(BUILD_DIR)/.prepared: Makefile
  49. @mkdir -p $$(dirname $@)
  50. @touch $@
  51. tmp/.prereq_packages: .config
  52. unset ERROR; \
  53. for package in $(sort $(prereq-y) $(prereq-m)); do \
  54. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  55. done; \
  56. if [ -n "$$ERROR" ]; then \
  57. echo "Package prerequisite check failed."; \
  58. false; \
  59. fi
  60. touch $@
  61. endif
  62. # check prerequisites before starting to build
  63. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  64. @if [ ! -f "$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" ]; then \
  65. echo 'ERROR: Missing site config for target "$(REAL_GNU_TARGET_NAME)" !'; \
  66. echo ' The missing file will cause configure scripts to fail during compilation.'; \
  67. echo ' Please provide a "$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" file and restart the build.'; \
  68. exit 1; \
  69. fi
  70. prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
  71. world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
  72. $(_SINGLE)$(SUBMAKE) -r package/index
  73. # update all feeds, re-create index files, install symlinks
  74. package/symlinks:
  75. $(SCRIPT_DIR)/feeds update -a
  76. $(SCRIPT_DIR)/feeds install -a
  77. # re-create index files, install symlinks
  78. package/symlinks-install:
  79. $(SCRIPT_DIR)/feeds update -i
  80. $(SCRIPT_DIR)/feeds install -a
  81. # remove all symlinks, don't touch ./feeds
  82. package/symlinks-clean:
  83. $(SCRIPT_DIR)/feeds uninstall -a
  84. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  85. endif