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.
10 #VERSION:=2.0 # uncomment for final release
14 SHELL:=/usr/bin/env bash
15 OPENWRTVERSION:=$(RELEASE)
16 include $(TOPDIR)/include/verbose.mk
18 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
20 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
22 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
28 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
32 SCAN_COOKIE?=$(shell echo $$$$)
35 tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo:
37 @+$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=4 SCAN_EXTRA=""
38 @+$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk" SCAN_DEPTH=2 SCAN_EXTRA=""
39 @for type in package target; do \
40 f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
41 [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config < "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
44 .config: ./scripts/config/conf prepare-tmpinfo
45 @+if [ \! -f .config ]; then \
46 [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
47 $(NO_TRACE_MAKE) menuconfig QUIET=0 OPENWRT_BUILD=; \
49 $< -D .config Config.in &> /dev/null
52 @+$(MAKE) -C scripts/config all
55 @+$(MAKE) -C scripts/config conf
57 config: scripts/config/conf prepare-tmpinfo FORCE
61 $(NO_TRACE_MAKE) -C scripts/config clean
63 defconfig: scripts/config/conf prepare-tmpinfo FORCE
65 $< -D .config Config.in
67 oldconfig: scripts/config/conf prepare-tmpinfo FORCE
70 menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
71 if [ \! -f .config -a -e $(HOME)/.openwrt/defconfig ]; then \
72 cp $(HOME)/.openwrt/defconfig .config; \
76 kernel_oldconfig: .config FORCE
77 $(NO_TRACE_MAKE) -C target/linux oldconfig
79 kernel_menuconfig: .config FORCE
80 $(NO_TRACE_MAKE) -C target/linux menuconfig
82 tmp/.prereq-build: include/prereq-build.mk
85 @+$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
86 echo "Prerequisite check failed. Use FORCE=1 to override."; \
91 tmp/.prereq-package: tmp/.packageinfo .config
92 tmp/.prereq-target: tmp/.targetinfo .config
93 tmp/.prereq-package tmp/.prereq-target: include/prereq.mk
96 @+$(NO_TRACE_MAKE) -s -C $(patsubst tmp/.prereq-%,%,$@) prereq 2>/dev/null || { \
97 echo "Prerequisite check failed. Use FORCE=1 to override."; \
102 prereq: tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target .config FORCE
105 download: .config FORCE
106 $(MAKE) -j1 tools/download
107 $(MAKE) -j1 toolchain/download
108 $(MAKE) -j1 package/download
109 $(MAKE) -j1 target/download
111 clean dirclean distclean:
115 @$(SUBMAKE) -s prereq QUIET=0 OPENWRT_BUILD=
121 docs docs/compile: FORCE
122 $(MAKE) -C docs compile
125 $(MAKE) -C docs clean
128 -find package -type l | xargs rm -f
131 .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target