slub: look up object from the freelist once
[tomato.git] / toolchain / include / toplevel.mk
blob40d46026e680eb489dc1592e4439b982d3d1516f
1 # Makefile for OpenWrt
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
14 ifeq ($(SDK),1)
15 include $(TOPDIR)/include/version.mk
16 else
17 REVISION:=$(shell $(TOPDIR)/scripts/getver.sh)
18 endif
20 OPENWRTVERSION:=$(if $(REVISION), ($(REVISION)))
21 export OPENWRTVERSION
22 export IS_TTY=$(shell tty -s && echo 1 || echo 0)
24 ifeq ($(FORCE),)
25 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
26 endif
28 SCAN_COOKIE?=$(shell echo $$$$)
29 export SCAN_COOKIE
31 prepare-mk: FORCE ;
33 prepare-tmpinfo: FORCE
34 mkdir -p tmp/info
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; }; \
40 # done
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); \
50 scripts/config/mconf:
51 @$(SUBMAKE) -s -j1 -C scripts/config all
53 $(eval $(call rdep,scripts/config,scripts/config/mconf))
55 scripts/config/conf:
56 @$(SUBMAKE) -s -j1 -C scripts/config conf
58 config: scripts/config/conf prepare-tmpinfo FORCE
59 $< Config.in
61 config-clean: FORCE
62 $(NO_TRACE_MAKE) -C scripts/config clean
64 defconfig: scripts/config/conf prepare-tmpinfo FORCE
65 touch .config
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; \
75 $< Config.in
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
84 mkdir -p tmp
85 rm -f tmp/.host.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."; \
88 false; \
90 touch $@
92 download: .config FORCE
93 @+$(SUBMAKE) tools/download
94 @+$(SUBMAKE) toolchain/download
96 clean dirclean: .config
97 @+$(SUBMAKE) $@
99 prereq:: .config
100 @+$(MAKE) -s tmp/.prereq-build $(PREP_MK)
101 @$(NO_TRACE_MAKE) -s $@
104 @+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq
105 @+$(SUBMAKE) -r $@
107 help:
108 cat README
110 docs docs/compile: FORCE
111 @$(_SINGLE)$(SUBMAKE) -j1 -C docs compile
113 docs/clean: FORCE
114 @$(_SINGLE)$(SUBMAKE) -j1 -C docs clean
116 distclean:
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
122 endif
123 .PHONY: help FORCE
124 .NOTPARALLEL: