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 clean distclean \
33 # Pull in the user's configuration file
34 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
35 -include $(TOPDIR).config
38 ifeq ($(BR2_TAR_VERBOSITY),y)
44 ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
46 #############################################################
48 # The list of stuff to build for the target toolchain
49 # along with the packages to build for the target.
51 ##############################################################
52 TARGETS:=host-sed kernel-headers uclibc-configured binutils gcc uclibc-target-utils
55 include toolchain/Makefile.in
56 include package/Makefile.in
58 #############################################################
60 # You should probably leave this stuff alone unless you know
63 #############################################################
69 # In this section, we need .config
72 # We also need the various per-package makefiles, which also add
73 # each selected package to TARGETS if that package was selected
74 # in the .config file.
75 include toolchain/*/*.mk
76 include package/*/*.mk
79 # target stuff is last so it can override anything else
80 include target/Makefile.in
82 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
83 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
84 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
86 world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
88 .PHONY: all world clean dirclean distclean source $(TARGETS) \
89 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
90 $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
92 #############################################################
94 # staging and target directories do NOT list these as
95 # dependancies anywhere else
97 #############################################################
102 @mkdir -p $(BUILD_DIR)
105 @mkdir -p $(TOOL_BUILD_DIR)
108 @mkdir -p $(STAGING_DIR)/lib
109 @mkdir -p $(STAGING_DIR)/include
110 @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
111 @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
114 if [ -f "$(TARGET_SKELETON)" ] ; then \
115 zcat $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \
117 if [ -d "$(TARGET_SKEL_DIR)" ] ; then \
118 cp -a $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \
120 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
121 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
123 source: $(TARGETS_SOURCE)
125 #############################################################
127 # Cleanup and misc junk
129 #############################################################
130 clean: $(TARGETS_CLEAN)
131 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
133 dirclean: $(TARGETS_DIRCLEAN)
134 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
137 rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
140 rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) $(TOOL_BUILD_DIR)
146 rm -f buildroot.tar.bz2; \
147 tar -cvf buildroot.tar buildroot; \
148 bzip2 -9 buildroot.tar; \
151 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
156 # ---------------------------------------------------------------------------
159 $(MAKE) -C $(CONFIG) conf
160 -@if [ ! -f .config ] ; then \
161 cp $(CONFIG_DEFCONFIG) .config; \
164 $(MAKE) -C $(CONFIG) ncurses conf mconf
165 -@if [ ! -f .config ] ; then \
166 cp $(CONFIG_DEFCONFIG) .config; \
169 menuconfig: $(CONFIG)/mconf
170 @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
172 config: $(CONFIG)/conf
173 @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
175 oldconfig: $(CONFIG)/conf
176 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
178 randconfig: $(CONFIG)/conf
179 @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
181 allyesconfig: $(CONFIG)/conf
182 #@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
183 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
184 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
186 allnoconfig: $(CONFIG)/conf
187 @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
189 defconfig: $(CONFIG)/conf
190 @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
192 #############################################################
194 # Cleanup and misc junk
196 #############################################################
198 - $(MAKE) -C $(CONFIG) clean
202 endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
204 .PHONY: dummy subdirs release distclean clean config oldconfig \
205 menuconfig tags check test depend