Regenerate the menuconfig once symlinked packages are gone
[openwrt/openwrt.git] / Makefile
1 # Makefile for OpenWrt
2 #
3 # Copyright (C) 2006 OpenWrt.org
4 # Copyright (C) 2006 by Felix Fietkau <openwrt@nbd.name>
5 #
6 # This is free software, licensed under the GNU General Public License v2.
7 # See /LICENSE for more information.
8 #
9
10 RELEASE:=Kamikaze
11 #VERSION:=2.0 # uncomment for final release
12
13 #--------------------------------------------------------------
14 # Just run 'make menuconfig', configure stuff, then run 'make'.
15 # You shouldn't need to mess with anything beyond this point...
16 #--------------------------------------------------------------
17
18 all: world
19
20 SHELL:=/usr/bin/env bash
21 export LC_ALL=C
22 export LANG=C
23 export TOPDIR=${CURDIR}
24 export IS_TTY=$(shell tty -s && echo 1 || echo 0)
25
26 include $(TOPDIR)/include/verbose.mk
27
28 OPENWRTVERSION:=$(RELEASE)
29 ifneq ($(VERSION),)
30 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
31 else
32 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
33 ifneq ($(REV),)
34 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
35 endif
36 endif
37 export OPENWRTVERSION
38
39 ifeq ($(FORCE),)
40 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
41 world: tmp/.prereq-package tmp/.prereq-target
42 endif
43
44 package/%/Makefile: ;
45 target/%/Makefile: ;
46
47 tmp/.packageinfo tmp/.targetinfo: FORCE
48 mkdir -p tmp/info
49 $(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="" SCAN_TARGET_DEPS="$(wildcard target/*/Makefile include/kernel*.mk)" SCAN_EXTRA=""
50 $(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(wildcard package/*/Makefile include/package*.mk include/kernel.mk)" SCAN_EXTRA=""
51
52 tmpinfo-clean: FORCE
53 -rm -rf tmp/.*info
54
55 tmp/.config-%.in: tmp/.%info scripts/metadata.pl
56 ./scripts/metadata.pl $*_config < $< > $@ || rm -f $@
57
58 .config: ./scripts/config/conf tmp/.config-target.in tmp/.config-package.in
59 if [ \! -f .config ]; then \
60 [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
61 $(NO_TRACE_MAKE) menuconfig; \
62 fi
63 $< -D .config Config.in &> /dev/null
64
65 scripts/config/mconf:
66 $(MAKE) -C scripts/config all
67
68 scripts/config/conf:
69 $(MAKE) -C scripts/config conf
70
71
72
73 config: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
74 $< Config.in
75
76 config-clean: FORCE
77 $(NO_TRACE_MAKE) -C scripts/config clean
78
79 defconfig: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
80 touch .config
81 $< -D .config Config.in
82
83 oldconfig: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
84 $< -o Config.in
85
86 menuconfig: scripts/config/mconf tmp/.config-target.in tmp/.config-package.in FORCE
87 if [ \! -f .config -a -e $(HOME)/.openwrt/defconfig ]; then \
88 cp $(HOME)/.openwrt/defconfig .config; \
89 fi
90 $< Config.in
91
92 kernel_menuconfig: .config FORCE
93 -$(MAKE) target/linux-prepare
94 $(NO_TRACE_MAKE) -C target/linux menuconfig
95
96
97 package/% target/%: tmp/.packageinfo
98 toolchain/% package/% target/%: tmp/.targetinfo
99 package/% target/% tools/% toolchain/%: FORCE
100 $(MAKE) -C $(patsubst %/$*,%,$@) $*
101
102
103 tmp/.prereq-build: include/prereq-build.mk
104 mkdir -p tmp
105 rm -f tmp/.host.mk
106 $(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
107 echo "Prerequisite check failed. Use FORCE=1 to override."; \
108 false; \
109 }
110 touch $@
111
112 tmp/.prereq-%: include/prereq.mk tmp/.%info .config
113 mkdir -p tmp
114 rm -f tmp/.host.mk
115 $(NO_TRACE_MAKE) -s -C $* prereq 2>/dev/null || { \
116 echo "Prerequisite check failed. Use FORCE=1 to override."; \
117 false; \
118 }
119 touch $@
120
121 prereq: tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target FORCE
122
123 download: .config FORCE
124 $(MAKE) tools/download
125 $(MAKE) toolchain/download
126 $(MAKE) package/download
127 $(MAKE) target/download
128
129 world: .config FORCE
130 $(MAKE) tools/install
131 $(MAKE) toolchain/install
132 $(MAKE) target/compile
133 $(MAKE) package/compile
134 $(MAKE) package/install
135 $(MAKE) target/install
136 $(MAKE) package/index
137
138 clean: FORCE
139 rm -rf build_* bin tmp
140
141 dirclean: clean
142 rm -rf staging_dir_* toolchain_build_* tool_build
143
144 distclean: dirclean config-clean symlinkclean docclean
145 rm -rf dl
146
147 help:
148 cat README
149
150 doc:
151 $(MAKE) -C docs/ openwrt.pdf
152
153 docclean:
154 $(MAKE) -C docs/ clean
155
156 symlinkclean:
157 -find package -type l | xargs rm -f
158 rm -rf tmp
159
160 .SILENT: clean dirclean distclean symlinkclean config-clean download world help tmp/.packageinfo tmp/.targetinfo tmpinfo-clean tmp/.config-package.in tmp/.config-target.in .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target
161 FORCE: ;
162 .PHONY: FORCE help