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