[kernel] aec62xx is working with kernel 2.6.28 agagin.
[openwrt/svn-archive/archive.git] / include / toplevel.mk
1 # Makefile for OpenWrt
2 #
3 # Copyright (C) 2007 OpenWrt.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 RELEASE:=Kamikaze
10 SHELL:=/usr/bin/env bash
11 PREP_MK= OPENWRT_BUILD= QUIET=0
12
13 include $(TOPDIR)/include/verbose.mk
14
15 ifeq ($(SDK),1)
16 include $(TOPDIR)/include/version.mk
17 else
18 REVISION:=$(shell $(TOPDIR)/scripts/getver.sh)
19 endif
20
21 OPENWRTVERSION:=$(RELEASE)$(if $(REVISION), ($(REVISION)))
22 export RELEASE
23 export REVISION
24 export OPENWRTVERSION
25 export IS_TTY=$(shell tty -s && echo 1 || echo 0)
26 export LD_LIBRARY_PATH:=$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(STAGING_DIR_HOST)/lib
27 export DYLD_LIBRARY_PATH:=$(if $(DYLD_LIBRARY_PATH),$(DYLD_LIBRARY_PATH):)$(STAGING_DIR_HOST)/lib
28
29 # make sure that a predefined CFLAGS variable does not disturb packages
30 export CFLAGS=
31
32 ifeq ($(FORCE),)
33 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
34 endif
35
36 SCAN_COOKIE?=$(shell echo $$$$)
37 export SCAN_COOKIE
38
39 prepare-mk: FORCE ;
40
41 prepare-tmpinfo: FORCE
42 mkdir -p tmp/info
43 $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -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=""
44 $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -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"
45 for type in package target; do \
46 f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
47 [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
48 done
49 ./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
50 touch $(TOPDIR)/tmp/.build
51
52 .config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo)
53 @+if [ \! -e .config ] || ! grep CONFIG_HAVE_DOT_CONFIG .config >/dev/null; then \
54 [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
55 $(_SINGLE)$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
56 fi
57
58 scripts/config/mconf:
59 @$(_SINGLE)$(SUBMAKE) -s -C scripts/config all
60
61 $(eval $(call rdep,scripts/config,scripts/config/mconf))
62
63 scripts/config/conf:
64 @$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf
65
66 config: scripts/config/conf prepare-tmpinfo FORCE
67 $< Config.in
68
69 config-clean: FORCE
70 $(_SINGLE)$(NO_TRACE_MAKE) -C scripts/config clean
71
72 defconfig: scripts/config/conf prepare-tmpinfo FORCE
73 touch .config
74 $< -D .config Config.in
75
76 oldconfig: scripts/config/conf prepare-tmpinfo FORCE
77 $< -$(if $(CONFDEFAULT),$(CONFDEFAULT),o) Config.in
78
79 menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
80 if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
81 cp $(HOME)/.openwrt/defconfig .config; \
82 fi
83 $< Config.in
84
85 kernel_oldconfig: .config FORCE
86 $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux oldconfig
87
88 kernel_menuconfig: .config FORCE
89 $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig
90
91 tmp/.prereq-build: include/prereq-build.mk
92 mkdir -p tmp
93 rm -f tmp/.host.mk
94 @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
95 echo "Prerequisite check failed. Use FORCE=1 to override."; \
96 false; \
97 }
98 touch $@
99
100 download: .config FORCE
101 @+$(SUBMAKE) tools/download
102 @+$(SUBMAKE) toolchain/download
103 @+$(SUBMAKE) package/download
104 @+$(SUBMAKE) target/download
105
106 clean dirclean: .config
107 @+$(SUBMAKE) -r $@
108
109 prereq:: prepare-tmpinfo .config
110 @+$(MAKE) -r -s tmp/.prereq-build $(PREP_MK)
111 @+$(NO_TRACE_MAKE) -r -s $@
112
113 %::
114 @+$(PREP_MK) $(NO_TRACE_MAKE) -r -s prereq
115 @+$(SUBMAKE) -r $@
116
117 help:
118 cat README
119
120 docs docs/compile: FORCE
121 @$(_SINGLE)$(SUBMAKE) -C docs compile
122
123 docs/clean: FORCE
124 @$(_SINGLE)$(SUBMAKE) -C docs clean
125
126 distclean:
127 rm -rf tmp build_dir staging_dir dl .config* feeds package/feeds package/openwrt-packages bin
128 @$(_SINGLE)$(SUBMAKE) -C scripts/config clean
129
130 ifeq ($(findstring v,$(DEBUG)),)
131 .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
132 endif
133 .PHONY: help FORCE
134 .NOTPARALLEL:
135