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 include $(TOPDIR)/include/verbose.mk
25 ifeq ($(KBUILD_VERBOSE),99)
26 MAKE:=3>/dev/null $(MAKE)
29 OPENWRTVERSION:=$(RELEASE)
31 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
33 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
35 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
40 ifneq ($(shell ./scripts/timestamp.pl -p tmp/.pkginfo package scripts Makefile),tmp/.pkginfo)
41 tmp/.pkginfo: tmpinfo-clean
44 ifneq ($(shell ./scripts/timestamp.pl -p tmp/.targetinfo target/linux scripts Makefile),tmp/.targetinfo)
45 tmp/.targetinfo: tmpinfo-clean
49 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
50 world: tmp/.prereq-packages
55 @echo Collecting package info...
56 @-for dir in package/*/; do \
57 [ -f "$${dir}/Makefile" ] || continue; \
58 echo Source-Makefile: $${dir}Makefile; \
59 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
65 @echo Collecting target info...
66 @-for dir in target/linux/*/; do \
67 [ -f "$${dir}/Makefile" ] || continue; \
68 ( cd "$$dir"; $(NO_TRACE_MAKE) --no-print-dir DUMP=1 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2 ); \
73 @-rm -rf tmp/.pkginfo tmp/.targetinfo
75 tmp/.config.in: tmp/.pkginfo
76 @./scripts/gen_package_config.pl < $< > $@ || rm -f $@
78 tmp/.config-target.in: tmp/.targetinfo
79 @./scripts/gen_target_config.pl < $< > $@ || rm -f $@
81 .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
82 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
83 @$< -D .config Config.in &> /dev/null
86 @$(MAKE) -C scripts/config all
89 @$(MAKE) -C scripts/config conf
91 config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
95 $(NO_TRACE_MAKE) -C scripts/config clean
97 defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
99 $< -D .config Config.in
101 oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
104 menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
107 package/%: tmp/.pkginfo tmp/.targetinfo FORCE
108 $(MAKE) -C package $(patsubst package/%,%,$@)
110 target/%: tmp/.pkginfo tmp/.targetinfo FORCE
111 $(MAKE) -C target $(patsubst target/%,%,$@)
114 $(MAKE) -C tools $(patsubst tools/%,%,$@)
116 toolchain/%: tmp/.targetinfo FORCE
117 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
119 tmp/.prereq-build: include/prereq-build.mk
121 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
122 echo "Prerequisite check failed. Use FORCE=1 to override."; \
127 tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
129 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
130 echo "Prerequisite check failed. Use FORCE=1 to override."; \
135 prereq: tmp/.prereq-build tmp/.prereq-packages 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
161 .SILENT: clean dirclean distclean config-clean download world