1 # Makefile for buildroot2
3 # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #--------------------------------------------------------------
21 # Just run 'make menuconfig', configure stuff, then run 'make'.
22 # You shouldn't need to mess with anything beyond this point...
23 #--------------------------------------------------------------
25 CONFIG_CONFIG_IN = Config.in
26 CONFIG_DEFCONFIG = .defconfig
27 CONFIG = package/config
29 noconfig_targets := menuconfig config oldconfig randconfig \
30 defconfig allyesconfig allnoconfig release tags
32 # Pull in the user's configuration file
33 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
34 -include $(TOPDIR).config
37 ifeq ($(BR2_TAR_VERBOSITY),y)
43 ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
45 #############################################################
47 # The list of stuff to build for the target toolchain
48 # along with the packages to build for the target.
50 ##############################################################
51 TARGETS:=host-sed kernel-headers uclibc-configured binutils gcc uclibc-target-utils linux openwrt
53 include toolchain/Makefile.in
54 include package/Makefile.in
56 #############################################################
58 # You should probably leave this stuff alone unless you know
61 #############################################################
67 # In this section, we need .config
70 # We also need the various per-package makefiles, which also add
71 # each selected package to TARGETS if that package was selected
72 # in the .config file.
73 include toolchain/*/*.mk
74 include package/*/*.mk
77 # target stuff is last so it can override anything else
78 include target/Makefile.in
80 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
81 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
82 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
84 world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
87 .PHONY: all world clean dirclean distclean source $(TARGETS) \
88 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
89 $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
91 #############################################################
93 # staging and target directories do NOT list these as
94 # dependancies anywhere else
96 #############################################################
101 @mkdir -p $(BUILD_DIR)
104 @mkdir -p $(TOOL_BUILD_DIR)
107 @mkdir -p $(STAGING_DIR)/lib
108 @mkdir -p $(STAGING_DIR)/include
109 @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
110 @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
113 if [ -f "$(TARGET_SKELETON)" ] ; then \
114 zcat $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \
116 if [ -d "$(TARGET_SKEL_DIR)" ] ; then \
117 cp -a $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \
119 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
120 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
121 -ln -sf /tmp/resolv.conf $(TARGET_DIR)/etc
122 -mkdir -p $(TARGET_DIR)/jffs
124 source: $(TARGETS_SOURCE)
126 #############################################################
128 # Cleanup and misc junk
130 #############################################################
132 rm -rf $(TARGET_DIR) $(IMAGE).*
133 $(MAKE) openwrt-image-clean
135 dirclean: $(TARGETS_DIRCLEAN)
136 rm -rf $(TARGET_DIR) $(IMAGE).*
137 $(MAKE) openwrt-image-dirclean
140 rm -rf $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR)
141 rm .config* .tmpconfig.h
147 rm -f buildroot.tar.bz2; \
148 tar -cvf buildroot.tar buildroot; \
149 bzip2 -9 buildroot.tar; \
152 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
157 # ---------------------------------------------------------------------------
160 $(MAKE) -C $(CONFIG) conf
161 -@if [ ! -f .config ] ; then \
162 cp $(CONFIG_DEFCONFIG) .config; \
165 $(MAKE) -C $(CONFIG) ncurses conf mconf
166 -@if [ ! -f .config ] ; then \
167 cp $(CONFIG_DEFCONFIG) .config; \
170 menuconfig: $(CONFIG)/mconf
172 -cp .config .config.test
173 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
175 config: $(CONFIG)/conf
177 -cp .config .config.test
178 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
180 oldconfig: $(CONFIG)/conf
182 -cp .config .config.test
183 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
185 randconfig: $(CONFIG)/conf
187 -cp .config .config.test
188 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
190 allyesconfig: $(CONFIG)/conf
191 #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
192 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
194 -cp .config .config.test
195 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
197 allnoconfig: $(CONFIG)/conf
199 -cp .config .config.test
200 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
202 defconfig: $(CONFIG)/conf
204 -cp .config .config.test
205 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
207 #############################################################
209 # Cleanup and misc junk
211 #############################################################
213 @$(MAKE) -C $(CONFIG) clean
217 endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
219 .PHONY: dummy subdirs release distclean clean config oldconfig \
220 menuconfig tags check test depend