Change popt to experimental coding style
[openwrt.git] / openwrt / Makefile
1 # Makefile for OpenWRT
2 #
3 # Copyright (C) 2005 by Felix Fietkau <nbd@vd-s.ath.cx>
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 # Build the toolchain
53 #
54 ##############################################################
55 toolchain_install:
56 $(MAKE) -C toolchain install
57
58 ##############################################################
59 #
60 # Make all packages
61 #
62 ##############################################################
63
64 package_install: toolchain
65 $(MAKE) -C package compile install
66
67 #############################################################
68 #
69 # You should probably leave this stuff alone unless you know
70 # what you are doing.
71 #
72 #############################################################
73
74
75 # In this section, we need .config
76 include .config.cmd
77
78 world: $(DL_DIR) $(BUILD_DIR) configtest target_prepare $(TARGET_DIR) toolchain_install package_install target_install package_index
79
80 .PHONY: all world clean dirclean distclean image_clean target_clean source target_prepare target_install toolchain_install package_install configtest
81
82 configtest:
83 -cp .config .config.test
84 -scripts/configtest.pl
85
86 package_index:
87 (cd $(PACKAGE_DIR); \
88 $(STAGING_DIR)/usr/bin/ipkg-make-index . > Packages \
89 )
90
91 target_prepare:
92 $(MAKE) -C target prepare
93
94 target_install:
95 $(MAKE) -C target install
96
97 $(DL_DIR):
98 @mkdir -p $(DL_DIR)
99
100 $(BUILD_DIR):
101 @mkdir -p $(BUILD_DIR)
102
103 source: $(TARGETS_SOURCE)
104
105 #############################################################
106 #
107 # Cleanup and misc junk
108 #
109 #############################################################
110 image_clean:
111 rm -f $(STAMP_DIR)/.*-compile
112 rm -f $(STAMP_DIR)/.*-install
113 rm -rf $(BIN_DIR)
114
115 target_clean: image_clean
116 rm -rf $(TARGET_DIR)
117
118 clean: target_clean
119 @$(MAKE) -C $(CONFIG) clean
120
121 dirclean: clean
122 rm -rf $(BUILD_DIR)
123
124 distclean: clean
125 rm -rf $(STAMP_DIR) $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
126 rm -f .config* .tmpconfig.h
127
128 sourceball: distclean
129 set -e; \
130 cd ..; \
131 rm -f buildroot.tar.bz2; \
132 tar -cvf buildroot.tar buildroot; \
133 bzip2 -9 buildroot.tar; \
134
135 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
136
137 all: menuconfig
138
139 # configuration
140 # ---------------------------------------------------------------------------
141
142 $(CONFIG)/conf:
143 $(MAKE) -C $(CONFIG) conf
144 -@if [ ! -f .config ] ; then \
145 cp $(CONFIG_DEFCONFIG) .config; \
146 fi
147 $(CONFIG)/mconf:
148 $(MAKE) -C $(CONFIG)
149 -@if [ ! -f .config ] ; then \
150 cp $(CONFIG_DEFCONFIG) .config; \
151 fi
152
153 menuconfig: $(CONFIG)/mconf
154 -touch .config
155 -cp .config .config.test
156 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
157 -./scripts/configtest.pl
158
159 config: $(CONFIG)/conf
160 -touch .config
161 -cp .config .config.test
162 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
163 -./scripts/configtest.pl
164
165 oldconfig: $(CONFIG)/conf
166 -touch .config
167 -cp .config .config.test
168 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
169 -./scripts/configtest.pl
170
171 randconfig: $(CONFIG)/conf
172 -touch .config
173 -cp .config .config.test
174 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
175 -./scripts/configtest.pl
176
177 allyesconfig: $(CONFIG)/conf
178 #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
179 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
180 -touch .config
181 -cp .config .config.test
182 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
183 -./scripts/configtest.pl
184
185 allnoconfig: $(CONFIG)/conf
186 -touch .config
187 -cp .config .config.test
188 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
189 -./scripts/configtest.pl
190
191 defconfig: $(CONFIG)/conf
192 -touch .config
193 -cp .config .config.test
194 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
195 -./scripts/configtest.pl
196
197 endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
198
199 .PHONY: dummy subdirs release distclean clean config oldconfig \
200 menuconfig tags check test depend
201
This page took 0.057173 seconds and 5 git commands to generate.