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=${shell pwd}
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 @echo Collecting package info...
58 @-for dir in package/*/; do \
59 [ -f "$${dir}/Makefile" ] || continue; \
60 echo Source-Makefile: $${dir}Makefile; \
61 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
67 @echo Collecting target info...
68 @-for dir in target/linux/*/; do \
69 [ -f "$${dir}/Makefile" ] || continue; \
70 ( cd "$$dir"; $(NO_TRACE_MAKE) --no-print-dir DUMP=1 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2 ); \
75 @-rm -rf tmp/.pkginfo tmp/.targetinfo
77 tmp/.config.in: tmp/.pkginfo
78 @./scripts/gen_package_config.pl < $< > $@ || rm -f $@
80 tmp/.config-target.in: tmp/.targetinfo
81 @./scripts/gen_target_config.pl < $< > $@ || rm -f $@
83 .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
84 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
85 @$< -D .config Config.in &> /dev/null
88 @$(MAKE) -C scripts/config all
91 @$(MAKE) -C scripts/config conf
93 config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
97 $(NO_TRACE_MAKE) -C scripts/config clean
99 defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
101 $< -D .config Config.in
103 oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
106 menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
109 package/%: tmp/.pkginfo tmp/.targetinfo FORCE
110 $(MAKE) -C package $(patsubst package/%,%,$@)
112 target/%: tmp/.pkginfo tmp/.targetinfo FORCE
113 $(MAKE) -C target $(patsubst target/%,%,$@)
116 $(MAKE) -C tools $(patsubst tools/%,%,$@)
118 toolchain/%: tmp/.targetinfo FORCE
119 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
121 tmp/.prereq-build: include/prereq-build.mk
124 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
125 echo "Prerequisite check failed. Use FORCE=1 to override."; \
130 tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
133 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
134 echo "Prerequisite check failed. Use FORCE=1 to override."; \
139 tmp/.prereq-target: include/prereq.mk tmp/.targetinfo .config
142 @$(NO_TRACE_MAKE) -s -C target prereq 2>/dev/null || { \
143 echo "Prerequisite check failed. Use FORCE=1 to override."; \
148 prereq: tmp/.prereq-build tmp/.prereq-packages tmp/.prereq-target FORCE
150 download: .config FORCE
151 $(MAKE) tools/download
152 $(MAKE) toolchain/download
153 $(MAKE) package/download
154 $(MAKE) target/download
157 $(MAKE) tools/install
158 $(MAKE) toolchain/install
159 $(MAKE) target/compile
160 $(MAKE) package/compile
161 $(MAKE) package/install
162 $(MAKE) target/install
163 $(MAKE) package/index
166 rm -rf build_* bin tmp
169 rm -rf staging_dir_* toolchain_build_* tool_build
171 distclean: dirclean config-clean
174 .SILENT: clean dirclean distclean config-clean download world