clean up recursive dependency handling, use timestamp.pl again, because it saves...
[openwrt.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 #VERSION:=2.0 # uncomment for final release
11
12 SHELL:=/usr/bin/env bash
13 OPENWRTVERSION:=$(RELEASE)
14 PREP_MK= OPENWRT_BUILD= QUIET=0
15 include $(TOPDIR)/include/verbose.mk
16 ifneq ($(VERSION),)
17 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
18 else
19 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
20 ifneq ($(REV),)
21 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
22 endif
23 endif
24 export OPENWRTVERSION
25
26 ifeq ($(FORCE),)
27 .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
28 endif
29
30 SCAN_COOKIE?=$(shell echo $$$$)
31 export SCAN_COOKIE
32
33 prepare-tmpinfo: FORCE
34 mkdir -p tmp/info
35 +$(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=4 SCAN_EXTRA=""
36 +$(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" SCAN_DEPTH=2 SCAN_EXTRA=""
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 ./scripts/metadata.pl target_mk < $(TMP_DIR)/.targetinfo > tmp/.target.mk
43 touch $(TOPDIR)/tmp/.build
44
45 .config: ./scripts/config/conf prepare-tmpinfo
46 @+if [ \! -f .config ]; then \
47 [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
48 $(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
49 fi
50
51 scripts/config/mconf:
52 @+$(MAKE) -C scripts/config all
53
54 scripts/config/conf:
55 @+$(MAKE) -C scripts/config conf
56
57 config: scripts/config/conf prepare-tmpinfo FORCE
58 $< Config.in
59
60 config-clean: FORCE
61 $(NO_TRACE_MAKE) -C scripts/config clean
62
63 defconfig: scripts/config/conf prepare-tmpinfo FORCE
64 touch .config
65 $< -D .config Config.in
66
67 oldconfig: scripts/config/conf prepare-tmpinfo FORCE
68 $< -o Config.in
69
70 menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
71 if [ \! -f .config -a -e $(HOME)/.openwrt/defconfig ]; then \
72 cp $(HOME)/.openwrt/defconfig .config; \
73 fi
74 $< Config.in
75
76 kernel_oldconfig: .config FORCE
77 $(NO_TRACE_MAKE) -C target/linux oldconfig
78
79 kernel_menuconfig: .config FORCE
80 $(NO_TRACE_MAKE) -C target/linux menuconfig
81
82 tmp/.prereq-build: include/prereq-build.mk
83 mkdir -p tmp
84 rm -f tmp/.host.mk
85 @+$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
86 echo "Prerequisite check failed. Use FORCE=1 to override."; \
87 false; \
88 }
89 touch $@
90
91 download: .config FORCE
92 $(MAKE) -j1 tools/download
93 $(MAKE) -j1 toolchain/download
94 $(MAKE) -j1 package/download
95 $(MAKE) -j1 target/download
96
97 clean dirclean:
98 @$(MAKE) $@
99
100 prereq:: .config
101 @+$(SUBMAKE) -s tmp/.prereq-build $(PREP_MK)
102 @$(NO_TRACE_MAKE) -s $@
103
104 %::
105 @+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq
106 @+$(MAKE) -r $@
107
108 help:
109 cat README
110
111 docs docs/compile: FORCE
112 $(MAKE) -C docs compile
113
114 docs/clean: FORCE
115 $(MAKE) -C docs clean
116
117 symlinkclean:
118 -find package -type l | xargs rm -f
119 rm -rf tmp
120
121 distclean:
122 rm -rf tmp build_dir staging_dir dl .config*
123
124 ifeq ($(findstring v,$(DEBUG)),)
125 .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 tmp/.prereq-target prepare-tmpinfo
126 endif
127 .PHONY: help FORCE
128 .NOTPARALLEL:
129
This page took 0.052658 seconds and 5 git commands to generate.