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 ifneq ($(shell tty -s <&3 || echo x),x)
32 include $(TOPDIR)/include/verbose.mk
34 OPENWRTVERSION:=$(RELEASE)
36 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
38 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
40 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
45 ifneq ($(shell ./scripts/timestamp.pl -p tmp/.pkginfo package scripts Makefile),tmp/.pkginfo)
49 ifneq ($(shell ./scripts/timestamp.pl -p tmp/.targetinfo target/linux scripts Makefile),tmp/.targetinfo)
50 tmp/.targetinfo: FORCE
54 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
55 world: tmp/.prereq-packages
60 @echo Collecting package info...
61 @-for dir in package/*/; do \
62 [ -f "$${dir}/Makefile" ] || continue; \
63 echo Source-Makefile: $${dir}Makefile; \
64 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
70 @echo Collecting target info...
71 @-for dir in target/linux/*/; do \
72 [ -f "$${dir}/Makefile" ] || continue; \
73 ( cd "$$dir"; $(NO_TRACE_MAKE) --no-print-dir DUMP=1 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2 ); \
78 @-rm -rf tmp/.pkginfo tmp/.targetinfo
80 tmp/.config.in: tmp/.pkginfo
81 @./scripts/gen_package_config.pl < $< > $@ || rm -f $@
83 tmp/.config-target.in: tmp/.targetinfo
84 @./scripts/gen_target_config.pl < $< > $@ || rm -f $@
86 .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
87 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
88 @$< -D .config Config.in &> /dev/null
91 @$(MAKE) -C scripts/config all
94 @$(MAKE) -C scripts/config conf
96 config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
100 $(NO_TRACE_MAKE) -C scripts/config clean
102 defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
104 $< -D .config Config.in
106 oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
109 menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
112 package/%: tmp/.pkginfo tmp/.targetinfo FORCE
113 $(MAKE) -C package $(patsubst package/%,%,$@)
115 target/%: tmp/.pkginfo tmp/.targetinfo FORCE
116 $(MAKE) -C target $(patsubst target/%,%,$@)
119 $(MAKE) -C tools $(patsubst tools/%,%,$@)
121 toolchain/%: tmp/.targetinfo FORCE
122 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
124 tmp/.prereq-build: include/prereq-build.mk
126 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
127 echo "Prerequisite check failed. Use FORCE=1 to override."; \
132 tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
134 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
135 echo "Prerequisite check failed. Use FORCE=1 to override."; \
140 prereq: tmp/.prereq-build tmp/.prereq-packages FORCE
142 download: .config FORCE
143 $(MAKE) tools/download
144 $(MAKE) toolchain/download
145 $(MAKE) package/download
146 $(MAKE) target/download
149 $(MAKE) tools/install
150 $(MAKE) toolchain/install
151 $(MAKE) target/compile
152 $(MAKE) package/compile
153 $(MAKE) package/install
154 $(MAKE) target/install
155 $(MAKE) package/index
158 rm -rf build_* bin tmp
161 rm -rf staging_dir_* toolchain_build_* tool_build
163 distclean: dirclean config-clean
166 .SILENT: clean dirclean distclean config-clean download world