]>
Commit | Line | Data |
---|---|---|
2d523c23 | 1 | # Makefile for buildroot2 |
ffde94bd | 2 | # |
15b26aee | 3 | # Copyright (C) 1999-2005 by Erik Andersen <[email protected]> |
eb057575 | 4 | # Copyright (C) 2006-2010 by the Buildroot developers <[email protected]> |
ffde94bd | 5 | # |
08782ae7 | 6 | # This program is free software; you can redistribute it and/or modify |
2d523c23 EA |
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. | |
ffde94bd | 10 | # |
2d523c23 EA |
11 | # This program is distributed in the hope that it will be useful, |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
08782ae7 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2d523c23 | 14 | # General Public License for more details. |
b30d673c | 15 | # |
2d523c23 EA |
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 | |
3ad3d8a1 | 19 | # |
02bf5816 | 20 | |
2d523c23 EA |
21 | #-------------------------------------------------------------- |
22 | # Just run 'make menuconfig', configure stuff, then run 'make'. | |
23 | # You shouldn't need to mess with anything beyond this point... | |
24 | #-------------------------------------------------------------- | |
2d239bbe | 25 | |
e5e8fae8 YM |
26 | # Set and export the version string |
27 | export BR2_VERSION:=2010.11-git | |
28 | ||
2d239bbe YM |
29 | # This top-level Makefile can *not* be executed in parallel |
30 | .NOTPARALLEL: | |
31 | ||
6b1dd45b PK |
32 | # absolute path |
33 | TOPDIR:=$(shell pwd) | |
18d979c7 | 34 | CONFIG_CONFIG_IN=Config.in |
18d979c7 | 35 | CONFIG=package/config |
a8ee1240 | 36 | DATE:=$(shell date +%Y%m%d) |
a0aef7c4 | 37 | |
8258df27 YM |
38 | # Compute the full local version string so packages can use it as-is |
39 | # Need to export it, so it can be got from environment in children (eg. mconf) | |
40 | export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/scripts/setlocalversion) | |
41 | ||
8b6585a9 | 42 | noconfig_targets:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \ |
0b368800 | 43 | defconfig %_defconfig savedefconfig allyesconfig allnoconfig silentoldconfig release \ |
6652770f | 44 | randpackageconfig allyespackageconfig allnopackageconfig \ |
e491fba2 | 45 | source-check help |
9e250356 | 46 | |
580c6d9b TP |
47 | # Strip quotes and then whitespaces |
48 | qstrip=$(strip $(subst ",,$(1))) | |
49 | #")) | |
50 | ||
f85f2de1 PK |
51 | # Variables for use in Make constructs |
52 | comma:=, | |
53 | empty:= | |
54 | space:=$(empty) $(empty) | |
55 | ||
39ca6d50 WW |
56 | ifneq ("$(origin O)", "command line") |
57 | O:=output | |
58 | CONFIG_DIR:=$(TOPDIR) | |
aefad531 | 59 | NEED_WRAPPER= |
39ca6d50 WW |
60 | else |
61 | # other packages might also support Linux-style out of tree builds | |
62 | # with the O=<dir> syntax (E.G. Busybox does). As make automatically | |
63 | # forwards command line variable definitions those packages get very | |
64 | # confused. Fix this by telling make to not do so | |
65 | MAKEOVERRIDES = | |
66 | # strangely enough O is still passed to submakes with MAKEOVERRIDES | |
67 | # (with make 3.81 atleast), the only thing that changes is the output | |
68 | # of the origin function (command line -> environment). | |
69 | # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+) | |
70 | # To really make O go away, we have to override it. | |
71 | override O:=$(O) | |
72 | CONFIG_DIR:=$(O) | |
de846f6e PK |
73 | # we need to pass O= everywhere we call back into the toplevel makefile |
74 | EXTRAMAKEARGS = O=$(O) | |
aefad531 | 75 | NEED_WRAPPER=y |
39ca6d50 WW |
76 | endif |
77 | ||
a1b0651a US |
78 | # $(shell find . -name *_defconfig |sed 's/.*\///') |
79 | # Pull in the user's configuration file | |
80 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) | |
39ca6d50 | 81 | -include $(CONFIG_DIR)/.config |
7521f373 | 82 | endif |
9741a49e | 83 | |
efd8576c US |
84 | # Override BR2_DL_DIR if shell variable defined |
85 | ifneq ($(BUILDROOT_DL_DIR),) | |
86 | BR2_DL_DIR:=$(BUILDROOT_DL_DIR) | |
87 | endif | |
efd8576c | 88 | |
afc61c6e BRF |
89 | # To put more focus on warnings, be less verbose as default |
90 | # Use 'make V=1' to see the full commands | |
91 | ifdef V | |
92 | ifeq ("$(origin V)", "command line") | |
18d979c7 | 93 | KBUILD_VERBOSE=$(V) |
afc61c6e BRF |
94 | endif |
95 | endif | |
96 | ifndef KBUILD_VERBOSE | |
18d979c7 | 97 | KBUILD_VERBOSE=0 |
afc61c6e BRF |
98 | endif |
99 | ||
100 | ifeq ($(KBUILD_VERBOSE),1) | |
4df454e9 | 101 | quiet= |
18d979c7 | 102 | Q= |
1669b6ed BRF |
103 | ifndef VERBOSE |
104 | VERBOSE=1 | |
105 | endif | |
afc61c6e BRF |
106 | else |
107 | quiet=quiet_ | |
18d979c7 | 108 | Q=@ |
afc61c6e BRF |
109 | endif |
110 | ||
69f85924 PK |
111 | # we want bash as shell |
112 | SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | |
afc61c6e | 113 | else if [ -x /bin/bash ]; then echo /bin/bash; \ |
18d979c7 | 114 | else echo sh; fi; fi) |
afc61c6e | 115 | |
69f85924 PK |
116 | # kconfig uses CONFIG_SHELL |
117 | CONFIG_SHELL:=$(SHELL) | |
118 | ||
119 | export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE | |
afc61c6e BRF |
120 | |
121 | ifndef HOSTAR | |
122 | HOSTAR:=ar | |
123 | endif | |
124 | ifndef HOSTAS | |
125 | HOSTAS:=as | |
126 | endif | |
127 | ifndef HOSTCC | |
128 | HOSTCC:=gcc | |
129 | else | |
130 | endif | |
131 | ifndef HOSTCXX | |
132 | HOSTCXX:=g++ | |
133 | endif | |
5f97580e BRF |
134 | ifndef HOSTFC |
135 | HOSTFC:=gfortran | |
136 | endif | |
356133b4 US |
137 | ifndef HOSTCPP |
138 | HOSTCPP:=cpp | |
139 | endif | |
afc61c6e BRF |
140 | ifndef HOSTLD |
141 | HOSTLD:=ld | |
142 | endif | |
0f9c5b11 US |
143 | ifndef HOSTLN |
144 | HOSTLN:=ln | |
145 | endif | |
356133b4 US |
146 | ifndef HOSTNM |
147 | HOSTNM:=nm | |
148 | endif | |
69f85924 PK |
149 | HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar) |
150 | HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as) | |
151 | HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc) | |
152 | HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++) | |
153 | HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran) | |
154 | HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp) | |
155 | HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld) | |
156 | HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln) | |
157 | HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm) | |
54e93328 | 158 | |
5f97580e | 159 | export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD |
afc61c6e | 160 | |
39ca6d50 WW |
161 | # bash prints the name of the directory on 'cd <dir>' if CDPATH is |
162 | # set, so unset it here to not cause problems. Notice that the export | |
163 | # line doesn't affect the environment of $(shell ..) calls, so | |
164 | # explictly throw away any output from 'cd' here. | |
165 | export CDPATH:= | |
166 | BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd) | |
167 | $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist)) | |
168 | ||
169 | BUILD_DIR:=$(BASE_DIR)/build | |
170 | ||
afc61c6e | 171 | |
cfe511b2 | 172 | ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
54e098e4 | 173 | |
99cf7293 | 174 | # cc-option |
18d979c7 | 175 | # Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586) |
99cf7293 BRF |
176 | # sets -march=winchip-c6 if supported else falls back to -march=i586 |
177 | # without checking the latter. | |
18d979c7 | 178 | cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ |
99cf7293 BRF |
179 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) |
180 | ||
2c649045 PK |
181 | ############################################################# |
182 | # | |
183 | # Hide troublesome environment variables from sub processes | |
184 | # | |
185 | ############################################################# | |
186 | unexport CROSS_COMPILE | |
187 | unexport ARCH | |
27bc59d4 | 188 | |
c71816a8 | 189 | GNU_HOST_NAME:=$(shell package/gnuconfig/config.guess) |
60281cbf | 190 | |
08782ae7 EA |
191 | ############################################################# |
192 | # | |
c6e43c9d | 193 | # Setup the proper filename extensions for the host |
08782ae7 | 194 | # |
7dcbbfbb | 195 | ############################################################## |
60281cbf | 196 | ifneq ($(findstring linux,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
197 | HOST_EXEEXT:= |
198 | HOST_LIBEXT:=.a | |
199 | HOST_SHREXT:=.so | |
3096f34d | 200 | endif |
60281cbf | 201 | ifneq ($(findstring apple,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
202 | HOST_EXEEXT:= |
203 | HOST_LIBEXT:=.a | |
204 | HOST_SHREXT:=.dylib | |
3096f34d | 205 | endif |
60281cbf | 206 | ifneq ($(findstring cygwin,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
207 | HOST_EXEEXT:=.exe |
208 | HOST_LIBEXT:=.lib | |
209 | HOST_SHREXT:=.dll | |
2c279671 PK |
210 | HOST_LOADLIBES="-lcurses -lintl" |
211 | export HOST_LOADLIBES | |
3096f34d | 212 | endif |
60281cbf | 213 | ifneq ($(findstring mingw,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
214 | HOST_EXEEXT:=.exe |
215 | HOST_LIBEXT:=.lib | |
216 | HOST_SHREXT:=.dll | |
3096f34d | 217 | endif |
cb7d5b81 | 218 | |
c6e43c9d | 219 | # The preferred type of libs we build for the target |
3096f34d | 220 | ifeq ($(BR2_PREFER_STATIC_LIB),y) |
c6e43c9d | 221 | LIBTGTEXT=.a |
8027784c | 222 | #PREFERRED_LIB_FLAGS:=--disable-shared --enable-static |
3096f34d | 223 | else |
c6e43c9d | 224 | LIBTGTEXT=.so |
8027784c | 225 | #PREFERRED_LIB_FLAGS:=--disable-static --enable-shared |
3096f34d | 226 | endif |
8027784c | 227 | PREFERRED_LIB_FLAGS:=--enable-static --enable-shared |
ffde94bd | 228 | |
6ad07203 | 229 | ############################################################## |
7dcbbfbb BRF |
230 | # |
231 | # The list of stuff to build for the target toolchain | |
232 | # along with the packages to build for the target. | |
233 | # | |
234 | ############################################################## | |
bc994c53 | 235 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) |
3d8919a1 | 236 | BASE_TARGETS:=uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers |
10c1eec2 | 237 | else |
51f5f627 | 238 | BASE_TARGETS:=uclibc |
7dcbbfbb | 239 | endif |
acc706b7 BRF |
240 | TARGETS:= |
241 | ||
89464a96 PK |
242 | # silent mode requested? |
243 | QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q) | |
244 | ||
397fe5cc TP |
245 | # Strip off the annoying quoting |
246 | ARCH:=$(call qstrip,$(BR2_ARCH)) | |
247 | ifeq ($(ARCH),xtensa) | |
248 | ARCH:=$(ARCH)_$(call qstrip,$(BR2_xtensa_core_name)) | |
249 | endif | |
65e80a0b | 250 | |
891973f5 PK |
251 | KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \ |
252 | -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |
253 | -e s/arm.*/arm/ -e s/sa110/arm/ \ | |
254 | -e s/parisc64/parisc/ \ | |
255 | -e s/powerpc64/powerpc/ \ | |
256 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ | |
257 | -e s/sh.*/sh/) | |
258 | ||
397fe5cc TP |
259 | ZCAT:=$(call qstrip,$(BR2_ZCAT)) |
260 | BZCAT:=$(call qstrip,$(BR2_BZCAT)) | |
261 | TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf | |
262 | ||
397fe5cc TP |
263 | GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX)) |
264 | ||
265 | STAGING_DIR:=$(call qstrip,$(BR2_STAGING_DIR)) | |
266 | ||
267 | # packages compiled for the host goes here | |
3b2a803d | 268 | HOST_DIR:=$(BASE_DIR)/host |
397fe5cc TP |
269 | |
270 | # stamp (dependency) files go here | |
3b2a803d | 271 | STAMP_DIR:=$(BASE_DIR)/stamps |
397fe5cc | 272 | |
3b2a803d TP |
273 | BINARIES_DIR:=$(BASE_DIR)/images |
274 | TARGET_DIR:=$(BASE_DIR)/target | |
4c5bf461 | 275 | TOOLCHAIN_DIR=$(BASE_DIR)/toolchain |
fbc22eca | 276 | TARGET_SKELETON=$(TOPDIR)/fs/skeleton |
397fe5cc | 277 | |
397fe5cc | 278 | BR2_DEPENDS_DIR=$(BUILD_DIR)/buildroot-config |
1dbe6e33 | 279 | |
7dcbbfbb BRF |
280 | include toolchain/Makefile.in |
281 | include package/Makefile.in | |
282 | ||
283 | ############################################################# | |
284 | # | |
285 | # You should probably leave this stuff alone unless you know | |
286 | # what you are doing. | |
287 | # | |
288 | ############################################################# | |
289 | ||
6547bced | 290 | all: world |
ffde94bd | 291 | |
2d523c23 | 292 | # In this section, we need .config |
2691d808 | 293 | -include $(CONFIG_DIR)/.config.cmd |
2d523c23 | 294 | |
d06645d8 EA |
295 | # We also need the various per-package makefiles, which also add |
296 | # each selected package to TARGETS if that package was selected | |
297 | # in the .config file. | |
bc994c53 | 298 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) |
ed020099 | 299 | include toolchain/toolchain-buildroot.mk |
26b44b2b | 300 | else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) |
ed020099 | 301 | include toolchain/toolchain-external.mk |
10c1eec2 YM |
302 | else ifeq ($(BR2_TOOLCHAIN_CTNG),y) |
303 | include toolchain/toolchain-crosstool-ng.mk | |
acc706b7 BRF |
304 | endif |
305 | ||
d06645d8 | 306 | include package/*/*.mk |
d06645d8 | 307 | |
32faf351 | 308 | TARGETS+=target-finalize |
d45de0ca | 309 | |
b87b4742 PK |
310 | ifeq ($(BR2_ENABLE_LOCALE_PURGE),y) |
311 | TARGETS+=target-purgelocales | |
312 | endif | |
313 | ||
649b5b92 | 314 | include boot/common.mk |
79f5f1e8 | 315 | include target/Makefile.in |
487e21cf | 316 | include linux/linux.mk |
649b5b92 | 317 | include fs/common.mk |
79f5f1e8 | 318 | |
02a623dd | 319 | TARGETS+=erase-fakeroots |
c2fc93bc | 320 | |
08782ae7 | 321 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
3b08e64d | 322 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS)) |
08782ae7 | 323 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
b3efde23 | 324 | TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS)) |
acc706b7 | 325 | # all targets depend on the crosscompiler and it's prerequisites |
b3efde23 | 326 | $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) % |
acc706b7 | 327 | |
cb5710c5 | 328 | dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ |
397fe5cc | 329 | $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR) |
f958d897 | 330 | |
5ef9e52b | 331 | $(BASE_TARGETS): dirs |
f958d897 | 332 | |
0b368800 TP |
333 | $(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config |
334 | $(MAKE) $(EXTRAMAKEARGS) silentoldconfig | |
335 | ||
336 | prepare: $(BUILD_DIR)/buildroot-config/auto.conf | |
337 | ||
338 | world: prepare dependencies dirs $(BASE_TARGETS) $(TARGETS_ALL) | |
ffde94bd | 339 | |
5ef9e52b | 340 | |
aefad531 | 341 | .PHONY: all world dirs clean distclean source outputmakefile \ |
b3efde23 | 342 | $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \ |
747b16dd | 343 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
cb5710c5 | 344 | $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ |
397fe5cc | 345 | $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR) |
ffde94bd | 346 | |
08782ae7 EA |
347 | ############################################################# |
348 | # | |
ef407d3d | 349 | # staging and target directories do NOT list these as |
d99c31c6 | 350 | # dependencies anywhere else |
08782ae7 EA |
351 | # |
352 | ############################################################# | |
cb5710c5 | 353 | $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR): |
8d583fc0 | 354 | @mkdir -p $@ |
3ad3d8a1 | 355 | |
08782ae7 | 356 | $(STAGING_DIR): |
9c865d75 | 357 | @mkdir -p $(STAGING_DIR)/bin |
bf38723f | 358 | @mkdir -p $(STAGING_DIR)/lib |
8027784c | 359 | @mkdir -p $(STAGING_DIR)/usr/lib |
8027784c | 360 | @mkdir -p $(STAGING_DIR)/usr/include |
a05c337d | 361 | @mkdir -p $(STAGING_DIR)/usr/bin |
ffde94bd | 362 | |
2b3a43f4 DM |
363 | ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y) |
364 | TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH) | |
365 | endif | |
366 | ||
397fe5cc | 367 | $(BUILD_DIR)/.root: |
7547c7eb | 368 | mkdir -p $(TARGET_DIR) |
f0ca4b82 BRF |
369 | if ! [ -d "$(TARGET_DIR)/bin" ]; then \ |
370 | if [ -d "$(TARGET_SKELETON)" ]; then \ | |
18d979c7 | 371 | cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \ |
74cda1e4 | 372 | fi; \ |
edb5ca9c MG |
373 | if [ -d "$(TARGET_SKELETON_PATCH)" ]; then \ |
374 | toolchain/patch-kernel.sh $(TARGET_DIR) $(TARGET_SKELETON_PATCH)/ \*patch\*; \ | |
375 | fi; \ | |
18d979c7 | 376 | touch $(STAGING_DIR)/.fakeroot.00000; \ |
f0ca4b82 | 377 | fi |
fc3eb18b | 378 | -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf |
b9656e81 | 379 | -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf |
7547c7eb | 380 | touch $@ |
08782ae7 | 381 | |
397fe5cc | 382 | $(TARGET_DIR): $(BUILD_DIR)/.root |
c6771dfb | 383 | |
c2fc93bc | 384 | erase-fakeroots: |
397fe5cc | 385 | rm -f $(BUILD_DIR)/.fakeroot* |
412ca2a4 | 386 | |
32faf351 | 387 | target-finalize: |
d45de0ca JV |
388 | ifeq ($(BR2_HAVE_DEVFILES),y) |
389 | ( scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) ) | |
bc67ca29 | 390 | else |
bea9e43f | 391 | rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/aclocal |
027aa1d2 WB |
392 | find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f |
393 | find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f | |
bc67ca29 | 394 | endif |
e48a72e5 MS |
395 | ifneq ($(BR2_PACKAGE_GDB),y) |
396 | rm -rf $(TARGET_DIR)/usr/share/gdb | |
397 | endif | |
87b0637b | 398 | ifneq ($(BR2_HAVE_DOCUMENTATION),y) |
32faf351 | 399 | rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man |
32faf351 | 400 | rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info |
87b0637b | 401 | rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc |
d701a823 | 402 | rm -rf $(TARGET_DIR)/usr/share/gtk-doc |
32faf351 PK |
403 | endif |
404 | find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true | |
4ccde7fa TP |
405 | mkdir -p $(TARGET_DIR)/etc |
406 | # Mandatory configuration file and auxilliary cache directory | |
407 | # for recent versions of ldconfig | |
408 | touch $(TARGET_DIR)/etc/ld.so.conf | |
409 | mkdir -p $(TARGET_DIR)/var/cache/ldconfig | |
e49e2fed PK |
410 | if [ -x "$(TARGET_CROSS)ldconfig" ]; \ |
411 | then \ | |
4ccde7fa | 412 | $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \ |
e49e2fed | 413 | else \ |
4ccde7fa | 414 | /sbin/ldconfig -r $(TARGET_DIR); \ |
e49e2fed | 415 | fi |
cb15bf8d | 416 | echo $(BR2_VERSION_FULL) > $(TARGET_DIR)/etc/br-version |
912ea81a | 417 | |
eed7d873 DM |
418 | ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"") |
419 | $(BR2_ROOTFS_POST_BUILD_SCRIPT) $(TARGET_DIR) | |
420 | endif | |
421 | ||
b87b4742 | 422 | ifeq ($(BR2_ENABLE_LOCALE_PURGE),y) |
397fe5cc | 423 | LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge |
6cdf2481 | 424 | LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST)) |
b87b4742 PK |
425 | |
426 | target-purgelocales: | |
427 | rm -f $(LOCALE_WHITELIST) | |
428 | for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done | |
429 | ||
430 | for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \ | |
431 | do \ | |
432 | for lang in $$(cd $$dir; ls .|grep -v man); \ | |
433 | do \ | |
434 | grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \ | |
435 | done; \ | |
436 | done | |
437 | endif | |
438 | ||
3b08e64d | 439 | source: $(TARGETS_SOURCE) $(HOST_SOURCE) |
08782ae7 | 440 | |
6547bced | 441 | _source-check: |
d147b81f | 442 | $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source |
825ff341 | 443 | |
155971e0 | 444 | external-deps: |
d147b81f | 445 | @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source |
155971e0 | 446 | |
b7d6c8ad TP |
447 | show-targets: |
448 | @echo $(TARGETS) | |
449 | ||
cfe511b2 | 450 | else # ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
2d523c23 EA |
451 | |
452 | all: menuconfig | |
453 | ||
454 | # configuration | |
455 | # --------------------------------------------------------------------------- | |
456 | ||
c0d7d4e0 BRF |
457 | HOSTCFLAGS=$(CFLAGS_FOR_BUILD) |
458 | export HOSTCFLAGS | |
459 | ||
2cc210c9 PK |
460 | $(BUILD_DIR)/buildroot-config/%onf: |
461 | mkdir -p $(@D)/lxdialog | |
7c524dd0 | 462 | $(MAKE) CC="$(HOSTCC)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) |
2d523c23 | 463 | |
1039eb74 TP |
464 | COMMON_CONFIG_ENV = \ |
465 | KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \ | |
466 | KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \ | |
0b368800 | 467 | KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \ |
1039eb74 | 468 | BUILDROOT_CONFIG=$(CONFIG_DIR)/.config |
2d523c23 | 469 | |
aefad531 | 470 | xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile |
39ca6d50 | 471 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 472 | @if ! $(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN); then \ |
39ca6d50 | 473 | test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \ |
b0df9df3 AY |
474 | fi |
475 | ||
aefad531 | 476 | gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile |
39ca6d50 | 477 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 TP |
478 | @if ! $(COMMON_CONFIG_ENV) srctree=$(TOPDIR) \ |
479 | $< $(CONFIG_CONFIG_IN); then \ | |
39ca6d50 | 480 | test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \ |
2b42aae7 PK |
481 | fi |
482 | ||
aefad531 | 483 | menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile |
39ca6d50 | 484 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 485 | @if ! $(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN); then \ |
39ca6d50 | 486 | test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \ |
153b1bea | 487 | fi |
2d523c23 | 488 | |
aefad531 | 489 | nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile |
8b6585a9 | 490 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 491 | @if ! $(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN); then \ |
39ca6d50 | 492 | test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \ |
153b1bea | 493 | fi |
2d523c23 | 494 | |
aefad531 | 495 | config: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 496 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 497 | @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) |
2d523c23 | 498 | |
aefad531 | 499 | oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 500 | mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 501 | @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 502 | |
aefad531 | 503 | randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 504 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 505 | @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 506 | |
aefad531 | 507 | allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 508 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 509 | @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 510 | |
aefad531 | 511 | allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 512 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 513 | @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 514 | |
aefad531 | 515 | randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 WW |
516 | @mkdir -p $(BUILD_DIR)/buildroot-config |
517 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 518 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 519 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 520 | $< --randconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 521 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 522 | |
aefad531 | 523 | allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 WW |
524 | @mkdir -p $(BUILD_DIR)/buildroot-config |
525 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 526 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 527 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 528 | $< --allyesconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 529 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 530 | |
aefad531 | 531 | allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 WW |
532 | @mkdir -p $(BUILD_DIR)/buildroot-config |
533 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 534 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 535 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 536 | $< --allnoconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 537 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 538 | |
aefad531 | 539 | silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
0b368800 TP |
540 | @mkdir -p $(BUILD_DIR)/buildroot-config |
541 | $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN) | |
542 | ||
aefad531 | 543 | defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 544 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 545 | @$(COMMON_CONFIG_ENV) $< --defconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 546 | |
aefad531 | 547 | %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile |
6f38119c | 548 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 549 | @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN) |
6f38119c | 550 | |
aefad531 | 551 | savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
e1b1a18a TP |
552 | @mkdir -p $(BUILD_DIR)/buildroot-config |
553 | @$(COMMON_CONFIG_ENV) $< --savedefconfig=$(TOPDIR)/defconfig $(CONFIG_CONFIG_IN) | |
2d523c23 | 554 | |
6547bced | 555 | # check if download URLs are outdated |
825ff341 | 556 | source-check: allyesconfig |
de846f6e | 557 | $(MAKE) $(EXTRAMAKEARGS) _source-check |
825ff341 | 558 | |
406053d5 PK |
559 | endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
560 | ||
2d523c23 EA |
561 | ############################################################# |
562 | # | |
563 | # Cleanup and misc junk | |
564 | # | |
565 | ############################################################# | |
aefad531 YM |
566 | |
567 | # outputmakefile generates a Makefile in the output directory, if using a | |
568 | # separate output directory. This allows convenient use of make in the | |
569 | # output directory. | |
570 | outputmakefile: | |
571 | ifeq ($(NEED_WRAPPER),y) | |
572 | $(Q)$(TOPDIR)/scripts/mkmakefile $(TOPDIR) $(O) | |
573 | endif | |
574 | ||
2d523c23 | 575 | clean: |
406053d5 PK |
576 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \ |
577 | $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) | |
2d523c23 EA |
578 | |
579 | distclean: clean | |
406053d5 PK |
580 | ifeq ($(DL_DIR),$(TOPDIR)/dl) |
581 | rm -rf $(DL_DIR) | |
582 | endif | |
583 | ifeq ($(O),output) | |
584 | rm -rf $(O) | |
585 | endif | |
39ca6d50 | 586 | rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.config.cmd $(CONFIG_DIR)/.auto.deps |
2d523c23 | 587 | |
260d3b4a | 588 | flush: |
26082e79 | 589 | rm -f $(BUILD_DIR)/tgt-config.cache $(BUILD_DIR)/host-config.cache |
260d3b4a | 590 | |
d0c3d1cf | 591 | configured: dirs kernel-headers uclibc-config busybox-config linux26-config |
b8f28d65 | 592 | |
126bb72f US |
593 | prepatch: gcc-patched binutils-patched gdb-patched uclibc-patched |
594 | ||
b8f28d65 US |
595 | cross: $(BASE_TARGETS) |
596 | ||
e491fba2 BRF |
597 | help: |
598 | @echo 'Cleaning:' | |
406053d5 | 599 | @echo ' clean - delete all files created by build' |
e491fba2 BRF |
600 | @echo ' distclean - delete all non-source files (including .config)' |
601 | @echo | |
602 | @echo 'Build:' | |
603 | @echo ' all - make world' | |
604 | @echo | |
605 | @echo 'Configuration:' | |
606 | @echo ' menuconfig - interactive curses-based configurator' | |
c48bbb8c | 607 | @echo ' xconfig - interactive Qt-based configurator' |
2b42aae7 | 608 | @echo ' gconfig - interactive GTK-based configurator' |
e491fba2 | 609 | @echo ' oldconfig - resolve any unresolved symbols in .config' |
c48bbb8c PK |
610 | @echo ' randconfig - New config with random answer to all options' |
611 | @echo ' defconfig - New config with default answer to all options' | |
612 | @echo ' allyesconfig - New config where all options are accepted with yes' | |
613 | @echo ' allnoconfig - New config where all options are answered with no' | |
6652770f PK |
614 | @echo ' randpackageconfig - New config with random answer to package options' |
615 | @echo ' allyespackageconfig - New config where pkg options are accepted with yes' | |
616 | @echo ' allnopackageconfig - New config where package options are answered with no' | |
7b2ec610 | 617 | @echo ' configured - make {uclibc/busybox/linux26}-config' |
e491fba2 BRF |
618 | @echo |
619 | @echo 'Miscellaneous:' | |
620 | @echo ' source - download all sources needed for offline-build' | |
03380402 | 621 | @echo ' source-check - check all packages for valid download URLs' |
155971e0 | 622 | @echo ' external-deps - list external packages used' |
13a85e3c | 623 | @echo ' flush - flush configuration cache' |
e491fba2 | 624 | @echo |
58fd779a PK |
625 | @$(foreach b, $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig)), \ |
626 | printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) | |
627 | @echo | |
232fa7ee | 628 | @echo 'See docs/README and docs/buildroot.html for further details' |
663dee48 | 629 | @echo |
ba2e7e02 | 630 | |
e5e8fae8 | 631 | release: OUT=buildroot-$(BR2_VERSION) |
0dca7065 PK |
632 | |
633 | release: | |
e5e8fae8 | 634 | git archive --format=tar --prefix=$(OUT)/ master|gzip -9 >$(OUT).tar.gz |
e62d2ecd | 635 | |
6652770f | 636 | .PHONY: $(noconfig_targets) |
50cbb4a1 | 637 |