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