]>
Commit | Line | Data |
---|---|---|
2d523c23 | 1 | # Makefile for buildroot2 |
ffde94bd | 2 | # |
15b26aee | 3 | # Copyright (C) 1999-2005 by Erik Andersen <[email protected]> |
877044a7 | 4 | # Copyright (C) 2006-2011 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 | 26 | # Set and export the version string |
0a5e7905 | 27 | export BR2_VERSION:=2011.08-git |
e5e8fae8 | 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 \ |
4bb33dce | 45 | source-check |
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 | # Pull in the user's configuration file |
79 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) | |
39ca6d50 | 80 | -include $(CONFIG_DIR)/.config |
7521f373 | 81 | endif |
9741a49e | 82 | |
efd8576c US |
83 | # Override BR2_DL_DIR if shell variable defined |
84 | ifneq ($(BUILDROOT_DL_DIR),) | |
85 | BR2_DL_DIR:=$(BUILDROOT_DL_DIR) | |
86 | endif | |
efd8576c | 87 | |
afc61c6e BRF |
88 | # To put more focus on warnings, be less verbose as default |
89 | # Use 'make V=1' to see the full commands | |
90 | ifdef V | |
91 | ifeq ("$(origin V)", "command line") | |
18d979c7 | 92 | KBUILD_VERBOSE=$(V) |
afc61c6e BRF |
93 | endif |
94 | endif | |
95 | ifndef KBUILD_VERBOSE | |
18d979c7 | 96 | KBUILD_VERBOSE=0 |
afc61c6e BRF |
97 | endif |
98 | ||
99 | ifeq ($(KBUILD_VERBOSE),1) | |
4df454e9 | 100 | quiet= |
18d979c7 | 101 | Q= |
1669b6ed BRF |
102 | ifndef VERBOSE |
103 | VERBOSE=1 | |
104 | endif | |
afc61c6e BRF |
105 | else |
106 | quiet=quiet_ | |
18d979c7 | 107 | Q=@ |
afc61c6e BRF |
108 | endif |
109 | ||
69f85924 PK |
110 | # we want bash as shell |
111 | SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | |
afc61c6e | 112 | else if [ -x /bin/bash ]; then echo /bin/bash; \ |
18d979c7 | 113 | else echo sh; fi; fi) |
afc61c6e | 114 | |
69f85924 PK |
115 | # kconfig uses CONFIG_SHELL |
116 | CONFIG_SHELL:=$(SHELL) | |
117 | ||
118 | export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE | |
afc61c6e BRF |
119 | |
120 | ifndef HOSTAR | |
121 | HOSTAR:=ar | |
122 | endif | |
123 | ifndef HOSTAS | |
124 | HOSTAS:=as | |
125 | endif | |
126 | ifndef HOSTCC | |
127 | HOSTCC:=gcc | |
17b66aff | 128 | HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc) |
afc61c6e | 129 | endif |
0df02e12 | 130 | HOSTCC_NOCCACHE:=$(HOSTCC) |
afc61c6e BRF |
131 | ifndef HOSTCXX |
132 | HOSTCXX:=g++ | |
17b66aff | 133 | HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++) |
afc61c6e | 134 | endif |
0df02e12 | 135 | HOSTCXX_NOCCACHE:=$(HOSTCXX) |
5f97580e BRF |
136 | ifndef HOSTFC |
137 | HOSTFC:=gfortran | |
138 | endif | |
356133b4 US |
139 | ifndef HOSTCPP |
140 | HOSTCPP:=cpp | |
141 | endif | |
afc61c6e BRF |
142 | ifndef HOSTLD |
143 | HOSTLD:=ld | |
144 | endif | |
0f9c5b11 US |
145 | ifndef HOSTLN |
146 | HOSTLN:=ln | |
147 | endif | |
356133b4 US |
148 | ifndef HOSTNM |
149 | HOSTNM:=nm | |
150 | endif | |
69f85924 PK |
151 | HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar) |
152 | HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as) | |
69f85924 PK |
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 |
17b66aff | 160 | export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE |
afc61c6e | 161 | |
39ca6d50 WW |
162 | # bash prints the name of the directory on 'cd <dir>' if CDPATH is |
163 | # set, so unset it here to not cause problems. Notice that the export | |
164 | # line doesn't affect the environment of $(shell ..) calls, so | |
165 | # explictly throw away any output from 'cd' here. | |
166 | export CDPATH:= | |
167 | BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd) | |
168 | $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist)) | |
169 | ||
170 | BUILD_DIR:=$(BASE_DIR)/build | |
171 | ||
afc61c6e | 172 | |
cfe511b2 | 173 | ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
54e098e4 | 174 | |
99cf7293 | 175 | # cc-option |
18d979c7 | 176 | # Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586) |
99cf7293 BRF |
177 | # sets -march=winchip-c6 if supported else falls back to -march=i586 |
178 | # without checking the latter. | |
18d979c7 | 179 | cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ |
99cf7293 BRF |
180 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) |
181 | ||
2c649045 PK |
182 | ############################################################# |
183 | # | |
184 | # Hide troublesome environment variables from sub processes | |
185 | # | |
186 | ############################################################# | |
187 | unexport CROSS_COMPILE | |
188 | unexport ARCH | |
2bf3c166 DN |
189 | unexport CC |
190 | unexport CXX | |
191 | unexport CPP | |
192 | unexport CFLAGS | |
193 | unexport CXXFLAGS | |
194 | unexport GREP_OPTIONS | |
27bc59d4 | 195 | |
c71816a8 | 196 | GNU_HOST_NAME:=$(shell package/gnuconfig/config.guess) |
60281cbf | 197 | |
08782ae7 EA |
198 | ############################################################# |
199 | # | |
c6e43c9d | 200 | # Setup the proper filename extensions for the host |
08782ae7 | 201 | # |
7dcbbfbb | 202 | ############################################################## |
60281cbf | 203 | ifneq ($(findstring linux,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
204 | HOST_EXEEXT:= |
205 | HOST_LIBEXT:=.a | |
206 | HOST_SHREXT:=.so | |
3096f34d | 207 | endif |
60281cbf | 208 | ifneq ($(findstring apple,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
209 | HOST_EXEEXT:= |
210 | HOST_LIBEXT:=.a | |
211 | HOST_SHREXT:=.dylib | |
3096f34d | 212 | endif |
60281cbf | 213 | ifneq ($(findstring cygwin,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
214 | HOST_EXEEXT:=.exe |
215 | HOST_LIBEXT:=.lib | |
216 | HOST_SHREXT:=.dll | |
f894e85e | 217 | HOST_LOADLIBES=-lcurses -lintl |
2c279671 | 218 | export HOST_LOADLIBES |
3096f34d | 219 | endif |
60281cbf | 220 | ifneq ($(findstring mingw,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
221 | HOST_EXEEXT:=.exe |
222 | HOST_LIBEXT:=.lib | |
223 | HOST_SHREXT:=.dll | |
3096f34d | 224 | endif |
cb7d5b81 | 225 | |
6ad07203 | 226 | ############################################################## |
7dcbbfbb BRF |
227 | # |
228 | # The list of stuff to build for the target toolchain | |
229 | # along with the packages to build for the target. | |
230 | # | |
231 | ############################################################## | |
17b66aff TP |
232 | |
233 | ifeq ($(BR2_CCACHE),y) | |
234 | BASE_TARGETS += host-ccache | |
235 | endif | |
236 | ||
bc994c53 | 237 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) |
009407e6 | 238 | BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers |
10c1eec2 | 239 | else |
17b66aff | 240 | BASE_TARGETS += uclibc |
7dcbbfbb | 241 | endif |
acc706b7 BRF |
242 | TARGETS:= |
243 | ||
89464a96 PK |
244 | # silent mode requested? |
245 | QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q) | |
246 | ||
397fe5cc TP |
247 | # Strip off the annoying quoting |
248 | ARCH:=$(call qstrip,$(BR2_ARCH)) | |
249 | ifeq ($(ARCH),xtensa) | |
250 | ARCH:=$(ARCH)_$(call qstrip,$(BR2_xtensa_core_name)) | |
251 | endif | |
65e80a0b | 252 | |
891973f5 PK |
253 | KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \ |
254 | -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |
255 | -e s/arm.*/arm/ -e s/sa110/arm/ \ | |
871db074 | 256 | -e s/bfin/blackfin/ \ |
891973f5 PK |
257 | -e s/parisc64/parisc/ \ |
258 | -e s/powerpc64/powerpc/ \ | |
259 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ | |
260 | -e s/sh.*/sh/) | |
261 | ||
397fe5cc TP |
262 | ZCAT:=$(call qstrip,$(BR2_ZCAT)) |
263 | BZCAT:=$(call qstrip,$(BR2_BZCAT)) | |
264 | TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf | |
265 | ||
397fe5cc TP |
266 | GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX)) |
267 | ||
a2b4f7fb GZ |
268 | # packages compiled for the host go here |
269 | HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR)) | |
397fe5cc TP |
270 | |
271 | # stamp (dependency) files go here | |
3b2a803d | 272 | STAMP_DIR:=$(BASE_DIR)/stamps |
397fe5cc | 273 | |
3b2a803d TP |
274 | BINARIES_DIR:=$(BASE_DIR)/images |
275 | TARGET_DIR:=$(BASE_DIR)/target | |
4c5bf461 | 276 | TOOLCHAIN_DIR=$(BASE_DIR)/toolchain |
fbc22eca | 277 | TARGET_SKELETON=$(TOPDIR)/fs/skeleton |
397fe5cc | 278 | |
397fe5cc | 279 | BR2_DEPENDS_DIR=$(BUILD_DIR)/buildroot-config |
1dbe6e33 | 280 | |
17b66aff TP |
281 | ifeq ($(BR2_CCACHE),y) |
282 | CCACHE:=$(HOST_DIR)/usr/bin/ccache | |
283 | CCACHE_CACHE_DIR=$(HOME)/.buildroot-ccache | |
284 | HOSTCC := $(CCACHE) $(HOSTCC) | |
285 | HOSTCXX := $(CCACHE) $(HOSTCXX) | |
286 | endif | |
287 | ||
7dcbbfbb BRF |
288 | include toolchain/Makefile.in |
289 | include package/Makefile.in | |
290 | ||
291 | ############################################################# | |
292 | # | |
293 | # You should probably leave this stuff alone unless you know | |
294 | # what you are doing. | |
295 | # | |
296 | ############################################################# | |
297 | ||
6547bced | 298 | all: world |
ffde94bd | 299 | |
d06645d8 EA |
300 | # We also need the various per-package makefiles, which also add |
301 | # each selected package to TARGETS if that package was selected | |
302 | # in the .config file. | |
bc994c53 | 303 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) |
ed020099 | 304 | include toolchain/toolchain-buildroot.mk |
26b44b2b | 305 | else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) |
ed020099 | 306 | include toolchain/toolchain-external.mk |
10c1eec2 YM |
307 | else ifeq ($(BR2_TOOLCHAIN_CTNG),y) |
308 | include toolchain/toolchain-crosstool-ng.mk | |
acc706b7 BRF |
309 | endif |
310 | ||
d06645d8 | 311 | include package/*/*.mk |
d06645d8 | 312 | |
64d8e9a0 PK |
313 | include boot/common.mk |
314 | include target/Makefile.in | |
315 | include linux/linux.mk | |
316 | ||
32faf351 | 317 | TARGETS+=target-finalize |
d45de0ca | 318 | |
b87b4742 PK |
319 | ifeq ($(BR2_ENABLE_LOCALE_PURGE),y) |
320 | TARGETS+=target-purgelocales | |
321 | endif | |
322 | ||
649b5b92 | 323 | include fs/common.mk |
79f5f1e8 | 324 | |
02a623dd | 325 | TARGETS+=erase-fakeroots |
c2fc93bc | 326 | |
08782ae7 | 327 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
3b08e64d | 328 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS)) |
08782ae7 | 329 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
b3efde23 | 330 | TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS)) |
22c2c6b5 PK |
331 | |
332 | # host-* dependencies have to be handled specially, as those aren't | |
333 | # visible in Kconfig and hence not added to a variable like TARGETS. | |
334 | # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES | |
335 | # variable for each enabled target. | |
336 | # Notice: this only works for newstyle gentargets/autotargets packages | |
337 | TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\ | |
338 | $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\ | |
339 | $($(dep))))) | |
340 | # Host packages can in turn have their own dependencies. Likewise find | |
341 | # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each | |
342 | # host package found above. Ideally this should be done recursively until | |
343 | # no more packages are found, but that's hard to do in make, so limit to | |
344 | # 1 level for now. | |
345 | HOST_DEPS = $(sort $(foreach dep,\ | |
346 | $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\ | |
347 | $($(dep)))) | |
348 | HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS))) | |
349 | ||
acc706b7 | 350 | # all targets depend on the crosscompiler and it's prerequisites |
b3efde23 | 351 | $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) % |
acc706b7 | 352 | |
cb5710c5 | 353 | dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ |
397fe5cc | 354 | $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR) |
f958d897 | 355 | |
73144a6e | 356 | $(BASE_TARGETS): dirs $(O)/toolchainfile.cmake |
f958d897 | 357 | |
0b368800 | 358 | $(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config |
c729829c | 359 | $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig |
0b368800 TP |
360 | |
361 | prepare: $(BUILD_DIR)/buildroot-config/auto.conf | |
362 | ||
363 | world: prepare dependencies dirs $(BASE_TARGETS) $(TARGETS_ALL) | |
ffde94bd | 364 | |
73144a6e BF |
365 | $(O)/toolchainfile.cmake: |
366 | @echo -en "\ | |
367 | set(CMAKE_SYSTEM_NAME Linux)\n\ | |
125e2558 PK |
368 | set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\ |
369 | set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\ | |
370 | set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\ | |
371 | set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\ | |
73144a6e BF |
372 | set(CMAKE_INSTALL_SO_NO_EXE 0)\n\ |
373 | set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\ | |
374 | set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\ | |
375 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\ | |
376 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\ | |
377 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\ | |
378 | set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\ | |
379 | " > $@ | |
5ef9e52b | 380 | |
aefad531 | 381 | .PHONY: all world dirs clean distclean source outputmakefile \ |
b3efde23 | 382 | $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \ |
747b16dd | 383 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
cb5710c5 | 384 | $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ |
397fe5cc | 385 | $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR) |
ffde94bd | 386 | |
08782ae7 EA |
387 | ############################################################# |
388 | # | |
ef407d3d | 389 | # staging and target directories do NOT list these as |
d99c31c6 | 390 | # dependencies anywhere else |
08782ae7 EA |
391 | # |
392 | ############################################################# | |
cb5710c5 | 393 | $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR): |
8d583fc0 | 394 | @mkdir -p $@ |
3ad3d8a1 | 395 | |
08782ae7 | 396 | $(STAGING_DIR): |
9c865d75 | 397 | @mkdir -p $(STAGING_DIR)/bin |
bf38723f | 398 | @mkdir -p $(STAGING_DIR)/lib |
8027784c | 399 | @mkdir -p $(STAGING_DIR)/usr/lib |
8027784c | 400 | @mkdir -p $(STAGING_DIR)/usr/include |
a05c337d | 401 | @mkdir -p $(STAGING_DIR)/usr/bin |
5ad139eb | 402 | @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging |
ffde94bd | 403 | |
2b3a43f4 DM |
404 | ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y) |
405 | TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH) | |
406 | endif | |
407 | ||
397fe5cc | 408 | $(BUILD_DIR)/.root: |
7547c7eb | 409 | mkdir -p $(TARGET_DIR) |
f0ca4b82 BRF |
410 | if ! [ -d "$(TARGET_DIR)/bin" ]; then \ |
411 | if [ -d "$(TARGET_SKELETON)" ]; then \ | |
18d979c7 | 412 | cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \ |
74cda1e4 | 413 | fi; \ |
18d979c7 | 414 | touch $(STAGING_DIR)/.fakeroot.00000; \ |
f0ca4b82 | 415 | fi |
fc3eb18b | 416 | -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf |
b9656e81 | 417 | -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf |
7547c7eb | 418 | touch $@ |
08782ae7 | 419 | |
397fe5cc | 420 | $(TARGET_DIR): $(BUILD_DIR)/.root |
c6771dfb | 421 | |
c2fc93bc | 422 | erase-fakeroots: |
397fe5cc | 423 | rm -f $(BUILD_DIR)/.fakeroot* |
412ca2a4 | 424 | |
32faf351 | 425 | target-finalize: |
d45de0ca JV |
426 | ifeq ($(BR2_HAVE_DEVFILES),y) |
427 | ( scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) ) | |
bc67ca29 | 428 | else |
bea9e43f | 429 | rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/aclocal |
027aa1d2 WB |
430 | find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f |
431 | find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f | |
bc67ca29 | 432 | endif |
e48a72e5 MS |
433 | ifneq ($(BR2_PACKAGE_GDB),y) |
434 | rm -rf $(TARGET_DIR)/usr/share/gdb | |
435 | endif | |
87b0637b | 436 | ifneq ($(BR2_HAVE_DOCUMENTATION),y) |
32faf351 | 437 | rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man |
32faf351 | 438 | rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info |
87b0637b | 439 | rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc |
d701a823 | 440 | rm -rf $(TARGET_DIR)/usr/share/gtk-doc |
68ad6d4e | 441 | -rmdir $(TARGET_DIR)/usr/share 2>/dev/null |
b0c86bcc TP |
442 | endif |
443 | ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y) | |
444 | find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f | |
445 | endif | |
446 | ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y) | |
447 | find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f | |
32faf351 | 448 | endif |
66254843 | 449 | find $(TARGET_DIR) -type f -perm +111 '!' -name 'libthread_db*.so*' | \ |
c98bc88e | 450 | xargs $(STRIPCMD) 2>/dev/null || true |
8101c9a3 | 451 | find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \ |
0dc940cd | 452 | xargs -r $(KSTRIPCMD) || true |
8101c9a3 | 453 | |
4ccde7fa TP |
454 | mkdir -p $(TARGET_DIR)/etc |
455 | # Mandatory configuration file and auxilliary cache directory | |
456 | # for recent versions of ldconfig | |
457 | touch $(TARGET_DIR)/etc/ld.so.conf | |
458 | mkdir -p $(TARGET_DIR)/var/cache/ldconfig | |
e49e2fed PK |
459 | if [ -x "$(TARGET_CROSS)ldconfig" ]; \ |
460 | then \ | |
4ccde7fa | 461 | $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \ |
e49e2fed | 462 | else \ |
4ccde7fa | 463 | /sbin/ldconfig -r $(TARGET_DIR); \ |
e49e2fed | 464 | fi |
cb15bf8d | 465 | echo $(BR2_VERSION_FULL) > $(TARGET_DIR)/etc/br-version |
912ea81a | 466 | |
eed7d873 DM |
467 | ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"") |
468 | $(BR2_ROOTFS_POST_BUILD_SCRIPT) $(TARGET_DIR) | |
469 | endif | |
470 | ||
b87b4742 | 471 | ifeq ($(BR2_ENABLE_LOCALE_PURGE),y) |
397fe5cc | 472 | LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge |
6cdf2481 | 473 | LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST)) |
b87b4742 PK |
474 | |
475 | target-purgelocales: | |
476 | rm -f $(LOCALE_WHITELIST) | |
477 | for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done | |
478 | ||
479 | for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \ | |
480 | do \ | |
481 | for lang in $$(cd $$dir; ls .|grep -v man); \ | |
482 | do \ | |
483 | grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \ | |
484 | done; \ | |
485 | done | |
486 | endif | |
487 | ||
3b08e64d | 488 | source: $(TARGETS_SOURCE) $(HOST_SOURCE) |
08782ae7 | 489 | |
6547bced | 490 | _source-check: |
d147b81f | 491 | $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source |
825ff341 | 492 | |
155971e0 | 493 | external-deps: |
22c2c6b5 | 494 | @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u |
155971e0 | 495 | |
b7d6c8ad TP |
496 | show-targets: |
497 | @echo $(TARGETS) | |
498 | ||
cfe511b2 | 499 | else # ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
2d523c23 EA |
500 | |
501 | all: menuconfig | |
502 | ||
503 | # configuration | |
504 | # --------------------------------------------------------------------------- | |
505 | ||
c0d7d4e0 BRF |
506 | HOSTCFLAGS=$(CFLAGS_FOR_BUILD) |
507 | export HOSTCFLAGS | |
508 | ||
2cc210c9 PK |
509 | $(BUILD_DIR)/buildroot-config/%onf: |
510 | mkdir -p $(@D)/lxdialog | |
17b66aff | 511 | $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) |
2d523c23 | 512 | |
1039eb74 TP |
513 | COMMON_CONFIG_ENV = \ |
514 | KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \ | |
515 | KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \ | |
0b368800 | 516 | KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \ |
1039eb74 | 517 | BUILDROOT_CONFIG=$(CONFIG_DIR)/.config |
2d523c23 | 518 | |
aefad531 | 519 | xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile |
39ca6d50 | 520 | @mkdir -p $(BUILD_DIR)/buildroot-config |
610255e7 | 521 | @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) |
b0df9df3 | 522 | |
aefad531 | 523 | gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile |
39ca6d50 | 524 | @mkdir -p $(BUILD_DIR)/buildroot-config |
610255e7 | 525 | @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN) |
2b42aae7 | 526 | |
aefad531 | 527 | menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile |
39ca6d50 | 528 | @mkdir -p $(BUILD_DIR)/buildroot-config |
610255e7 | 529 | @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) |
2d523c23 | 530 | |
aefad531 | 531 | nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile |
8b6585a9 | 532 | @mkdir -p $(BUILD_DIR)/buildroot-config |
610255e7 | 533 | @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) |
2d523c23 | 534 | |
aefad531 | 535 | config: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 536 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 537 | @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) |
2d523c23 | 538 | |
aefad531 | 539 | oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 540 | mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 541 | @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 542 | |
aefad531 | 543 | randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 544 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 545 | @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 546 | |
aefad531 | 547 | allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 548 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 549 | @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 550 | |
aefad531 | 551 | allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 552 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 553 | @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 554 | |
aefad531 | 555 | randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 WW |
556 | @mkdir -p $(BUILD_DIR)/buildroot-config |
557 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 558 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 559 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 560 | $< --randconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 561 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 562 | |
aefad531 | 563 | allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 WW |
564 | @mkdir -p $(BUILD_DIR)/buildroot-config |
565 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 566 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 567 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 568 | $< --allyesconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 569 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 570 | |
aefad531 | 571 | allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 WW |
572 | @mkdir -p $(BUILD_DIR)/buildroot-config |
573 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 574 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 575 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 576 | $< --allnoconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 577 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 578 | |
aefad531 | 579 | silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
0b368800 TP |
580 | @mkdir -p $(BUILD_DIR)/buildroot-config |
581 | $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN) | |
582 | ||
aefad531 | 583 | defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
39ca6d50 | 584 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 585 | @$(COMMON_CONFIG_ENV) $< --defconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 586 | |
aefad531 | 587 | %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile |
6f38119c | 588 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 589 | @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN) |
6f38119c | 590 | |
aefad531 | 591 | savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile |
e1b1a18a | 592 | @mkdir -p $(BUILD_DIR)/buildroot-config |
35ac32d1 | 593 | @$(COMMON_CONFIG_ENV) $< --savedefconfig=$(CONFIG_DIR)/defconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 594 | |
6547bced | 595 | # check if download URLs are outdated |
825ff341 | 596 | source-check: allyesconfig |
de846f6e | 597 | $(MAKE) $(EXTRAMAKEARGS) _source-check |
825ff341 | 598 | |
406053d5 PK |
599 | endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
600 | ||
2d523c23 EA |
601 | ############################################################# |
602 | # | |
603 | # Cleanup and misc junk | |
604 | # | |
605 | ############################################################# | |
aefad531 YM |
606 | |
607 | # outputmakefile generates a Makefile in the output directory, if using a | |
608 | # separate output directory. This allows convenient use of make in the | |
609 | # output directory. | |
610 | outputmakefile: | |
611 | ifeq ($(NEED_WRAPPER),y) | |
612 | $(Q)$(TOPDIR)/scripts/mkmakefile $(TOPDIR) $(O) | |
613 | endif | |
614 | ||
2d523c23 | 615 | clean: |
406053d5 | 616 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \ |
85dc57f6 | 617 | $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging |
2d523c23 EA |
618 | |
619 | distclean: clean | |
406053d5 PK |
620 | ifeq ($(DL_DIR),$(TOPDIR)/dl) |
621 | rm -rf $(DL_DIR) | |
622 | endif | |
623 | ifeq ($(O),output) | |
624 | rm -rf $(O) | |
625 | endif | |
610255e7 | 626 | rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps |
2d523c23 | 627 | |
b8f28d65 US |
628 | cross: $(BASE_TARGETS) |
629 | ||
e491fba2 BRF |
630 | help: |
631 | @echo 'Cleaning:' | |
406053d5 | 632 | @echo ' clean - delete all files created by build' |
e491fba2 BRF |
633 | @echo ' distclean - delete all non-source files (including .config)' |
634 | @echo | |
635 | @echo 'Build:' | |
636 | @echo ' all - make world' | |
637 | @echo | |
638 | @echo 'Configuration:' | |
639 | @echo ' menuconfig - interactive curses-based configurator' | |
15f5bef0 | 640 | @echo ' nconfig - interactive ncurses-based configurator' |
c48bbb8c | 641 | @echo ' xconfig - interactive Qt-based configurator' |
2b42aae7 | 642 | @echo ' gconfig - interactive GTK-based configurator' |
e491fba2 | 643 | @echo ' oldconfig - resolve any unresolved symbols in .config' |
c48bbb8c PK |
644 | @echo ' randconfig - New config with random answer to all options' |
645 | @echo ' defconfig - New config with default answer to all options' | |
d7051da8 | 646 | @echo ' savedefconfig - Save current config as ./defconfig (minimal config)' |
c48bbb8c PK |
647 | @echo ' allyesconfig - New config where all options are accepted with yes' |
648 | @echo ' allnoconfig - New config where all options are answered with no' | |
6652770f PK |
649 | @echo ' randpackageconfig - New config with random answer to package options' |
650 | @echo ' allyespackageconfig - New config where pkg options are accepted with yes' | |
651 | @echo ' allnopackageconfig - New config where package options are answered with no' | |
4bb33dce PK |
652 | ifeq ($(BR2_PACKAGE_BUSYBOX),y) |
653 | @echo ' busybox-menuconfig - Run BusyBox menuconfig' | |
654 | endif | |
655 | ifeq ($(BR2_LINUX_KERNEL),y) | |
656 | @echo ' linux-menuconfig - Run Linux kernel menuconfig' | |
657 | endif | |
658 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) | |
659 | @echo ' uclibc-menuconfig - Run uClibc menuconfig' | |
660 | endif | |
661 | ifeq ($(BR2_TOOLCHAIN_CTNG),y) | |
662 | @echo ' ctng-menuconfig - Run crosstool-NG menuconfig' | |
663 | endif | |
e491fba2 BRF |
664 | @echo |
665 | @echo 'Miscellaneous:' | |
666 | @echo ' source - download all sources needed for offline-build' | |
03380402 | 667 | @echo ' source-check - check all packages for valid download URLs' |
155971e0 | 668 | @echo ' external-deps - list external packages used' |
e491fba2 | 669 | @echo |
15f5bef0 PK |
670 | @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build' |
671 | @echo ' make O=dir - Locate all output files in "dir", including .config' | |
672 | @echo | |
58fd779a PK |
673 | @$(foreach b, $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig)), \ |
674 | printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) | |
675 | @echo | |
232fa7ee | 676 | @echo 'See docs/README and docs/buildroot.html for further details' |
663dee48 | 677 | @echo |
ba2e7e02 | 678 | |
e5e8fae8 | 679 | release: OUT=buildroot-$(BR2_VERSION) |
0dca7065 PK |
680 | |
681 | release: | |
e5e8fae8 | 682 | git archive --format=tar --prefix=$(OUT)/ master|gzip -9 >$(OUT).tar.gz |
e62d2ecd | 683 | |
6652770f | 684 | .PHONY: $(noconfig_targets) |
50cbb4a1 | 685 |