fix mtd compile
[openwrt/svn-archive/archive.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=${shell pwd}
24 include $(TOPDIR)/include/verbose.mk
25 ifeq ($(KBUILD_VERBOSE),99)
26 MAKE:=3>/dev/null $(MAKE)
27 endif
28
29 OPENWRTVERSION:=$(RELEASE)
30 ifneq ($(VERSION),)
31 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
32 else
33 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
34 ifneq ($(REV),)
35 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
36 endif
37 endif
38 export OPENWRTVERSION
39
40 ifneq ($(shell ./scripts/timestamp.pl -p tmp/.pkginfo package scripts Makefile),tmp/.pkginfo)
41 tmp/.pkginfo: FORCE
42 endif
43
44 ifneq ($(shell ./scripts/timestamp.pl -p tmp/.targetinfo target/linux scripts Makefile),tmp/.targetinfo)
45 tmp/.targetinfo: FORCE
46 endif
47
48 ifeq ($(FORCE),)
49 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
50 world: tmp/.prereq-packages
51 endif
52
53 tmp/.pkginfo:
54 @mkdir -p tmp
55 @echo Collecting package info...
56 @-for dir in package/*/; do \
57 [ -f "$${dir}/Makefile" ] || continue; \
58 echo Source-Makefile: $${dir}Makefile; \
59 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
60 echo; \
61 done > $@
62
63 tmp/.targetinfo:
64 @mkdir -p tmp
65 @echo Collecting target info...
66 @-for dir in target/linux/*/; do \
67 [ -f "$${dir}/Makefile" ] || continue; \
68 ( cd "$$dir"; $(NO_TRACE_MAKE) --no-print-dir DUMP=1 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2 ); \
69 echo; \
70 done > $@
71
72 tmpinfo-clean: FORCE
73 @-rm -rf tmp/.pkginfo tmp/.targetinfo
74
75 tmp/.config.in: tmp/.pkginfo
76 @./scripts/gen_package_config.pl < $< > $@ || rm -f $@
77
78 tmp/.config-target.in: tmp/.targetinfo
79 @./scripts/gen_target_config.pl < $< > $@ || rm -f $@
80
81 .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
82 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
83 @$< -D .config Config.in &> /dev/null
84
85 scripts/config/mconf:
86 @$(MAKE) -C scripts/config all
87
88 scripts/config/conf:
89 @$(MAKE) -C scripts/config conf
90
91 config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
92 $< Config.in
93
94 config-clean: FORCE
95 $(NO_TRACE_MAKE) -C scripts/config clean
96
97 defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
98 touch .config
99 $< -D .config Config.in
100
101 oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
102 $< -o Config.in
103
104 menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
105 $< Config.in
106
107 package/%: tmp/.pkginfo tmp/.targetinfo FORCE
108 $(MAKE) -C package $(patsubst package/%,%,$@)
109
110 target/%: tmp/.pkginfo tmp/.targetinfo FORCE
111 $(MAKE) -C target $(patsubst target/%,%,$@)
112
113 tools/%: FORCE
114 $(MAKE) -C tools $(patsubst tools/%,%,$@)
115
116 toolchain/%: tmp/.targetinfo FORCE
117 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
118
119 tmp/.prereq-build: include/prereq-build.mk
120 @mkdir -p tmp
121 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
122 echo "Prerequisite check failed. Use FORCE=1 to override."; \
123 false; \
124 }
125 @touch $@
126
127 tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
128 @mkdir -p tmp
129 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
130 echo "Prerequisite check failed. Use FORCE=1 to override."; \
131 false; \
132 }
133 @touch $@
134
135 prereq: tmp/.prereq-build tmp/.prereq-packages FORCE
136
137 download: .config FORCE
138 $(MAKE) tools/download
139 $(MAKE) toolchain/download
140 $(MAKE) package/download
141 $(MAKE) target/download
142
143 world: .config FORCE
144 $(MAKE) tools/install
145 $(MAKE) toolchain/install
146 $(MAKE) target/compile
147 $(MAKE) package/compile
148 $(MAKE) package/install
149 $(MAKE) target/install
150 $(MAKE) package/index
151
152 clean: FORCE
153 rm -rf build_* bin tmp
154
155 dirclean: clean
156 rm -rf staging_dir_* toolchain_build_* tool_build
157
158 distclean: dirclean config-clean
159 rm -rf dl
160
161 .SILENT: clean dirclean distclean config-clean download world
162 FORCE: ;
163 .PHONY: FORCE
164 %: ;