]> Git Repo - buildroot-mgba.git/blob - Makefile
- provide a "source-check" target that tries to download all packages with
[buildroot-mgba.git] / Makefile
1 # Makefile for buildroot2
2 #
3 # Copyright (C) 1999-2005 by Erik Andersen <[email protected]>
4 #
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.
9 #
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.
14 #
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
18 #
19
20 #--------------------------------------------------------------
21 # Just run 'make menuconfig', configure stuff, then run 'make'.
22 # You shouldn't need to mess with anything beyond this point...
23 #--------------------------------------------------------------
24 TOPDIR=./
25 CONFIG_CONFIG_IN = Config.in
26 CONFIG_DEFCONFIG = .defconfig
27 CONFIG = package/config
28
29 noconfig_targets := menuconfig config oldconfig randconfig \
30         defconfig allyesconfig allnoconfig release tags    \
31         source-check
32
33 #       $(shell find . -name *_defconfig |sed 's/.*\///')
34
35 # Pull in the user's configuration file
36 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
37 -include $(TOPDIR).config
38 endif
39
40 ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
41
42 # cc-option
43 # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
44 # sets -march=winchip-c6 if supported else falls back to -march=i586
45 # without checking the latter.
46 cc-option = $(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
47         > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
48
49
50 #############################################################
51 #
52 # Setup the proper filename extensions for the host
53 #
54 ##############################################################
55 ifneq ($(findstring linux,$(BR2_GNU_BUILD_SUFFIX)),)
56 HOST_EXEEXT:=
57 HOST_LIBEXT:=.a
58 HOST_SHREXT:=.so
59 endif
60 ifneq ($(findstring apple,$(BR2_GNU_BUILD_SUFFIX)),)
61 HOST_EXEEXT:=
62 HOST_LIBEXT:=.a
63 HOST_SHREXT:=.dylib
64 endif
65 ifneq ($(findstring cygwin,$(BR2_GNU_BUILD_SUFFIX)),)
66 HOST_EXEEXT:=.exe
67 HOST_LIBEXT:=.lib
68 HOST_SHREXT:=.dll
69 endif
70 ifneq ($(findstring mingw,$(BR2_GNU_BUILD_SUFFIX)),)
71 HOST_EXEEXT:=.exe
72 HOST_LIBEXT:=.lib
73 HOST_SHREXT:=.dll
74 endif
75
76 # The preferred type of libs we build for the target
77 ifeq ($(BR2_PREFER_STATIC_LIB),y)
78 LIBTGTEXT=.a
79 else
80 LIBTGTEXT=.so
81 endif
82
83
84 #############################################################
85 #
86 # The list of stuff to build for the target toolchain
87 # along with the packages to build for the target.
88 #
89 ##############################################################
90 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
91 TARGETS:=uclibc-configured binutils gcc uclibc-target-utils
92 else
93 TARGETS:=uclibc
94 endif
95 include toolchain/Makefile.in
96 include package/Makefile.in
97
98 #############################################################
99 #
100 # You should probably leave this stuff alone unless you know
101 # what you are doing.
102 #
103 #############################################################
104
105 all:   world
106
107 # In this section, we need .config
108 include .config.cmd
109
110 # We also need the various per-package makefiles, which also add
111 # each selected package to TARGETS if that package was selected
112 # in the .config file.
113 include toolchain/*/*.mk
114 include package/*/*.mk
115
116 # target stuff is last so it can override anything else
117 include target/Makefile.in
118
119 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
120 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
121 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
122
123 world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
124 dirs: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR)
125
126 .PHONY: all world dirs clean dirclean distclean source $(TARGETS) \
127         $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
128         $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
129
130 #############################################################
131 #
132 # staging and target directories do NOT list these as
133 # dependencies anywhere else
134 #
135 #############################################################
136 $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR):
137         @mkdir -p $@
138
139 $(STAGING_DIR):
140         @mkdir -p $(STAGING_DIR)/bin
141         @mkdir -p $(STAGING_DIR)/lib
142         @mkdir -p $(STAGING_DIR)/include
143         @mkdir -p $(STAGING_DIR)/usr
144         @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
145         @ln -snf ../include $(STAGING_DIR)/usr/include
146         @ln -snf ../lib $(STAGING_DIR)/usr/lib
147         @ln -snf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
148
149 $(TARGET_DIR):
150         mkdir -p $(TARGET_DIR)
151         if [ -d "$(TARGET_SKELETON)" ] ; then \
152                 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
153         fi;
154         touch $(STAGING_DIR)/.fakeroot.00000
155         -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
156         -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
157
158 source: $(TARGETS_SOURCE) $(HOST_SOURCE)
159
160 .config.check: dependencies
161         $(SED) '/BR2_WGET/s/\"$$/ --spider\"/g' .config
162         touch $@
163
164 _source-check: .config.check
165         $(MAKE) source
166
167 #############################################################
168 #
169 # Cleanup and misc junk
170 #
171 #############################################################
172 clean: $(TARGETS_CLEAN)
173         rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
174
175 dirclean: $(TARGETS_DIRCLEAN)
176         rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
177
178 distclean:
179 ifeq ($(DL_DIR),$(BASE_DIR)/dl)
180         rm -rf $(DL_DIR)
181 endif
182         rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
183         $(MAKE) -C $(CONFIG) clean
184
185 sourceball:
186         rm -rf $(BUILD_DIR)
187         set -e; \
188         cd ..; \
189         rm -f buildroot.tar.bz2; \
190         tar -cvf buildroot.tar buildroot; \
191         bzip2 -9 buildroot.tar; \
192
193
194 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
195
196 all: menuconfig
197
198 # configuration
199 # ---------------------------------------------------------------------------
200
201 $(CONFIG)/conf:
202         $(MAKE) -C $(CONFIG) conf
203         -@if [ ! -f .config ] ; then \
204                 cp $(CONFIG_DEFCONFIG) .config; \
205         fi
206 $(CONFIG)/mconf:
207         $(MAKE) -C $(CONFIG) ncurses conf mconf
208         -@if [ ! -f .config ] ; then \
209                 cp $(CONFIG_DEFCONFIG) .config; \
210         fi
211
212 menuconfig: $(CONFIG)/mconf
213         @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
214
215 config: $(CONFIG)/conf
216         @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
217
218 oldconfig: $(CONFIG)/conf
219         @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
220
221 randconfig: $(CONFIG)/conf
222         @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
223
224 allyesconfig: $(CONFIG)/conf
225         cp $(CONFIG_DEFCONFIG) .config
226         @$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
227         #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
228
229 allnoconfig: $(CONFIG)/conf
230         @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
231
232 defconfig: $(CONFIG)/conf
233         @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
234
235 %_defconfig: $(CONFIG)/conf
236         cp $(shell find . -name $@) .config
237         @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
238
239 # check if download URLs are outdated 
240 source-check: allyesconfig
241         $(MAKE) _source-check
242
243 #############################################################
244 #
245 # Cleanup and misc junk
246 #
247 #############################################################
248 clean:
249         rm -f .config .config.old .config.cmd .tmpconfig.h
250         - $(MAKE) -C $(CONFIG) clean
251
252 distclean: clean
253         rm -rf sources/*
254
255 endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
256
257 .PHONY: dummy subdirs release distclean clean config oldconfig \
258         menuconfig tags check test depend defconfig
259
260
This page took 0.042488 seconds and 4 git commands to generate.