add buildroot-ng support to the whiterussian sdk
[openwrt/svn-archive/archive.git] / openwrt / Makefile
1 # Makefile for OpenWRT
2 #
3 # Copyright (C) 2005 by Felix Fietkau <openwrt@nbd.name>
4 # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #
20
21 #--------------------------------------------------------------
22 # Just run 'make menuconfig', configure stuff, then run 'make'.
23 # You shouldn't need to mess with anything beyond this point...
24 #--------------------------------------------------------------
25 TOPDIR=${shell pwd}
26 export TOPDIR
27 ifneq ($(DEVELOPER),)
28 CONFIG_CONFIG_IN = Config.in.devel
29 else
30 CONFIG_CONFIG_IN = Config.in
31 endif
32 CONFIG_DEFCONFIG = .defconfig
33 CONFIG = package/config
34
35 noconfig_targets := menuconfig config oldconfig randconfig \
36 defconfig allyesconfig allnoconfig release tags
37
38 # Pull in the user's configuration file
39 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
40 -include $(TOPDIR)/.config
41 endif
42
43 ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
44 include $(TOPDIR)/rules.mk
45
46 all: world
47
48 .NOTPARALLEL:
49
50 #############################################################
51 #
52 # You should probably leave this stuff alone unless you know
53 # what you are doing.
54 #
55 #############################################################
56
57 # In this section, we need .config
58 include .config.cmd
59
60 world: $(DL_DIR) $(BUILD_DIR) configtest toolchain/install target/compile package/compile target/install package_index
61
62 .PHONY: all world clean dirclean distclean image_clean target_clean source configtest
63
64 configtest:
65 -cp .config .config.test
66 -scripts/configtest.pl
67
68 package_index:
69 (cd $(PACKAGE_DIR); \
70 $(STAGING_DIR)/usr/bin/ipkg-make-index . > Packages \
71 )
72
73 $(DL_DIR):
74 @mkdir -p $(DL_DIR)
75
76 $(BUILD_DIR):
77 @mkdir -p $(BUILD_DIR)
78
79 source: $(TARGETS_SOURCE)
80
81
82 package/%:
83 $(MAKE) -C package $(patsubst package/%,%,$@)
84
85 target/%:
86 $(MAKE) -C target $(patsubst target/%,%,$@)
87
88 toolchain/%:
89 $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
90
91 #############################################################
92 #
93 # Cleanup and misc junk
94 #
95 #############################################################
96 image_clean:
97 rm -f $(STAMP_DIR)/.*-compile
98 rm -f $(STAMP_DIR)/.*-install
99 rm -rf $(BIN_DIR)
100
101 target_clean: image_clean
102 rm -rf $(BUILD_DIR)/linux-*/root
103
104 clean: dirclean
105 @$(MAKE) -C $(CONFIG) clean
106
107 dirclean: target_clean
108 rm -rf $(BUILD_DIR)
109
110 distclean: clean
111 rm -rf $(STAMP_DIR) $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
112 rm -f .config* .tmpconfig.h
113
114 sourceball: distclean
115 set -e; \
116 cd ..; \
117 rm -f buildroot.tar.bz2; \
118 tar -cvf buildroot.tar buildroot; \
119 bzip2 -9 buildroot.tar; \
120
121 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
122
123 all: menuconfig
124
125 # configuration
126 # ---------------------------------------------------------------------------
127
128 $(CONFIG)/conf:
129 $(MAKE) -C $(CONFIG) conf
130 -@if [ ! -f .config ] ; then \
131 cp $(CONFIG_DEFCONFIG) .config; \
132 fi
133 $(CONFIG)/mconf:
134 $(MAKE) -C $(CONFIG)
135 -@if [ ! -f .config ] ; then \
136 cp $(CONFIG_DEFCONFIG) .config; \
137 fi
138
139 menuconfig: $(CONFIG)/mconf
140 -touch .config
141 -cp .config .config.test
142 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
143 -./scripts/configtest.pl
144
145 config: $(CONFIG)/conf
146 -touch .config
147 -cp .config .config.test
148 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
149 -./scripts/configtest.pl
150
151 oldconfig: $(CONFIG)/conf
152 -touch .config
153 -cp .config .config.test
154 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
155 -./scripts/configtest.pl
156
157 randconfig: $(CONFIG)/conf
158 -touch .config
159 -cp .config .config.test
160 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
161 -./scripts/configtest.pl
162
163 allyesconfig: $(CONFIG)/conf
164 -touch .config
165 -cp .config .config.test
166 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
167 -./scripts/configtest.pl
168
169 allnoconfig: $(CONFIG)/conf
170 -touch .config
171 -cp .config .config.test
172 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
173 -./scripts/configtest.pl
174
175 defconfig: $(CONFIG)/conf
176 -touch .config
177 -cp .config .config.test
178 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
179 -./scripts/configtest.pl
180
181 endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
182
183 .PHONY: dummy subdirs release distclean clean config oldconfig \
184 menuconfig tags check test depend
185