Mirror of the official OpenWrt repository https://openwrt.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

134 lines
3.9 KiB

  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 OpenWrt 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 ($(OPENWRT_BUILD),1)
  20. _SINGLE=export MAKEFLAGS=$(space);
  21. override OPENWRT_BUILD=1
  22. export OPENWRT_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. $(MAKE) -C $(TOPDIR)/scripts/config clean
  53. cacheclean:
  54. ifneq ($(CONFIG_CCACHE),)
  55. rm -rf $(if $(call qstrip,$(CONFIG_CCACHE_DIR)),$(call qstrip,$(CONFIG_CCACHE_DIR)),$(TOPDIR)/.ccache)
  56. endif
  57. ifndef DUMP_TARGET_DB
  58. $(BUILD_DIR)/.prepared: Makefile
  59. @mkdir -p $$(dirname $@)
  60. @touch $@
  61. tmp/.prereq_packages: .config
  62. unset ERROR; \
  63. for package in $(sort $(prereq-y) $(prereq-m)); do \
  64. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  65. done; \
  66. if [ -n "$$ERROR" ]; then \
  67. echo "Package prerequisite check failed."; \
  68. false; \
  69. fi
  70. touch $@
  71. endif
  72. # check prerequisites before starting to build
  73. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  74. @if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
  75. echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; \
  76. echo ' The missing file will cause configure scripts to fail during compilation.'; \
  77. echo ' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
  78. exit 1; \
  79. fi
  80. $(BIN_DIR)/profiles.json: FORCE
  81. $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
  82. WORK_DIR=$(BUILD_DIR)/json_info_files \
  83. $(SCRIPT_DIR)/json_overview_image_info.py $@ \
  84. )
  85. json_overview_image_info: $(BIN_DIR)/profiles.json
  86. checksum: FORCE
  87. $(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))
  88. buildversion: FORCE
  89. $(SCRIPT_DIR)/getver.sh > $(BIN_DIR)/version.buildinfo
  90. feedsversion: FORCE
  91. $(SCRIPT_DIR)/feeds list -fs > $(BIN_DIR)/feeds.buildinfo
  92. diffconfig: FORCE
  93. mkdir -p $(BIN_DIR)
  94. $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.buildinfo
  95. buildinfo: FORCE
  96. $(_SINGLE)$(SUBMAKE) -r diffconfig buildversion feedsversion
  97. prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
  98. $(_SINGLE)$(SUBMAKE) -r buildinfo
  99. world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
  100. $(_SINGLE)$(SUBMAKE) -r package/index
  101. $(_SINGLE)$(SUBMAKE) -r json_overview_image_info
  102. $(_SINGLE)$(SUBMAKE) -r checksum
  103. ifneq ($(CONFIG_CCACHE),)
  104. $(STAGING_DIR_HOST)/bin/ccache -s
  105. endif
  106. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  107. endif