cc5c5b429764caac316fe07db777c795af04c467
[openwrt.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
18 all: world
19
20 SHELL:=/usr/bin/env bash
21 export LC_ALL=C
22 export LANG=C
23 export TOPDIR=${shell pwd}
24 include $(TOPDIR)/include/verbose.mk
25
26 OPENWRTVERSION:=$(RELEASE)
27 ifneq ($(VERSION),)
28 OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
29 else
30 REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
31 ifneq ($(REV),)
32 OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
33 endif
34 endif
35 export OPENWRTVERSION
36
37 ifneq ($(shell ./scripts/timestamp.pl -p .pkginfo package Makefile),.pkginfo)
38 .pkginfo .config: FORCE
39 endif
40
41 ifeq ($(FORCE),)
42 .config scripts/config/conf scripts/config/mconf: .prereq-build
43 world: .prereq-packages
44 endif
45
46 .pkginfo:
47 @echo Collecting package info...
48 @-for dir in package/*/; do \
49 echo Source-Makefile: $${dir}Makefile; \
50 $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
51 done > $@
52
53 pkginfo-clean: FORCE
54 -rm -f .pkginfo .config.in
55
56 .config.in: .pkginfo
57 @./scripts/gen_menuconfig.pl < $< > $@ || rm -f $@
58
59 .config: ./scripts/config/conf .config.in
60 @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
61 @$< -D .config Config.in &> /dev/null
62
63 scripts/config/mconf:
64 @$(MAKE) -C scripts/config all
65
66 scripts/config/conf:
67 @$(MAKE) -C scripts/config conf
68
69 config: scripts/config/conf .config.in FORCE
70 $< Config.in
71
72 config-clean: FORCE
73 $(NO_TRACE_MAKE) -C scripts/config clean
74
75 defconfig: scripts/config/conf .config.in FORCE
76 touch .config
77 $< -D .config Config.in
78
79 oldconfig: scripts/config/conf .config.in FORCE
80 $< -o Config.in
81
82 menuconfig: scripts/config/mconf .config.in FORCE
83 $< Config.in
84
85 package/%: .pkginfo FORCE
86 $(MAKE) -C package $(patsubst package/%,%,$@)
87
88 target/%: .pkginfo FORCE
89 $(MAKE) -C target $(patsubst target/%,%,$@)
90
91 tools/%: FORCE
92 $(MAKE) -C tools $(patsubst tools/%,%,$@)
93
94 toolchain/%: FORCE
95 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
96
97 .prereq-build: include/prereq-build.mk
98 @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
99 echo "Prerequisite check failed. Use FORCE=1 to override."; \
100 rm -rf $(TOPDIR)/tmp; \
101 false; \
102 }
103 @rm -rf $(TOPDIR)/tmp
104 @touch $@
105
106 .prereq-packages: include/prereq.mk .pkginfo .config
107 @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
108 echo "Prerequisite check failed. Use FORCE=1 to override."; \
109 false; \
110 }
111 @rm -rf "$(TOPDIR)/tmp"
112 @touch $@
113
114 prereq: .prereq-build .prereq-packages FORCE
115
116 download: .config FORCE
117 $(MAKE) tools/download
118 $(MAKE) toolchain/download
119 $(MAKE) package/download
120 $(MAKE) target/download
121
122 world: .config FORCE
123 $(MAKE) tools/install
124 $(MAKE) toolchain/install
125 $(MAKE) target/compile
126 $(MAKE) package/compile
127 $(MAKE) package/install
128 $(MAKE) target/install
129 $(MAKE) package/index
130
131 clean: FORCE
132 rm -rf build_* bin
133
134 dirclean: clean
135 rm -rf staging_dir_* toolchain_build_* tool_build
136
137 distclean: dirclean config-clean
138 rm -rf dl .*config* .pkg* .prereq
139
140 .SILENT: clean dirclean distclean config-clean download world
141 FORCE: ;
142 .PHONY: FORCE
143 %: ;
This page took 0.048048 seconds and 3 git commands to generate.