3 # Copyright (C) 2007 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
10 #VERSION:=2.0 # uncomment for final release
12 SHELL
:=/usr
/bin
/env bash
13 OPENWRTVERSION
:=$(RELEASE
)
14 PREP_MK
= OPENWRT_BUILD
= QUIET
=0
15 include $(TOPDIR
)/include/verbose.mk
17 OPENWRTVERSION
:=$(VERSION
) ($(OPENWRTVERSION
))
19 REV
:=$(if
$(wildcard .svn
/entries
),$(shell LANG
=C svn
info | awk
'/^Revision:/ { print$$2 }' ))
21 OPENWRTVERSION
:=$(OPENWRTVERSION
)/r
$(REV
)
27 .config scripts
/config
/conf scripts
/config
/mconf
: tmp
/.prereq-build
30 SCAN_COOKIE?
=$(shell echo
$$$$)
35 prepare-tmpinfo
: FORCE
37 +$(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
=""
38 +$(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
="" SCAN_MAKEOPTS
="TARGET_BUILD=1"
39 for type in package target
; do \
40 f
=tmp
/.
$${type}info; t
=tmp
/.config-
$${type}.in
; \
41 [ "$$t" -nt
"$$f" ] || .
/scripts
/metadata.pl
$${type}_config
"$$f" > "$$t" ||
{ rm -f
"$$t"; echo
"Failed to build $$t"; false
; break
; }; \
43 .
/scripts
/metadata.pl package_mk tmp
/.packageinfo
> tmp
/.packagedeps ||
{ rm -f tmp
/.packagedeps
; false
; }
44 touch
$(TOPDIR
)/tmp
/.build
46 .config
: .
/scripts
/config
/conf prepare-tmpinfo
47 @
+if
[ \
! -f .config
]; then \
48 [ -e
$(HOME
)/.openwrt
/defconfig
] && cp
$(HOME
)/.openwrt
/defconfig .config
; \
49 $(NO_TRACE_MAKE
) menuconfig
$(PREP_MK
); \
53 @
+$(MAKE
) -C scripts
/config
all
55 $(eval
$(call rdep
,scripts
/config
,scripts
/config
/mconf
))
58 @
+$(MAKE
) -C scripts
/config conf
60 config
: scripts
/config
/conf prepare-tmpinfo FORCE
64 $(NO_TRACE_MAKE
) -C scripts
/config
clean
66 defconfig
: scripts
/config
/conf prepare-tmpinfo FORCE
68 $< -D .config Config.in
70 oldconfig
: scripts
/config
/conf prepare-tmpinfo FORCE
71 $< -$(if
$(CONFDEFAULT
),$(CONFDEFAULT
),o
) Config.in
73 menuconfig
: scripts
/config
/mconf prepare-tmpinfo FORCE
74 if
[ \
! -f .config
-a
-e
$(HOME
)/.openwrt
/defconfig
]; then \
75 cp
$(HOME
)/.openwrt
/defconfig .config
; \
79 kernel_oldconfig
: .config FORCE
80 $(NO_TRACE_MAKE
) -C target
/linux oldconfig
82 kernel_menuconfig
: .config FORCE
83 $(NO_TRACE_MAKE
) -C target
/linux menuconfig
85 tmp
/.prereq-build
: include/prereq-build.mk
88 @
+$(NO_TRACE_MAKE
) -s
-f
$(TOPDIR
)/include/prereq-build.mk prereq
2>/dev
/null ||
{ \
89 echo
"Prerequisite check failed. Use FORCE=1 to override."; \
94 download
: .config FORCE
95 $(MAKE
) -j1 tools
/download
96 $(MAKE
) -j1 toolchain
/download
97 $(MAKE
) -j1 package
/download
98 $(MAKE
) -j1 target
/download
104 @
+$(SUBMAKE
) -s tmp
/.prereq-build
$(PREP_MK
)
105 @
$(NO_TRACE_MAKE
) -s
$@
108 @
+$(PREP_MK
) $(NO_TRACE_MAKE
) -s prereq
114 docs docs
/compile
: FORCE
115 $(MAKE
) -C docs compile
118 $(MAKE
) -C docs
clean
121 -find package
-type l | xargs
rm -f
125 rm -rf tmp build_dir staging_dir dl .config
* feeds
127 ifeq ($(findstring v
,$(DEBUG
)),)
128 .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 prepare-tmpinfo