3 # Copyright (C) 2006 OpenWrt.org
4 # Copyright (C) 2006 by Felix Fietkau <openwrt@nbd.name>
6 # This is free software, licensed under the GNU General Public License v2.
7 # See /LICENSE for more information.
11 #VERSION:=2.0 # uncomment for final release
13 #--------------------------------------------------------------
14 # Just run 'make menuconfig', configure stuff, then run 'make'.
15 # You shouldn't need to mess with anything beyond this point...
16 #--------------------------------------------------------------
20 SHELL:=/usr/bin/env bash
23 export TOPDIR=${CURDIR}
24 ifeq ($(KBUILD_VERBOSE),99)
25 MAKE:=3>/dev/null $(MAKE)
27 export IS_TTY=$(shell tty -s && echo 1 || echo 0)
29 include $(TOPDIR)/include/verbose.mk
31 OPENWRTVERSION:=$(RELEASE)
33 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
35 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
37 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
43 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
44 world: tmp/.prereq-packages tmp/.prereq-target
49 @$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="pkginfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(shell ls include/package*.mk) include/kernel.mk" SCAN_EXTRA=""
51 tmp/.targetinfo: FORCE
53 @$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="$(shell ls include/kernel*.mk)" SCAN_EXTRA=""
56 @-rm -rf tmp/.pkginfo tmp/.targetinfo
58 tmp/.config.in: tmp/.pkginfo
59 @./scripts/metadata.pl package_config < $< > $@ || rm -f $@
61 tmp/.config-target.in: tmp/.targetinfo
62 @./scripts/metadata.pl target_config < $< > $@ || rm -f $@
64 .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
65 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
66 @$< -D .config Config.in &> /dev/null
69 @$(MAKE) -C scripts/config all
72 @$(MAKE) -C scripts/config conf
74 config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
78 $(NO_TRACE_MAKE) -C scripts/config clean
80 defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
82 $< -D .config Config.in
84 oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
87 menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
90 kernel_menuconfig: .config FORCE
91 -$(MAKE) target/linux-prepare
92 $(NO_TRACE_MAKE) -C target/linux menuconfig
95 @$(NO_TRACE_MAKE) -s tmp/.pkginfo tmp/.targetinfo
96 $(MAKE) -C package $(patsubst package/%,%,$@)
99 @$(NO_TRACE_MAKE) -s tmp/.pkginfo tmp/.targetinfo
100 $(MAKE) -C target $(patsubst target/%,%,$@)
103 $(MAKE) -C tools $(patsubst tools/%,%,$@)
105 toolchain/%: tmp/.targetinfo FORCE
106 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
108 tmp/.prereq-build: include/prereq-build.mk
111 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
112 echo "Prerequisite check failed. Use FORCE=1 to override."; \
117 tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
120 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
121 echo "Prerequisite check failed. Use FORCE=1 to override."; \
126 tmp/.prereq-target: include/prereq.mk tmp/.targetinfo .config
129 @$(NO_TRACE_MAKE) -s -C target prereq 2>/dev/null || { \
130 echo "Prerequisite check failed. Use FORCE=1 to override."; \
135 prereq: tmp/.prereq-build tmp/.prereq-packages tmp/.prereq-target FORCE
137 download: .config FORCE
138 $(MAKE) tools/download
139 $(MAKE) toolchain/download
140 $(MAKE) package/download
141 $(MAKE) target/download
144 $(MAKE) tools/install
145 $(MAKE) toolchain/install
146 $(MAKE) target/compile
147 $(MAKE) package/compile
148 $(MAKE) package/install
149 $(MAKE) target/install
150 $(MAKE) package/index
153 rm -rf build_* bin tmp
156 rm -rf staging_dir_* toolchain_build_* tool_build
158 distclean: dirclean config-clean symlinkclean docclean
165 $(MAKE) -C docs/ openwrt.pdf
168 $(MAKE) -C docs/ clean
171 find package -type l | xargs rm -f
173 .SILENT: clean dirclean distclean symlinkclean config-clean download world