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.
9 SHELL
:=/usr
/bin
/env bash
10 PREP_MK
= OPENWRT_BUILD
= QUIET
=0
12 include $(TOPDIR
)/include/verbose.mk
15 include $(TOPDIR
)/include/version.mk
17 REVISION
:=$(shell $(TOPDIR
)/scripts
/getver.sh
)
20 OPENWRTVERSION
:=$(if
$(REVISION
), ($(REVISION
)))
22 export IS_TTY
=$(shell tty
-s
&& echo
1 || echo
0)
25 .config scripts
/config
/conf scripts
/config
/mconf
: tmp
/.prereq-build
28 SCAN_COOKIE?
=$(shell echo
$$$$)
33 prepare-tmpinfo
: FORCE
35 # $(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=5 SCAN_EXTRA=""
36 # $(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
37 # for type in package target; do \
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; }; \
41 # ./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
42 touch
$(TOPDIR
)/tmp
/.build
44 .config
: .
/scripts
/config
/conf prepare-tmpinfo
45 @
+if
[ \
! -f .config
]; then \
46 [ -e defconfig
] && cp defconfig .config
; \
47 $(NO_TRACE_MAKE
) menuconfig
$(PREP_MK
); \
51 @
$(SUBMAKE
) -s
-j1
-C scripts
/config
all
53 $(eval
$(call rdep
,scripts
/config
,scripts
/config
/mconf
))
56 @
$(SUBMAKE
) -s
-j1
-C scripts
/config conf
58 config
: scripts
/config
/conf prepare-tmpinfo FORCE
62 $(NO_TRACE_MAKE
) -C scripts
/config
clean
64 defconfig
: scripts
/config
/conf prepare-tmpinfo FORCE
66 $< -D .config Config.in
68 oldconfig
: scripts
/config
/conf prepare-tmpinfo FORCE
69 $< -$(if
$(CONFDEFAULT
),$(CONFDEFAULT
),o
) Config.in
71 menuconfig
: scripts
/config
/mconf prepare-tmpinfo FORCE
72 if
[ \
! -f .config
-a
-e defconfig
]; then \
73 cp defconfig .config
; \
77 kernel_oldconfig
: .config FORCE
78 $(NO_TRACE_MAKE
) -C target
/linux oldconfig
80 kernel_menuconfig
: .config FORCE
81 $(NO_TRACE_MAKE
) -C target
/linux menuconfig
83 tmp
/.prereq-build
: include/prereq-build.mk
86 @
$(_SINGLE
)$(NO_TRACE_MAKE
) -j1
-s
-f
$(TOPDIR
)/include/prereq-build.mk prereq
2>/dev
/null ||
{ \
87 echo
"Prerequisite check failed. Use FORCE=1 to override."; \
92 download
: .config FORCE
93 @
+$(SUBMAKE
) tools
/download
94 @
+$(SUBMAKE
) toolchain
/download
96 clean dirclean
: .config
100 @
+$(MAKE
) -s tmp
/.prereq-build
$(PREP_MK
)
101 @
$(NO_TRACE_MAKE
) -s
$@
104 @
+$(PREP_MK
) $(NO_TRACE_MAKE
) -s prereq
110 docs docs
/compile
: FORCE
111 @
$(_SINGLE
)$(SUBMAKE
) -j1
-C docs compile
114 @
$(_SINGLE
)$(SUBMAKE
) -j1
-C docs
clean
117 rm -rf tmp build_dir staging_dir dl .config
* feeds bin
118 @
$(_SINGLE
)$(SUBMAKE
) -j1
-C scripts
/config
clean
120 ifeq ($(findstring v
,$(DEBUG
)),)
121 .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