allow targets to select/deselect config symbols
[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 #VERSION:=2.0 # uncomment for final release
11
12 SHELL:=/usr/bin/env bash
13 OPENWRTVERSION:=$(RELEASE)
14 PREP_MK= OPENWRT_BUILD= QUIET=0
15 include $(TOPDIR)/include/verbose.mk
16 ifneq ($(VERSION),)
17 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
18 else
19 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
20 ifneq ($(REV),)
21 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
22 endif
23 endif
24 export OPENWRTVERSION
25
26 ifeq ($(FORCE),)
27 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
28 endif
29
30 SCAN_COOKIE?=$(shell echo $$$$)
31 export SCAN_COOKIE
32
33 prepare-mk: FORCE ;
34
35 prepare-tmpinfo: FORCE
36 mkdir -p tmp/info
37 +$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=4 SCAN_EXTRA=""
38 +$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
39 for type in package target; do \
40 f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
41 [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
42 done
43 ./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
44 touch $(TOPDIR)/tmp/.build
45
46 .config: ./scripts/config/conf prepare-tmpinfo
47 @+if [ \! -f .config ]; then \
48 [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
49 $(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
50 fi
51
52 scripts/config/mconf:
53 @+$(MAKE) -C scripts/config all
54
55 scripts/config/conf:
56 @+$(MAKE) -C scripts/config conf
57
58 config: scripts/config/conf prepare-tmpinfo FORCE
59 $< Config.in
60
61 config-clean: FORCE
62 $(NO_TRACE_MAKE) -C scripts/config clean
63
64 defconfig: scripts/config/conf prepare-tmpinfo FORCE
65 touch .config
66 $< -D .config Config.in
67
68 oldconfig: scripts/config/conf prepare-tmpinfo FORCE
69 $< -$(if $(CONFDEFAULT),$(CONFDEFAULT),o) Config.in
70
71 menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
72 if [ \! -f .config -a -e $(HOME)/.openwrt/defconfig ]; then \
73 cp $(HOME)/.openwrt/defconfig .config; \
74 fi
75 $< Config.in
76
77 kernel_oldconfig: .config FORCE
78 $(NO_TRACE_MAKE) -C target/linux oldconfig
79
80 kernel_menuconfig: .config FORCE
81 $(NO_TRACE_MAKE) -C target/linux menuconfig
82
83 tmp/.prereq-build: include/prereq-build.mk
84 mkdir -p tmp
85 rm -f tmp/.host.mk
86 @+$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
87 echo "Prerequisite check failed. Use FORCE=1 to override."; \
88 false; \
89 }
90 touch $@
91
92 download: .config FORCE
93 $(MAKE) -j1 tools/download
94 $(MAKE) -j1 toolchain/download
95 $(MAKE) -j1 package/download
96 $(MAKE) -j1 target/download
97
98 clean dirclean:
99 @$(MAKE) $@
100
101 prereq:: .config
102 @+$(SUBMAKE) -s tmp/.prereq-build $(PREP_MK)
103 @$(NO_TRACE_MAKE) -s $@
104
105 %::
106 @+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq
107 @+$(MAKE) -r $@
108
109 help:
110 cat README
111
112 docs docs/compile: FORCE
113 $(MAKE) -C docs compile
114
115 docs/clean: FORCE
116 $(MAKE) -C docs clean
117
118 symlinkclean:
119 -find package -type l | xargs rm -f
120 rm -rf tmp
121
122 distclean:
123 rm -rf tmp build_dir staging_dir dl .config*
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.045437 seconds and 5 git commands to generate.