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