3 # Copyright (C) 2007 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
13 export TOPDIR LC_ALL LANG TZ
16 space:= $(empty) $(empty)
17 $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the LEDE directory must not include any spaces))
21 export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
23 ifneq ($(OPENWRT_BUILD),1)
24 _SINGLE=export MAKEFLAGS=$(space);
26 override OPENWRT_BUILD=1
30 include $(TOPDIR)/include/debug.mk
31 include $(TOPDIR)/include/depends.mk
32 include $(TOPDIR)/include/toplevel.mk
35 include $(INCLUDE_DIR)/depends.mk
36 include $(INCLUDE_DIR)/subdir.mk
37 include target/Makefile
38 include package/Makefile
39 include tools/Makefile
40 include toolchain/Makefile
42 $(toolchain/stamp-compile): $(tools/stamp-compile)
43 $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
44 $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
45 $(package/stamp-install): $(package/stamp-compile)
46 $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
47 check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check)
52 prepare: $(target/stamp-compile)
55 rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages
58 rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/host $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
62 $(BUILD_DIR)/.prepared: Makefile
63 @mkdir -p $$(dirname $@)
66 tmp/.prereq_packages: .config
68 for package in $(sort $(prereq-y) $(prereq-m)); do \
69 $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
71 if [ -n "$$ERROR" ]; then \
72 echo "Package prerequisite check failed."; \
78 # check prerequisites before starting to build
79 prereq: $(target/stamp-prereq) tmp/.prereq_packages
80 @if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
81 echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; \
82 echo ' The missing file will cause configure scripts to fail during compilation.'; \
83 echo ' Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" file and restart the build.'; \
88 $(call sha256sums,$(BIN_DIR))
92 $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed
94 prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
95 world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
96 $(_SINGLE)$(SUBMAKE) -r package/index
97 $(_SINGLE)$(SUBMAKE) -r diffconfig
98 $(_SINGLE)$(SUBMAKE) -r checksum
100 .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean