Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. # XXX: these three lines are normally defined by rules.mk
  19. # but we can't include that file in this context
  20. empty:=
  21. space:= $(empty) $(empty)
  22. _SINGLE=export MAKEFLAGS=$(space);
  23. override LIBRECMC_BUILD=1
  24. export LIBRECMC_BUILD
  25. GREP_OPTIONS=
  26. export GREP_OPTIONS
  27. include $(TOPDIR)/include/debug.mk
  28. include $(TOPDIR)/include/depends.mk
  29. include $(TOPDIR)/include/toplevel.mk
  30. else
  31. include rules.mk
  32. include $(INCLUDE_DIR)/depends.mk
  33. include $(INCLUDE_DIR)/subdir.mk
  34. include target/Makefile
  35. include package/Makefile
  36. include tools/Makefile
  37. include toolchain/Makefile
  38. $(toolchain/stamp-install): $(tools/stamp-install)
  39. $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
  40. $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
  41. $(package/stamp-install): $(package/stamp-compile)
  42. $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
  43. printdb:
  44. @true
  45. prepare: $(target/stamp-compile)
  46. clean: FORCE
  47. rm -rf $(BUILD_DIR) $(BIN_DIR) $(BUILD_LOG_DIR)
  48. dirclean: clean
  49. rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(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/$(REAL_GNU_TARGET_NAME)" ]; then \
  69. echo 'ERROR: Missing site config for target "$(REAL_GNU_TARGET_NAME)" !'; \
  70. echo ' The missing file will cause configure scripts to fail during compilation.'; \
  71. echo ' Please provide a "$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" file and restart the build.'; \
  72. exit 1; \
  73. fi
  74. prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
  75. world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
  76. $(_SINGLE)$(SUBMAKE) -r package/index
  77. # update all feeds, re-create index files, install symlinks
  78. package/symlinks:
  79. $(SCRIPT_DIR)/feeds update -a
  80. $(SCRIPT_DIR)/feeds install -a
  81. # re-create index files, install symlinks
  82. package/symlinks-install:
  83. $(SCRIPT_DIR)/feeds update -i
  84. $(SCRIPT_DIR)/feeds install -a
  85. # remove all symlinks, don't touch ./feeds
  86. package/symlinks-clean:
  87. $(SCRIPT_DIR)/feeds uninstall -a
  88. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  89. endif