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 SHELL
:=/usr
/bin
/env bash
11 PREP_MK
= OPENWRT_BUILD
= QUIET
=0
13 include $(TOPDIR
)/include/verbose.mk
16 include $(TOPDIR
)/include/version.mk
18 REVISION
:=$(shell $(TOPDIR
)/scripts
/getver.sh
)
21 OPENWRTVERSION
:=$(RELEASE
)$(if
$(REVISION
), ($(REVISION
)))
25 export IS_TTY
=$(shell tty
-s
&& echo
1 || echo
0)
27 # make sure that a predefined CFLAGS variable does not disturb packages
31 .config scripts
/config
/conf scripts
/config
/mconf
: tmp
/.prereq-build
34 SCAN_COOKIE?
=$(shell echo
$$$$)
39 prepare-tmpinfo
: FORCE
41 $(_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
=""
42 $(_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"
43 for type in package target
; do \
44 f
=tmp
/.
$${type}info; t
=tmp
/.config-
$${type}.in
; \
45 [ "$$t" -nt
"$$f" ] || .
/scripts
/metadata.pl
$${type}_config
"$$f" > "$$t" ||
{ rm -f
"$$t"; echo
"Failed to build $$t"; false
; break
; }; \
47 .
/scripts
/metadata.pl package_mk tmp
/.packageinfo
> tmp
/.packagedeps ||
{ rm -f tmp
/.packagedeps
; false
; }
48 touch
$(TOPDIR
)/tmp
/.build
50 .config
: .
/scripts
/config
/conf prepare-tmpinfo
$(if
$(CONFIG_HAVE_DOT_CONFIG
),,FORCE
)
51 @
+if
[ \
! -f .config
] ||
! grep CONFIG_HAVE_DOT_CONFIG .config
>/dev
/null
; then \
52 [ -e
$(HOME
)/.openwrt
/defconfig
] && cp
$(HOME
)/.openwrt
/defconfig .config
; \
53 $(_SINGLE
)$(NO_TRACE_MAKE
) menuconfig
$(PREP_MK
); \
57 @
$(_SINGLE
)$(SUBMAKE
) -s
-C scripts
/config
all
59 $(eval
$(call rdep
,scripts
/config
,scripts
/config
/mconf
))
62 @
$(_SINGLE
)$(SUBMAKE
) -s
-C scripts
/config conf
64 config
: scripts
/config
/conf prepare-tmpinfo FORCE
68 $(_SINGLE
)$(NO_TRACE_MAKE
) -C scripts
/config
clean
70 defconfig
: scripts
/config
/conf prepare-tmpinfo FORCE
72 $< -D .config Config.in
74 oldconfig
: scripts
/config
/conf prepare-tmpinfo FORCE
75 $< -$(if
$(CONFDEFAULT
),$(CONFDEFAULT
),o
) Config.in
77 menuconfig
: scripts
/config
/mconf prepare-tmpinfo FORCE
78 if
[ \
! -f .config
-a
-e
$(HOME
)/.openwrt
/defconfig
]; then \
79 cp
$(HOME
)/.openwrt
/defconfig .config
; \
83 kernel_oldconfig
: .config FORCE
84 $(_SINGLE
)$(NO_TRACE_MAKE
) -C target
/linux oldconfig
86 kernel_menuconfig
: .config FORCE
87 $(_SINGLE
)$(NO_TRACE_MAKE
) -C target
/linux menuconfig
89 tmp
/.prereq-build
: include/prereq-build.mk
92 @
$(_SINGLE
)$(NO_TRACE_MAKE
) -j1
-s
-f
$(TOPDIR
)/include/prereq-build.mk prereq
2>/dev
/null ||
{ \
93 echo
"Prerequisite check failed. Use FORCE=1 to override."; \
98 download
: .config FORCE
99 @
+$(SUBMAKE
) tools
/download
100 @
+$(SUBMAKE
) toolchain
/download
101 @
+$(SUBMAKE
) package
/download
102 @
+$(SUBMAKE
) target
/download
104 clean dirclean
: .config
108 @
+$(MAKE
) -s tmp
/.prereq-build
$(PREP_MK
)
109 @
+$(NO_TRACE_MAKE
) -s
$@
112 @
+$(PREP_MK
) $(NO_TRACE_MAKE
) -s prereq
118 docs docs
/compile
: FORCE
119 @
$(_SINGLE
)$(SUBMAKE
) -C docs compile
122 @
$(_SINGLE
)$(SUBMAKE
) -C docs
clean
125 rm -rf tmp build_dir staging_dir dl .config
* feeds package
/feeds package
/openwrt-packages bin
126 @
$(_SINGLE
)$(SUBMAKE
) -C scripts
/config
clean
128 ifeq ($(findstring v
,$(DEBUG
)),)
129 .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