upgrade bridge-utils to v1.4
[openwrt.git] / include / toplevel.mk
1 # Makefile for OpenWrt
2 #
3 # Copyright (C) 2007 OpenWrt.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 RELEASE:=Kamikaze
10 SHELL:=/usr/bin/env bash
11 PREP_MK= OPENWRT_BUILD= QUIET=0
12
13 include $(TOPDIR)/include/verbose.mk
14
15 ifeq ($(SDK),1)
16 include $(TOPDIR)/include/version.mk
17 else
18 REVISION:=$(shell $(TOPDIR)/scripts/getver.sh)
19 endif
20
21 OPENWRTVERSION:=$(RELEASE)$(if $(REVISION), ($(REVISION)))
22 export RELEASE
23 export REVISION
24 export OPENWRTVERSION
25 export IS_TTY=$(shell tty -s && echo 1 || echo 0)
26
27 ifeq ($(FORCE),)
28 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
29 endif
30
31 SCAN_COOKIE?=$(shell echo $$$$)
32 export SCAN_COOKIE
33
34 prepare-mk: FORCE ;
35
36 prepare-tmpinfo: FORCE
37 mkdir -p tmp/info
38 $(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=5 SCAN_EXTRA=""
39 $(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
40 for type in package target; do \
41 f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
42 [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
43 done
44 ./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
45 touch $(TOPDIR)/tmp/.build
46
47 .config: ./scripts/config/conf prepare-tmpinfo $(if $(CONFIG_HAVE_DOT_CONFIG),,FORCE)
48 @+if [ \! -f .config ] || ! grep CONFIG_HAVE_DOT_CONFIG .config >/dev/null; then \
49 [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
50 $(_SINGLE)$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
51 fi
52
53 scripts/config/mconf:
54 @$(_SINGLE)$(SUBMAKE) -s -C scripts/config all
55
56 $(eval $(call rdep,scripts/config,scripts/config/mconf))
57
58 scripts/config/conf:
59 @$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf
60
61 config: scripts/config/conf prepare-tmpinfo FORCE
62 $< Config.in
63
64 config-clean: FORCE
65 $(_SINGLE)$(NO_TRACE_MAKE) -C scripts/config clean
66
67 defconfig: scripts/config/conf prepare-tmpinfo FORCE
68 touch .config
69 $< -D .config Config.in
70
71 oldconfig: scripts/config/conf prepare-tmpinfo FORCE
72 $< -$(if $(CONFDEFAULT),$(CONFDEFAULT),o) Config.in
73
74 menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
75 if [ \! -f .config -a -e $(HOME)/.openwrt/defconfig ]; then \
76 cp $(HOME)/.openwrt/defconfig .config; \
77 fi
78 $< Config.in
79
80 kernel_oldconfig: .config FORCE
81 $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux oldconfig
82
83 kernel_menuconfig: .config FORCE
84 $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig
85
86 tmp/.prereq-build: include/prereq-build.mk
87 mkdir -p tmp
88 rm -f tmp/.host.mk
89 @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
90 echo "Prerequisite check failed. Use FORCE=1 to override."; \
91 false; \
92 }
93 touch $@
94
95 download: .config FORCE
96 @+$(SUBMAKE) tools/download
97 @+$(SUBMAKE) toolchain/download
98 @+$(SUBMAKE) package/download
99 @+$(SUBMAKE) target/download
100
101 clean dirclean: .config
102 @+$(SUBMAKE) $@
103
104 prereq:: .config
105 @+$(MAKE) -s tmp/.prereq-build $(PREP_MK)
106 @+$(NO_TRACE_MAKE) -s $@
107
108 %::
109 @+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq
110 @+$(SUBMAKE) -r $@
111
112 help:
113 cat README
114
115 docs docs/compile: FORCE
116 @$(_SINGLE)$(SUBMAKE) -C docs compile
117
118 docs/clean: FORCE
119 @$(_SINGLE)$(SUBMAKE) -C docs clean
120
121 distclean:
122 rm -rf tmp build_dir staging_dir dl .config* feeds package/feeds package/openwrt-packages bin
123 @$(_SINGLE)$(SUBMAKE) -C scripts/config clean
124
125 ifeq ($(findstring v,$(DEBUG)),)
126 .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package prepare-tmpinfo
127 endif
128 .PHONY: help FORCE
129 .NOTPARALLEL:
130
This page took 0.070333 seconds and 5 git commands to generate.