2
0

Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1)
  18. export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
  19. ifneq ($(LIBRECMC_BUILD),1)
  20. _SINGLE=export MAKEFLAGS=$(space);
  21. override LIBRECMC_BUILD=1
  22. export LIBRECMC_BUILD
  23. GREP_OPTIONS=
  24. export GREP_OPTIONS
  25. CDPATH=
  26. export CDPATH
  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-compile): $(tools/stamp-compile)
  39. $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(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. check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check)
  44. printdb:
  45. @true
  46. prepare: $(target/stamp-compile)
  47. clean: FORCE
  48. rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
  49. dirclean: clean
  50. rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/host $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
  51. rm -rf $(TMP_DIR)
  52. ifndef DUMP_TARGET_DB
  53. $(BUILD_DIR)/.prepared: Makefile
  54. @mkdir -p $$(dirname $@)
  55. @touch $@
  56. tmp/.prereq_packages: .config
  57. unset ERROR; \
  58. for package in $(sort $(prereq-y) $(prereq-m)); do \
  59. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  60. done; \
  61. if [ -n "$$ERROR" ]; then \
  62. echo "Package prerequisite check failed."; \
  63. false; \
  64. fi
  65. touch $@
  66. endif
  67. # check prerequisites before starting to build
  68. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  69. @if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
  70. echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; \
  71. echo ' The missing file will cause configure scripts to fail during compilation.'; \
  72. echo ' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
  73. exit 1; \
  74. fi
  75. checksum: FORCE
  76. $(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))
  77. buildversion: FORCE
  78. $(SCRIPT_DIR)/getver.sh > $(BIN_DIR)/version.buildinfo
  79. feedsversion: FORCE
  80. $(SCRIPT_DIR)/feeds list -fs > $(BIN_DIR)/feeds.buildinfo
  81. diffconfig: FORCE
  82. mkdir -p $(BIN_DIR)
  83. $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.buildinfo
  84. buildinfo: FORCE
  85. $(_SINGLE)$(SUBMAKE) -r diffconfig buildversion feedsversion
  86. prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
  87. $(_SINGLE)$(SUBMAKE) -r buildinfo
  88. world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
  89. $(_SINGLE)$(SUBMAKE) -r package/index
  90. $(_SINGLE)$(SUBMAKE) -r checksum
  91. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  92. endif