]>
Commit | Line | Data |
---|---|---|
2d523c23 | 1 | # Makefile for buildroot2 |
ffde94bd | 2 | # |
15b26aee | 3 | # Copyright (C) 1999-2005 by Erik Andersen <[email protected]> |
ffde94bd | 4 | # |
08782ae7 | 5 | # This program is free software; you can redistribute it and/or modify |
2d523c23 EA |
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. | |
ffde94bd | 9 | # |
2d523c23 EA |
10 | # This program is distributed in the hope that it will be useful, |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
08782ae7 | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2d523c23 | 13 | # General Public License for more details. |
ffde94bd | 14 | # |
2d523c23 EA |
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 | |
3ad3d8a1 | 18 | # |
02bf5816 | 19 | |
2d523c23 EA |
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 | |
a0aef7c4 | 28 | |
2d523c23 | 29 | noconfig_targets := menuconfig config oldconfig randconfig \ |
0c1e709e | 30 | defconfig allyesconfig allnoconfig release tags \ |
825ff341 | 31 | source-check |
9e250356 BRF |
32 | |
33 | # $(shell find . -name *_defconfig |sed 's/.*\///') | |
cad58108 | 34 | |
2d523c23 EA |
35 | # Pull in the user's configuration file |
36 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) | |
37 | -include $(TOPDIR).config | |
38 | endif | |
9741a49e | 39 | |
2d523c23 | 40 | ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) |
54e098e4 | 41 | |
99cf7293 BRF |
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 | ||
2c649045 PK |
49 | ############################################################# |
50 | # | |
51 | # Hide troublesome environment variables from sub processes | |
52 | # | |
53 | ############################################################# | |
54 | unexport CROSS_COMPILE | |
55 | unexport ARCH | |
27bc59d4 | 56 | |
08782ae7 EA |
57 | ############################################################# |
58 | # | |
c6e43c9d | 59 | # Setup the proper filename extensions for the host |
08782ae7 | 60 | # |
7dcbbfbb BRF |
61 | ############################################################## |
62 | ifneq ($(findstring linux,$(BR2_GNU_BUILD_SUFFIX)),) | |
c6e43c9d BRF |
63 | HOST_EXEEXT:= |
64 | HOST_LIBEXT:=.a | |
65 | HOST_SHREXT:=.so | |
3096f34d | 66 | endif |
7dcbbfbb | 67 | ifneq ($(findstring apple,$(BR2_GNU_BUILD_SUFFIX)),) |
c6e43c9d BRF |
68 | HOST_EXEEXT:= |
69 | HOST_LIBEXT:=.a | |
70 | HOST_SHREXT:=.dylib | |
3096f34d | 71 | endif |
7dcbbfbb | 72 | ifneq ($(findstring cygwin,$(BR2_GNU_BUILD_SUFFIX)),) |
c6e43c9d BRF |
73 | HOST_EXEEXT:=.exe |
74 | HOST_LIBEXT:=.lib | |
75 | HOST_SHREXT:=.dll | |
3096f34d | 76 | endif |
7dcbbfbb | 77 | ifneq ($(findstring mingw,$(BR2_GNU_BUILD_SUFFIX)),) |
c6e43c9d BRF |
78 | HOST_EXEEXT:=.exe |
79 | HOST_LIBEXT:=.lib | |
80 | HOST_SHREXT:=.dll | |
3096f34d | 81 | endif |
cb7d5b81 | 82 | |
c6e43c9d | 83 | # The preferred type of libs we build for the target |
3096f34d | 84 | ifeq ($(BR2_PREFER_STATIC_LIB),y) |
c6e43c9d | 85 | LIBTGTEXT=.a |
8027784c | 86 | #PREFERRED_LIB_FLAGS:=--disable-shared --enable-static |
3096f34d | 87 | else |
c6e43c9d | 88 | LIBTGTEXT=.so |
8027784c | 89 | #PREFERRED_LIB_FLAGS:=--disable-static --enable-shared |
3096f34d | 90 | endif |
8027784c | 91 | PREFERRED_LIB_FLAGS:=--enable-static --enable-shared |
ffde94bd | 92 | |
7dcbbfbb | 93 | |
7dcbbfbb BRF |
94 | ############################################################# |
95 | # | |
96 | # The list of stuff to build for the target toolchain | |
97 | # along with the packages to build for the target. | |
98 | # | |
99 | ############################################################## | |
100 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) | |
101 | TARGETS:=uclibc-configured binutils gcc uclibc-target-utils | |
102 | else | |
103 | TARGETS:=uclibc | |
104 | endif | |
105 | include toolchain/Makefile.in | |
106 | include package/Makefile.in | |
107 | ||
108 | ############################################################# | |
109 | # | |
110 | # You should probably leave this stuff alone unless you know | |
111 | # what you are doing. | |
112 | # | |
113 | ############################################################# | |
114 | ||
08782ae7 | 115 | all: world |
ffde94bd | 116 | |
2d523c23 EA |
117 | # In this section, we need .config |
118 | include .config.cmd | |
119 | ||
d06645d8 EA |
120 | # We also need the various per-package makefiles, which also add |
121 | # each selected package to TARGETS if that package was selected | |
122 | # in the .config file. | |
123 | include toolchain/*/*.mk | |
124 | include package/*/*.mk | |
d06645d8 | 125 | |
79f5f1e8 EA |
126 | # target stuff is last so it can override anything else |
127 | include target/Makefile.in | |
128 | ||
08782ae7 | 129 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
a5c23541 | 130 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
08782ae7 | 131 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
ffde94bd | 132 | |
6e2823c1 | 133 | world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS) |
870cb9e8 | 134 | dirs: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) |
ffde94bd | 135 | |
870cb9e8 | 136 | .PHONY: all world dirs clean dirclean distclean source $(TARGETS) \ |
747b16dd EA |
137 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
138 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) | |
ffde94bd | 139 | |
08782ae7 EA |
140 | ############################################################# |
141 | # | |
ef407d3d | 142 | # staging and target directories do NOT list these as |
d99c31c6 | 143 | # dependencies anywhere else |
08782ae7 EA |
144 | # |
145 | ############################################################# | |
8d583fc0 BRF |
146 | $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR): |
147 | @mkdir -p $@ | |
3ad3d8a1 | 148 | |
08782ae7 | 149 | $(STAGING_DIR): |
9c865d75 | 150 | @mkdir -p $(STAGING_DIR)/bin |
bf38723f | 151 | @mkdir -p $(STAGING_DIR)/lib |
7e0c890c | 152 | ifeq ($(BR2_TOOLCHAIN_SYSROOT),y) |
8027784c BRF |
153 | @mkdir -p $(STAGING_DIR)/usr/lib |
154 | else | |
155 | @ln -snf . $(STAGING_DIR)/usr | |
156 | @mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME) | |
3da708e4 | 157 | @ln -snf ../lib $(STAGING_DIR)/usr/lib |
8027784c BRF |
158 | @ln -snf ../lib $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib |
159 | endif | |
160 | @mkdir -p $(STAGING_DIR)/usr/include | |
ffde94bd | 161 | |
08782ae7 | 162 | $(TARGET_DIR): |
a4c685f1 | 163 | mkdir -p $(TARGET_DIR) |
ba70f94e EA |
164 | if [ -d "$(TARGET_SKELETON)" ] ; then \ |
165 | cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \ | |
bb15c221 | 166 | fi; |
5418a923 | 167 | touch $(STAGING_DIR)/.fakeroot.00000 |
bb15c221 EA |
168 | -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf |
169 | -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf | |
08782ae7 | 170 | |
73be7f9e | 171 | source: $(TARGETS_SOURCE) $(HOST_SOURCE) |
08782ae7 | 172 | |
825ff341 BRF |
173 | .config.check: dependencies |
174 | $(SED) '/BR2_WGET/s/\"$$/ --spider\"/g' .config | |
175 | touch $@ | |
176 | ||
177 | _source-check: .config.check | |
178 | $(MAKE) source | |
179 | ||
08782ae7 EA |
180 | ############################################################# |
181 | # | |
182 | # Cleanup and misc junk | |
183 | # | |
184 | ############################################################# | |
185 | clean: $(TARGETS_CLEAN) | |
3ad3d8a1 | 186 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE) |
08782ae7 EA |
187 | |
188 | dirclean: $(TARGETS_DIRCLEAN) | |
3ad3d8a1 | 189 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE) |
08782ae7 EA |
190 | |
191 | distclean: | |
5bc1f0c3 MF |
192 | ifeq ($(DL_DIR),$(BASE_DIR)/dl) |
193 | rm -rf $(DL_DIR) | |
194 | endif | |
195 | rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) | |
b5136193 | 196 | $(MAKE) -C $(CONFIG) clean |
08782ae7 | 197 | |
3ad3d8a1 | 198 | sourceball: |
08782ae7 EA |
199 | rm -rf $(BUILD_DIR) |
200 | set -e; \ | |
201 | cd ..; \ | |
202 | rm -f buildroot.tar.bz2; \ | |
203 | tar -cvf buildroot.tar buildroot; \ | |
204 | bzip2 -9 buildroot.tar; \ | |
2d523c23 EA |
205 | |
206 | ||
207 | else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) | |
208 | ||
209 | all: menuconfig | |
210 | ||
211 | # configuration | |
212 | # --------------------------------------------------------------------------- | |
213 | ||
214 | $(CONFIG)/conf: | |
215 | $(MAKE) -C $(CONFIG) conf | |
216 | -@if [ ! -f .config ] ; then \ | |
217 | cp $(CONFIG_DEFCONFIG) .config; \ | |
218 | fi | |
219 | $(CONFIG)/mconf: | |
220 | $(MAKE) -C $(CONFIG) ncurses conf mconf | |
221 | -@if [ ! -f .config ] ; then \ | |
222 | cp $(CONFIG_DEFCONFIG) .config; \ | |
223 | fi | |
224 | ||
225 | menuconfig: $(CONFIG)/mconf | |
226 | @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) | |
227 | ||
228 | config: $(CONFIG)/conf | |
229 | @$(CONFIG)/conf $(CONFIG_CONFIG_IN) | |
230 | ||
231 | oldconfig: $(CONFIG)/conf | |
232 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) | |
233 | ||
234 | randconfig: $(CONFIG)/conf | |
235 | @$(CONFIG)/conf -r $(CONFIG_CONFIG_IN) | |
236 | ||
237 | allyesconfig: $(CONFIG)/conf | |
825ff341 BRF |
238 | cp $(CONFIG_DEFCONFIG) .config |
239 | @$(CONFIG)/conf -y $(CONFIG_CONFIG_IN) | |
2d523c23 | 240 | #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config |
2d523c23 EA |
241 | |
242 | allnoconfig: $(CONFIG)/conf | |
243 | @$(CONFIG)/conf -n $(CONFIG_CONFIG_IN) | |
244 | ||
245 | defconfig: $(CONFIG)/conf | |
246 | @$(CONFIG)/conf -d $(CONFIG_CONFIG_IN) | |
247 | ||
825ff341 BRF |
248 | # check if download URLs are outdated |
249 | source-check: allyesconfig | |
250 | $(MAKE) _source-check | |
251 | ||
2d523c23 EA |
252 | ############################################################# |
253 | # | |
254 | # Cleanup and misc junk | |
255 | # | |
256 | ############################################################# | |
257 | clean: | |
258 | rm -f .config .config.old .config.cmd .tmpconfig.h | |
259 | - $(MAKE) -C $(CONFIG) clean | |
260 | ||
261 | distclean: clean | |
262 | rm -rf sources/* | |
263 | ||
264 | endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y) | |
265 | ||
ba2e7e02 BRF |
266 | %_defconfig: $(CONFIG)/conf |
267 | cp $(shell find ./target/ -name $@) .config | |
268 | @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN) | |
269 | ||
270 | ||
2d523c23 | 271 | .PHONY: dummy subdirs release distclean clean config oldconfig \ |
f3ccf319 | 272 | menuconfig tags check test depend defconfig |
2d523c23 EA |
273 | |
274 |