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