upgrade the ixp4xx ethernet driver to v0.3.1, split the Gateway 7001 support to two...
[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 ifeq ($(KBUILD_VERBOSE),99)
25 MAKE:=3>/dev/null $(MAKE)
26 endif
27 export IS_TTY=$(shell tty -s && echo 1 || echo 0)
28
29 include $(TOPDIR)/include/verbose.mk
30
31 OPENWRTVERSION:=$(RELEASE)
32 ifneq ($(VERSION),)
33 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
34 else
35 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
36 ifneq ($(REV),)
37 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
38 endif
39 endif
40 export OPENWRTVERSION
41
42 ifeq ($(FORCE),)
43 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
44 world: tmp/.prereq-packages tmp/.prereq-target
45 endif
46
47 define stamp
48 tmp/info/.stamp-$(1)-$(shell ls $(2)/*/Makefile | (md5sum || md5) 2>/dev/null | cut -d' ' -f1)
49 endef
50
51 STAMP_pkginfo=$(call stamp,pkginfo,package)
52 STAMP_targetinfo=$(call stamp,targetinfo,target/linux)
53 define scan_info
54
55 $(STAMP_$(1)):
56 @mkdir -p tmp/info
57 @rm -f tmp/info/.stamp-$(1)*
58 @touch $$@
59
60 $(foreach FILE,$(shell ls $(2)/*/Makefile),
61 tmp/.$(1): $(FILE)
62 $(FILE):
63 )
64
65 tmp/.$(1): $(STAMP_$(1))
66 @echo -n Collecting $(3) info...
67 @$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="$(1)" SCAN_DIR="$(2)" SCAN_NAME="$(3)" SCAN_DEPS="$(4)"
68
69 endef
70
71 $(eval $(call scan_info,pkginfo,package,package,include/package.mk))
72 $(eval $(call scan_info,targetinfo,target/linux,target,include/kernel-build.mk include/kernel-version.mk))
73
74 tmpinfo-clean: FORCE
75 @-rm -rf tmp/.pkginfo tmp/.targetinfo
76
77 tmp/.config.in: tmp/.pkginfo
78 @./scripts/metadata.pl package_config < $< > $@ || rm -f $@
79
80 tmp/.config-target.in: tmp/.targetinfo
81 @./scripts/metadata.pl target_config < $< > $@ || rm -f $@
82
83 .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
84 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
85 @$< -D .config Config.in &> /dev/null
86
87 scripts/config/mconf:
88 @$(MAKE) -C scripts/config all
89
90 scripts/config/conf:
91 @$(MAKE) -C scripts/config conf
92
93 config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
94 $< Config.in
95
96 config-clean: FORCE
97 $(NO_TRACE_MAKE) -C scripts/config clean
98
99 defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
100 touch .config
101 $< -D .config Config.in
102
103 oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
104 $< -o Config.in
105
106 menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
107 $< Config.in
108
109 kernel_menuconfig: .config FORCE
110 -$(MAKE) target/linux-prepare
111 $(NO_TRACE_MAKE) -C target/linux menuconfig
112
113 package/%:
114 @$(NO_TRACE_MAKE) -s tmp/.pkginfo tmp/.targetinfo
115 $(MAKE) -C package $(patsubst package/%,%,$@)
116
117 target/%:
118 @$(NO_TRACE_MAKE) -s tmp/.pkginfo tmp/.targetinfo
119 $(MAKE) -C target $(patsubst target/%,%,$@)
120
121 tools/%: FORCE
122 $(MAKE) -C tools $(patsubst tools/%,%,$@)
123
124 toolchain/%: tmp/.targetinfo FORCE
125 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
126
127 tmp/.prereq-build: include/prereq-build.mk
128 @mkdir -p tmp
129 @rm -f tmp/.host.mk
130 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
131 echo "Prerequisite check failed. Use FORCE=1 to override."; \
132 false; \
133 }
134 @touch $@
135
136 tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
137 @mkdir -p tmp
138 @rm -f tmp/.host.mk
139 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
140 echo "Prerequisite check failed. Use FORCE=1 to override."; \
141 false; \
142 }
143 @touch $@
144
145 tmp/.prereq-target: include/prereq.mk tmp/.targetinfo .config
146 @mkdir -p tmp
147 @rm -f tmp/.host.mk
148 @$(NO_TRACE_MAKE) -s -C target prereq 2>/dev/null || { \
149 echo "Prerequisite check failed. Use FORCE=1 to override."; \
150 false; \
151 }
152 @touch $@
153
154 prereq: tmp/.prereq-build tmp/.prereq-packages tmp/.prereq-target FORCE
155
156 download: .config FORCE
157 $(MAKE) tools/download
158 $(MAKE) toolchain/download
159 $(MAKE) package/download
160 $(MAKE) target/download
161
162 world: .config FORCE
163 $(MAKE) tools/install
164 $(MAKE) toolchain/install
165 $(MAKE) target/compile
166 $(MAKE) package/compile
167 $(MAKE) package/install
168 $(MAKE) target/install
169 $(MAKE) package/index
170
171 clean: FORCE
172 rm -rf build_* bin tmp
173
174 dirclean: clean
175 rm -rf staging_dir_* toolchain_build_* tool_build
176
177 distclean: dirclean config-clean
178 rm -rf dl
179
180 help:
181 cat README
182
183 doc:
184 $(MAKE) -C docs/ openwrt.pdf
185
186 docclean:
187 $(MAKE) -C docs/ clean
188
189 .SILENT: clean dirclean distclean config-clean download world
190 FORCE: ;
191 .PHONY: FORCE help
192 %: ;
This page took 0.044252 seconds and 5 git commands to generate.