|
nbd
|
1 |
# Makefile for OpenWrt |
|
|
2 |
# |
|
|
3 |
# Copyright (C) 2007 OpenWrt.org |
|
|
4 |
# |
|
|
5 |
# This is free software, licensed under the GNU General Public License v2. |
|
|
6 |
# See /LICENSE for more information. |
|
|
7 |
# |
|
|
8 |
|
|
|
9 |
RELEASE:=Kamikaze |
|
|
10 |
#VERSION:=2.0 # uncomment for final release |
|
|
11 |
|
|
|
12 |
SHELL:=/usr/bin/env bash |
|
|
13 |
OPENWRTVERSION:=$(RELEASE) |
|
nbd
|
14 |
PREP_MK= OPENWRT_BUILD= QUIET=0 |
|
nbd
|
15 |
include $(TOPDIR)/include/verbose.mk |
|
nbd
|
16 |
ifneq ($(VERSION),) |
|
|
17 |
OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION)) |
|
|
18 |
else |
|
|
19 |
REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' ) |
|
|
20 |
ifneq ($(REV),) |
|
|
21 |
OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV) |
|
|
22 |
endif |
|
|
23 |
endif |
|
|
24 |
export OPENWRTVERSION |
|
|
25 |
|
|
|
26 |
ifeq ($(FORCE),) |
|
|
27 |
.config scripts/config/conf scripts/config/mconf: tmp/.prereq-build |
|
|
28 |
endif |
|
|
29 |
|
|
|
30 |
SCAN_COOKIE?=$(shell echo $$$$) |
|
|
31 |
export SCAN_COOKIE |
|
|
32 |
|
|
nbd
|
33 |
tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo: FORCE |
|
|
34 |
mkdir -p tmp/info |
|
|
35 |
+$(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="" |
|
|
36 |
+$(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="" |
|
|
37 |
for type in package target; do \ |
|
nbd
|
38 |
f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ |
|
|
39 |
[ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config < "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ |
|
|
40 |
done |
|
nbd
|
41 |
./scripts/metadata.pl package_mk < tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; } |
|
nbd
|
42 |
|
|
|
43 |
.config: ./scripts/config/conf prepare-tmpinfo |
|
nbd
|
44 |
@+if [ \! -f .config ]; then \ |
|
nbd
|
45 |
[ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \ |
|
nbd
|
46 |
$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \ |
|
nbd
|
47 |
fi |
|
|
48 |
|
|
|
49 |
scripts/config/mconf: |
|
nbd
|
50 |
@+$(MAKE) -C scripts/config all |
|
nbd
|
51 |
|
|
|
52 |
scripts/config/conf: |
|
nbd
|
53 |
@+$(MAKE) -C scripts/config conf |
|
nbd
|
54 |
|
|
|
55 |
config: scripts/config/conf prepare-tmpinfo FORCE |
|
|
56 |
$< Config.in |
|
|
57 |
|
|
|
58 |
config-clean: FORCE |
|
|
59 |
$(NO_TRACE_MAKE) -C scripts/config clean |
|
|
60 |
|
|
|
61 |
defconfig: scripts/config/conf prepare-tmpinfo FORCE |
|
|
62 |
touch .config |
|
|
63 |
$< -D .config Config.in |
|
|
64 |
|
|
|
65 |
oldconfig: scripts/config/conf prepare-tmpinfo FORCE |
|
|
66 |
$< -o Config.in |
|
|
67 |
|
|
|
68 |
menuconfig: scripts/config/mconf prepare-tmpinfo FORCE |
|
|
69 |
if [ \! -f .config -a -e $(HOME)/.openwrt/defconfig ]; then \ |
|
|
70 |
cp $(HOME)/.openwrt/defconfig .config; \ |
|
|
71 |
fi |
|
|
72 |
$< Config.in |
|
|
73 |
|
|
|
74 |
kernel_oldconfig: .config FORCE |
|
|
75 |
$(NO_TRACE_MAKE) -C target/linux oldconfig |
|
|
76 |
|
|
|
77 |
kernel_menuconfig: .config FORCE |
|
|
78 |
$(NO_TRACE_MAKE) -C target/linux menuconfig |
|
|
79 |
|
|
|
80 |
tmp/.prereq-build: include/prereq-build.mk |
|
|
81 |
mkdir -p tmp |
|
|
82 |
rm -f tmp/.host.mk |
|
nbd
|
83 |
@+$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ |
|
nbd
|
84 |
echo "Prerequisite check failed. Use FORCE=1 to override."; \ |
|
|
85 |
false; \ |
|
|
86 |
} |
|
|
87 |
touch $@ |
|
|
88 |
|
|
|
89 |
download: .config FORCE |
|
|
90 |
$(MAKE) -j1 tools/download |
|
|
91 |
$(MAKE) -j1 toolchain/download |
|
|
92 |
$(MAKE) -j1 package/download |
|
|
93 |
$(MAKE) -j1 target/download |
|
|
94 |
|
|
|
95 |
clean dirclean distclean: |
|
|
96 |
@$(MAKE) $@ |
|
|
97 |
|
|
nbd
|
98 |
prereq:: .config |
|
|
99 |
@+$(SUBMAKE) -s tmp/.prereq-build $(PREP_MK) |
|
|
100 |
@$(NO_TRACE_MAKE) -s $@ |
|
|
101 |
|
|
nbd
|
102 |
%:: |
|
nbd
|
103 |
@+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq |
|
nbd
|
104 |
@+$(MAKE) $@ |
|
nbd
|
105 |
|
|
|
106 |
help: |
|
|
107 |
cat README |
|
|
108 |
|
|
|
109 |
docs docs/compile: FORCE |
|
|
110 |
$(MAKE) -C docs compile |
|
|
111 |
|
|
|
112 |
docs/clean: FORCE |
|
|
113 |
$(MAKE) -C docs clean |
|
|
114 |
|
|
|
115 |
symlinkclean: |
|
|
116 |
-find package -type l | xargs rm -f |
|
|
117 |
rm -rf tmp |
|
|
118 |
|
|
nbd
|
119 |
ifeq ($(findstring v,$(DEBUG)),) |
|
|
120 |
.SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target tmp/.packageinfo tmp/.targetinfo prepare-tmpinfo |
|
|
121 |
endif |
|
nbd
|
122 |
.PHONY: help FORCE |
|
|
123 |
.NOTPARALLEL: |
|
|
124 |
|
|
|
125 |
|