Add SNAT and DNAT targets
[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) 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
75
76 package_index:
77 (cd $(PACKAGE_DIR); \
78 $(STAGING_DIR)/usr/bin/ipkg-make-index . > Packages \
79 )
80
81 target_prepare:
82 $(MAKE) -C target prepare
83
84 target_install:
85 $(MAKE) -C target install
86
87 $(DL_DIR):
88 @mkdir -p $(DL_DIR)
89
90 $(BUILD_DIR):
91 @mkdir -p $(BUILD_DIR)
92
93 source: $(TARGETS_SOURCE)
94
95 #############################################################
96 #
97 # Cleanup and misc junk
98 #
99 #############################################################
100 image_clean:
101 rm -f $(STAMP_DIR)/.*-compile
102 rm -f $(STAMP_DIR)/.*-install
103 rm -rf $(BIN_DIR)
104
105 target_clean: image_clean
106 rm -rf $(TARGET_DIR)
107
108 clean: target_clean
109 @$(MAKE) -C $(CONFIG) clean
110
111 dirclean: clean
112 rm -rf $(STAMP_DIR)
113 $(MAKE) -C package clean
114 $(MAKE) -C target clean
115 rm -rf $(BUILD_DIR)
116
117 distclean: clean
118 rm -rf $(STAMP_DIR) $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR)
119 rm -f .config* .tmpconfig.h
120
121 sourceball: distclean
122 set -e; \
123 cd ..; \
124 rm -f buildroot.tar.bz2; \
125 tar -cvf buildroot.tar buildroot; \
126 bzip2 -9 buildroot.tar; \
127
128 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
129
130 all: menuconfig
131
132 # configuration
133 # ---------------------------------------------------------------------------
134
135 $(CONFIG)/conf:
136 $(MAKE) -C $(CONFIG) conf
137 -@if [ ! -f .config ] ; then \
138 cp $(CONFIG_DEFCONFIG) .config; \
139 fi
140 $(CONFIG)/mconf:
141 $(MAKE) -C $(CONFIG)
142 -@if [ ! -f .config ] ; then \
143 cp $(CONFIG_DEFCONFIG) .config; \
144 fi
145
146 menuconfig: $(CONFIG)/mconf
147 -touch .config
148 -cp .config .config.test
149 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
150 -./scripts/configtest.pl
151
152 config: $(CONFIG)/conf
153 -touch .config
154 -cp .config .config.test
155 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
156 -./scripts/configtest.pl
157
158 oldconfig: $(CONFIG)/conf
159 -touch .config
160 -cp .config .config.test
161 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
162 -./scripts/configtest.pl
163
164 randconfig: $(CONFIG)/conf
165 -touch .config
166 -cp .config .config.test
167 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
168 -./scripts/configtest.pl
169
170 allyesconfig: $(CONFIG)/conf
171 #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
172 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
173 -touch .config
174 -cp .config .config.test
175 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
176 -./scripts/configtest.pl
177
178 allnoconfig: $(CONFIG)/conf
179 -touch .config
180 -cp .config .config.test
181 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
182 -./scripts/configtest.pl
183
184 defconfig: $(CONFIG)/conf
185 -touch .config
186 -cp .config .config.test
187 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
188 -./scripts/configtest.pl
189
190 endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
191
192 .PHONY: dummy subdirs release distclean clean config oldconfig \
193 menuconfig tags check test depend
194
This page took 0.047832 seconds and 5 git commands to generate.