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