clean up console output
[openwrt-10.03/.git] / Makefile
1 # Makefile for OpenWrt
2 #
3 # Copyright (C) 2006 OpenWrt.org
4 # Copyright (C) 2006 by Felix Fietkau <openwrt@nbd.name>
5 #
6 # This is free software, licensed under the GNU General Public License v2.
7 # See /LICENSE for more information.
8 #
9
10 RELEASE:=Kamikaze
11 #VERSION:=2.0 # uncomment for final release
12
13 #--------------------------------------------------------------
14 # Just run 'make menuconfig', configure stuff, then run 'make'.
15 # You shouldn't need to mess with anything beyond this point...
16 #--------------------------------------------------------------
17 TOPDIR=${shell pwd}
18 export TOPDIR
19 include $(TOPDIR)/include/verbose.mk
20
21 OPENWRTVERSION:=$(RELEASE)
22 ifneq ($(VERSION),)
23 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
24 else
25 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
26 ifneq ($(REV),)
27 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
28 endif
29 endif
30 export OPENWRTVERSION
31
32 all: world
33
34 .pkginfo: FORCE
35 ifneq ($(shell ./scripts/timestamp.pl -p .pkginfo package Makefile),.pkginfo)
36         @echo Collecting package info...
37         @-for dir in package/*/; do \
38                 echo Source-Makefile: $${dir}Makefile; \
39                 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 2>&- || true; \
40         done > $@
41 endif
42
43 .config.in: .pkginfo
44         @./scripts/gen_menuconfig.pl < $< > $@ || rm -f $@
45
46 pkginfo-clean: FORCE
47         -rm -f .pkginfo .config.in
48
49 ./scripts/config/mconf: .config.in
50         @$(MAKE) -C scripts/config all
51
52 ./scripts/config/conf: .config.in
53         @$(MAKE) -C scripts/config conf
54
55 config: ./scripts/config/conf FORCE
56         $< Config.in
57
58 defconfig: ./scripts/config/conf FORCE
59         touch .config
60         $< -D .config Config.in
61
62 oldconfig: ./scripts/config/conf FORCE
63         $< -o Config.in
64
65 menuconfig: ./scripts/config/mconf FORCE
66         $< Config.in
67
68 config-clean: FORCE
69         $(MAKE) -C scripts/config clean
70
71 package/%: .pkginfo FORCE
72         $(MAKE) -C package $(patsubst package/%,%,$@)
73
74 target/%: .pkginfo FORCE
75         $(MAKE) -C target $(patsubst target/%,%,$@)
76
77 toolchain/%: FORCE
78         $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
79
80 .config: ./scripts/config/conf FORCE
81         @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
82         @$< -D .config Config.in &> /dev/null
83
84 .prereq: $(TOPDIR)/include/prereq.mk .pkginfo
85         @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq.mk prereq 2>/dev/null || { \
86                 echo "Prerequisite check failed. Use FORCE=1 to override."; \
87                 false; \
88         }
89         @touch $@
90
91 prereq: .prereq FORCE
92
93 download: .config FORCE
94         $(MAKE) toolchain/download
95         $(MAKE) package/download
96         $(MAKE) target/download
97
98 ifeq ($(FORCE),)
99 world: .prereq
100 endif
101
102 world: .config FORCE
103         $(MAKE) toolchain/install
104         $(MAKE) target/compile
105         $(MAKE) package/compile
106         $(MAKE) package/install
107         $(MAKE) target/install
108
109 clean: FORCE
110         rm -rf build_* bin
111
112 dirclean: clean
113         rm -rf staging_dir_* toolchain_build_*
114
115 distclean: dirclean config-clean
116         rm -rf dl .*config* .pkg* .prereq
117
118
119 .SILENT: clean dirclean distclean config-clean
120 .PHONY: FORCE
121 FORCE: