kernel: fix dependencies for .config, use selections from oldconfig when running...
[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 SCAN_COOKIE?=$(shell echo $$$$)
48 export SCAN_COOKIE
49
50 tmp/.packageinfo tmp/.targetinfo: FORCE
51 mkdir -p tmp/info
52 $(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=""
53 $(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=""
54
55 tmpinfo-clean: FORCE
56 -rm -rf tmp/.*info
57
58 tmp/.config-%.in: tmp/.%info scripts/metadata.pl
59 ./scripts/metadata.pl $*_config < $< > $@ || rm -f $@
60
61 .config: ./scripts/config/conf tmp/.config-target.in tmp/.config-package.in
62 if [ \! -f .config ]; then \
63 [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
64 $(NO_TRACE_MAKE) menuconfig; \
65 fi
66 $< -D .config Config.in &> /dev/null
67
68 scripts/config/mconf:
69 $(MAKE) -C scripts/config all
70
71 scripts/config/conf:
72 $(MAKE) -C scripts/config conf
73
74
75
76 config: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
77 $< Config.in
78
79 config-clean: FORCE
80 $(NO_TRACE_MAKE) -C scripts/config clean
81
82 defconfig: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
83 touch .config
84 $< -D .config Config.in
85
86 oldconfig: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
87 $< -o Config.in
88
89 menuconfig: scripts/config/mconf tmp/.config-target.in tmp/.config-package.in FORCE
90 if [ \! -f .config -a -e $(HOME)/.openwrt/defconfig ]; then \
91 cp $(HOME)/.openwrt/defconfig .config; \
92 fi
93 $< Config.in
94
95 kernel_menuconfig: .config FORCE
96 $(NO_TRACE_MAKE) -C target/linux menuconfig
97
98
99 package/% target/%: tmp/.packageinfo
100 toolchain/% package/% target/%: tmp/.targetinfo
101 package/% target/% tools/% toolchain/%: FORCE
102 $(MAKE) -C $(patsubst %/$*,%,$@) $*
103
104
105 tmp/.prereq-build: include/prereq-build.mk
106 mkdir -p tmp
107 rm -f tmp/.host.mk
108 $(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
109 echo "Prerequisite check failed. Use FORCE=1 to override."; \
110 false; \
111 }
112 touch $@
113
114 tmp/.prereq-%: include/prereq.mk tmp/.%info .config
115 mkdir -p tmp
116 rm -f tmp/.host.mk
117 $(NO_TRACE_MAKE) -s -C $* prereq 2>/dev/null || { \
118 echo "Prerequisite check failed. Use FORCE=1 to override."; \
119 false; \
120 }
121 touch $@
122
123 prereq: tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target FORCE
124
125 download: .config FORCE
126 $(MAKE) tools/download
127 $(MAKE) toolchain/download
128 $(MAKE) package/download
129 $(MAKE) target/download
130
131 world: .config FORCE
132 $(MAKE) tools/install
133 $(MAKE) toolchain/install
134 $(MAKE) target/compile
135 $(MAKE) package/compile
136 $(MAKE) package/install
137 $(MAKE) target/install
138 $(MAKE) package/index
139
140 clean: FORCE
141 rm -rf build_* bin tmp
142
143 dirclean: clean
144 rm -rf staging_dir_* toolchain_build_* tool_build
145
146 distclean: dirclean config-clean symlinkclean docs/clean
147 rm -rf dl
148
149 help:
150 cat README
151
152 docs docs/compile: FORCE
153 $(MAKE) -C docs compile
154
155 docs/clean: FORCE
156 $(MAKE) -C docs clean
157
158 symlinkclean:
159 -find package -type l | xargs rm -f
160 rm -rf tmp
161
162 .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
163 FORCE: ;
164 .PHONY: FORCE help
This page took 0.05232 seconds and 5 git commands to generate.