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)
28 .config scripts
/config
/conf scripts
/config
/mconf
: tmp
/.prereq-build
31 SCAN_COOKIE?
=$(shell echo
$$$$)
36 prepare-tmpinfo
: FORCE
38 +$(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
=5 SCAN_EXTRA
=""
39 +$(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 $(TOPDIR)/include/target.mk" SCAN_DEPTH
=2 SCAN_EXTRA
="" SCAN_MAKEOPTS
="TARGET_BUILD=1"
40 for type in package target
; do \
41 f
=tmp
/.
$${type}info; t
=tmp
/.config-
$${type}.in
; \
42 [ "$$t" -nt
"$$f" ] || .
/scripts
/metadata.pl
$${type}_config
"$$f" > "$$t" ||
{ rm -f
"$$t"; echo
"Failed to build $$t"; false
; break
; }; \
44 .
/scripts
/metadata.pl package_mk tmp
/.packageinfo
> tmp
/.packagedeps ||
{ rm -f tmp
/.packagedeps
; false
; }
45 touch
$(TOPDIR
)/tmp
/.build
47 .config
: .
/scripts
/config
/conf prepare-tmpinfo
48 @
+if
[ \
! -f .config
]; then \
49 [ -e
$(HOME
)/.openwrt
/defconfig
] && cp
$(HOME
)/.openwrt
/defconfig .config
; \
50 $(NO_TRACE_MAKE
) menuconfig
$(PREP_MK
); \
54 @
+$(MAKE
) -C scripts
/config
all
56 $(eval
$(call rdep
,scripts
/config
,scripts
/config
/mconf
))
59 @
+$(MAKE
) -C scripts
/config conf
61 config
: scripts
/config
/conf prepare-tmpinfo FORCE
65 $(NO_TRACE_MAKE
) -C scripts
/config
clean
67 defconfig
: scripts
/config
/conf prepare-tmpinfo FORCE
69 $< -D .config Config.in
71 oldconfig
: scripts
/config
/conf prepare-tmpinfo FORCE
72 $< -$(if
$(CONFDEFAULT
),$(CONFDEFAULT
),o
) Config.in
74 menuconfig
: scripts
/config
/mconf prepare-tmpinfo FORCE
75 if
[ \
! -f .config
-a
-e
$(HOME
)/.openwrt
/defconfig
]; then \
76 cp
$(HOME
)/.openwrt
/defconfig .config
; \
80 kernel_oldconfig
: .config FORCE
81 $(NO_TRACE_MAKE
) -C target
/linux oldconfig
83 kernel_menuconfig
: .config FORCE
84 $(NO_TRACE_MAKE
) -C target
/linux menuconfig
86 tmp
/.prereq-build
: include/prereq-build.mk
89 @
+$(NO_TRACE_MAKE
) -s
-f
$(TOPDIR
)/include/prereq-build.mk prereq
2>/dev
/null ||
{ \
90 echo
"Prerequisite check failed. Use FORCE=1 to override."; \
95 download
: .config FORCE
96 $(MAKE
) -j1 tools
/download
97 $(MAKE
) -j1 toolchain
/download
98 $(MAKE
) -j1 package
/download
99 $(MAKE
) -j1 target
/download
101 clean dirclean
: .config
105 @
+$(SUBMAKE
) -s tmp
/.prereq-build
$(PREP_MK
)
106 @
$(NO_TRACE_MAKE
) -s
$@
109 @
+$(PREP_MK
) $(NO_TRACE_MAKE
) -s prereq
115 docs docs
/compile
: FORCE
116 $(MAKE
) -C docs compile
119 $(MAKE
) -C docs
clean
122 -find package
-type l | xargs
rm -f
126 rm -rf tmp build_dir staging_dir dl .config
* feeds
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