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
48 tmp/info/.stamp-$(1)-$(shell ls $(2)/*/Makefile $(5) | (md5sum || md5) 2>/dev/null | cut -d' ' -f1)
51 STAMP_pkginfo=$(call stamp,pkginfo,package)
52 STAMP_targetinfo=$(call stamp,targetinfo,target/linux)
57 @rm -f tmp/info/.stamp-$(1)*
60 $(foreach FILE,$(shell ls $(2)/*/Makefile $(5)),
66 tmp/.$(1): $(shell ls $(5))
69 tmp/.$(1): $(STAMP_$(1)) $(4)
70 @echo -n Collecting $(3) info...
71 @$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="$(1)" SCAN_DIR="$(2)" SCAN_NAME="$(3)" SCAN_DEPS="$(4)" SCAN_EXTRA="$(5)"
75 $(eval $(call scan_info,pkginfo,package,package,include/package.mk))
76 $(eval $(call scan_info,targetinfo,target/linux,target,include/kernel-build.mk include/kernel-version.mk,target/linux/*/profiles/*.mk))
79 @-rm -rf tmp/.pkginfo tmp/.targetinfo
81 tmp/.config.in: tmp/.pkginfo
82 @./scripts/metadata.pl package_config < $< > $@ || rm -f $@
84 tmp/.config-target.in: tmp/.targetinfo
85 @./scripts/metadata.pl target_config < $< > $@ || rm -f $@
87 .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
88 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
89 @$< -D .config Config.in &> /dev/null
92 @$(MAKE) -C scripts/config all
95 @$(MAKE) -C scripts/config conf
97 config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
101 $(NO_TRACE_MAKE) -C scripts/config clean
103 defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
105 $< -D .config Config.in
107 oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
110 menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
113 kernel_menuconfig: .config FORCE
114 -$(MAKE) target/linux-prepare
115 $(NO_TRACE_MAKE) -C target/linux menuconfig
118 @$(NO_TRACE_MAKE) -s tmp/.pkginfo tmp/.targetinfo
119 $(MAKE) -C package $(patsubst package/%,%,$@)
122 @$(NO_TRACE_MAKE) -s tmp/.pkginfo tmp/.targetinfo
123 $(MAKE) -C target $(patsubst target/%,%,$@)
126 $(MAKE) -C tools $(patsubst tools/%,%,$@)
128 toolchain/%: tmp/.targetinfo FORCE
129 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
131 tmp/.prereq-build: include/prereq-build.mk
134 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
135 echo "Prerequisite check failed. Use FORCE=1 to override."; \
140 tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
143 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
144 echo "Prerequisite check failed. Use FORCE=1 to override."; \
149 tmp/.prereq-target: include/prereq.mk tmp/.targetinfo .config
152 @$(NO_TRACE_MAKE) -s -C target prereq 2>/dev/null || { \
153 echo "Prerequisite check failed. Use FORCE=1 to override."; \
158 prereq: tmp/.prereq-build tmp/.prereq-packages tmp/.prereq-target FORCE
160 download: .config FORCE
161 $(MAKE) tools/download
162 $(MAKE) toolchain/download
163 $(MAKE) package/download
164 $(MAKE) target/download
167 $(MAKE) tools/install
168 $(MAKE) toolchain/install
169 $(MAKE) target/compile
170 $(MAKE) package/compile
171 $(MAKE) package/install
172 $(MAKE) target/install
173 $(MAKE) package/index
176 rm -rf build_* bin tmp
179 rm -rf staging_dir_* toolchain_build_* tool_build
181 distclean: dirclean config-clean
188 $(MAKE) -C docs/ openwrt.pdf
191 $(MAKE) -C docs/ clean
194 find package -type l | xargs rm -f
196 .SILENT: clean dirclean distclean config-clean download world