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)
42 ifneq ($(shell ./scripts/timestamp.pl -p tmp/.pkginfo package scripts include),tmp/.pkginfo)
46 ifneq ($(shell ./scripts/timestamp.pl -p tmp/.targetinfo target/linux scripts include),tmp/.targetinfo)
47 tmp/.targetinfo: FORCE
51 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
52 world: tmp/.prereq-packages tmp/.prereq-target
57 printf "\033[M\r$(1)" >&2;
63 @echo -n Collecting $(2) info...
64 @-for dir in $(1)/*/; do \
65 [ -f "$${dir}/Makefile" ] || continue; \
66 $(call progress,Collecting $(2) info: $${dir%%/}) \
67 echo Source-Makefile: $${dir}Makefile; \
68 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
71 @($(call progress,Collecting $(2) info: done))
76 $(call dumpinfo,package,package)
79 $(call dumpinfo,target/linux,target)
82 @-rm -rf tmp/.pkginfo tmp/.targetinfo
84 tmp/.config.in: tmp/.pkginfo
85 @./scripts/gen_package_config.pl < $< > $@ || rm -f $@
87 tmp/.config-target.in: tmp/.targetinfo
88 @./scripts/gen_target_config.pl < $< > $@ || rm -f $@
90 .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
91 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
92 @$< -D .config Config.in &> /dev/null
95 @$(MAKE) -C scripts/config all
98 @$(MAKE) -C scripts/config conf
100 config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
104 $(NO_TRACE_MAKE) -C scripts/config clean
106 defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
108 $< -D .config Config.in
110 oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
113 menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
116 package/%: tmp/.pkginfo tmp/.targetinfo FORCE
117 $(MAKE) -C package $(patsubst package/%,%,$@)
119 target/%: tmp/.pkginfo tmp/.targetinfo FORCE
120 $(MAKE) -C target $(patsubst target/%,%,$@)
123 $(MAKE) -C tools $(patsubst tools/%,%,$@)
125 toolchain/%: tmp/.targetinfo FORCE
126 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
128 tmp/.prereq-build: include/prereq-build.mk
131 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
132 echo "Prerequisite check failed. Use FORCE=1 to override."; \
137 tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
140 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
141 echo "Prerequisite check failed. Use FORCE=1 to override."; \
146 tmp/.prereq-target: include/prereq.mk tmp/.targetinfo .config
149 @$(NO_TRACE_MAKE) -s -C target prereq 2>/dev/null || { \
150 echo "Prerequisite check failed. Use FORCE=1 to override."; \
155 prereq: tmp/.prereq-build tmp/.prereq-packages tmp/.prereq-target FORCE
157 download: .config FORCE
158 $(MAKE) tools/download
159 $(MAKE) toolchain/download
160 $(MAKE) package/download
161 $(MAKE) target/download
164 $(MAKE) tools/install
165 $(MAKE) toolchain/install
166 $(MAKE) target/compile
167 $(MAKE) package/compile
168 $(MAKE) package/install
169 $(MAKE) target/install
170 $(MAKE) package/index
173 rm -rf build_* bin tmp
176 rm -rf staging_dir_* toolchain_build_* tool_build
178 distclean: dirclean config-clean
184 .SILENT: clean dirclean distclean config-clean download world