]> Git Repo - buildroot-mgba.git/blame - Makefile
Update for 2012.08-rc2
[buildroot-mgba.git] / Makefile
CommitLineData
2d523c23 1# Makefile for buildroot2
ffde94bd 2#
15b26aee 3# Copyright (C) 1999-2005 by Erik Andersen <[email protected]>
9fc43591 4# Copyright (C) 2006-2012 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
b58c83ae 27export BR2_VERSION:=2012.08-rc2
e5e8fae8 28
0edfb24c
TDS
29# Check for minimal make version (note: this check will break at make 10.x)
30MIN_MAKE_VERSION=3.81
8139e21c 31ifneq ($(firstword $(sort $(MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSION))
0edfb24c
TDS
32$(error You have make '$(MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
33endif
34
1d4104f0
FP
35export HOSTARCH := $(shell uname -m | \
36 sed -e s/i.86/x86/ \
37 -e s/sun4u/sparc64/ \
38 -e s/arm.*/arm/ \
39 -e s/sa110/arm/ \
40 -e s/ppc64/powerpc/ \
41 -e s/ppc/powerpc/ \
42 -e s/macppc/powerpc/\
43 -e s/sh.*/sh/)
44
2d239bbe
YM
45# This top-level Makefile can *not* be executed in parallel
46.NOTPARALLEL:
47
6b1dd45b
PK
48# absolute path
49TOPDIR:=$(shell pwd)
18d979c7 50CONFIG_CONFIG_IN=Config.in
56da3859 51CONFIG=support/kconfig
a8ee1240 52DATE:=$(shell date +%Y%m%d)
a0aef7c4 53
8258df27
YM
54# Compute the full local version string so packages can use it as-is
55# Need to export it, so it can be got from environment in children (eg. mconf)
f082c7c5 56export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
8258df27 57
8b6585a9 58noconfig_targets:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \
0b368800 59 defconfig %_defconfig savedefconfig allyesconfig allnoconfig silentoldconfig release \
6652770f 60 randpackageconfig allyespackageconfig allnopackageconfig \
2b91ab7a 61 source-check print-version
9e250356 62
580c6d9b
TP
63# Strip quotes and then whitespaces
64qstrip=$(strip $(subst ",,$(1)))
65#"))
66
f85f2de1
PK
67# Variables for use in Make constructs
68comma:=,
69empty:=
70space:=$(empty) $(empty)
71
39ca6d50
WW
72ifneq ("$(origin O)", "command line")
73O:=output
74CONFIG_DIR:=$(TOPDIR)
aefad531 75NEED_WRAPPER=
39ca6d50
WW
76else
77# other packages might also support Linux-style out of tree builds
78# with the O=<dir> syntax (E.G. Busybox does). As make automatically
79# forwards command line variable definitions those packages get very
80# confused. Fix this by telling make to not do so
81MAKEOVERRIDES =
82# strangely enough O is still passed to submakes with MAKEOVERRIDES
83# (with make 3.81 atleast), the only thing that changes is the output
84# of the origin function (command line -> environment).
85# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
86# To really make O go away, we have to override it.
87override O:=$(O)
88CONFIG_DIR:=$(O)
de846f6e
PK
89# we need to pass O= everywhere we call back into the toplevel makefile
90EXTRAMAKEARGS = O=$(O)
aefad531 91NEED_WRAPPER=y
39ca6d50
WW
92endif
93
a1b0651a
US
94# Pull in the user's configuration file
95ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
39ca6d50 96-include $(CONFIG_DIR)/.config
7521f373 97endif
9741a49e 98
efd8576c
US
99# Override BR2_DL_DIR if shell variable defined
100ifneq ($(BUILDROOT_DL_DIR),)
101BR2_DL_DIR:=$(BUILDROOT_DL_DIR)
102endif
efd8576c 103
afc61c6e
BRF
104# To put more focus on warnings, be less verbose as default
105# Use 'make V=1' to see the full commands
106ifdef V
107 ifeq ("$(origin V)", "command line")
18d979c7 108 KBUILD_VERBOSE=$(V)
afc61c6e
BRF
109 endif
110endif
111ifndef KBUILD_VERBOSE
18d979c7 112 KBUILD_VERBOSE=0
afc61c6e
BRF
113endif
114
115ifeq ($(KBUILD_VERBOSE),1)
4df454e9 116 quiet=
18d979c7 117 Q=
1669b6ed
BRF
118ifndef VERBOSE
119 VERBOSE=1
120endif
afc61c6e
BRF
121else
122 quiet=quiet_
18d979c7 123 Q=@
afc61c6e
BRF
124endif
125
69f85924
PK
126# we want bash as shell
127SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
afc61c6e 128 else if [ -x /bin/bash ]; then echo /bin/bash; \
18d979c7 129 else echo sh; fi; fi)
afc61c6e 130
69f85924
PK
131# kconfig uses CONFIG_SHELL
132CONFIG_SHELL:=$(SHELL)
133
134export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
afc61c6e
BRF
135
136ifndef HOSTAR
137HOSTAR:=ar
138endif
139ifndef HOSTAS
140HOSTAS:=as
141endif
142ifndef HOSTCC
143HOSTCC:=gcc
17b66aff 144HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
afc61c6e 145endif
0df02e12 146HOSTCC_NOCCACHE:=$(HOSTCC)
afc61c6e
BRF
147ifndef HOSTCXX
148HOSTCXX:=g++
17b66aff 149HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
afc61c6e 150endif
0df02e12 151HOSTCXX_NOCCACHE:=$(HOSTCXX)
5f97580e
BRF
152ifndef HOSTFC
153HOSTFC:=gfortran
154endif
356133b4
US
155ifndef HOSTCPP
156HOSTCPP:=cpp
157endif
afc61c6e
BRF
158ifndef HOSTLD
159HOSTLD:=ld
160endif
0f9c5b11
US
161ifndef HOSTLN
162HOSTLN:=ln
163endif
356133b4
US
164ifndef HOSTNM
165HOSTNM:=nm
166endif
69f85924
PK
167HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
168HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
69f85924
PK
169HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
170HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
171HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
172HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
173HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
54e93328 174
5f97580e 175export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
17b66aff 176export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
afc61c6e 177
670cb306
AV
178# Make sure pkg-config doesn't look outside the buildroot tree
179unexport PKG_CONFIG_PATH
180
91123a6f
TP
181# Having DESTDIR set in the environment confuses the installation
182# steps of some packages.
183unexport DESTDIR
184
39ca6d50
WW
185# bash prints the name of the directory on 'cd <dir>' if CDPATH is
186# set, so unset it here to not cause problems. Notice that the export
187# line doesn't affect the environment of $(shell ..) calls, so
188# explictly throw away any output from 'cd' here.
189export CDPATH:=
190BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
191$(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
192
193BUILD_DIR:=$(BASE_DIR)/build
194
afc61c6e 195
cfe511b2 196ifeq ($(BR2_HAVE_DOT_CONFIG),y)
54e098e4 197
2c649045
PK
198#############################################################
199#
200# Hide troublesome environment variables from sub processes
201#
202#############################################################
203unexport CROSS_COMPILE
204unexport ARCH
2bf3c166
DN
205unexport CC
206unexport CXX
207unexport CPP
208unexport CFLAGS
209unexport CXXFLAGS
210unexport GREP_OPTIONS
12c9f7dd 211unexport CONFIG_SITE
27bc59d4 212
102a93bd 213GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
60281cbf 214
6ad07203 215##############################################################
7dcbbfbb
BRF
216#
217# The list of stuff to build for the target toolchain
218# along with the packages to build for the target.
219#
220##############################################################
17b66aff
TP
221
222ifeq ($(BR2_CCACHE),y)
223BASE_TARGETS += host-ccache
224endif
225
bc994c53 226ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
009407e6 227BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
10c1eec2 228else
17b66aff 229BASE_TARGETS += uclibc
7dcbbfbb 230endif
acc706b7
BRF
231TARGETS:=
232
89464a96
PK
233# silent mode requested?
234QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
235
397fe5cc
TP
236# Strip off the annoying quoting
237ARCH:=$(call qstrip,$(BR2_ARCH))
238ifeq ($(ARCH),xtensa)
239ARCH:=$(ARCH)_$(call qstrip,$(BR2_xtensa_core_name))
240endif
65e80a0b 241
891973f5
PK
242KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
243 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
244 -e s/arm.*/arm/ -e s/sa110/arm/ \
871db074 245 -e s/bfin/blackfin/ \
891973f5
PK
246 -e s/parisc64/parisc/ \
247 -e s/powerpc64/powerpc/ \
248 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
249 -e s/sh.*/sh/)
250
397fe5cc
TP
251ZCAT:=$(call qstrip,$(BR2_ZCAT))
252BZCAT:=$(call qstrip,$(BR2_BZCAT))
177b4b4a 253XZCAT:=$(call qstrip,$(BR2_XZCAT))
397fe5cc
TP
254TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
255
a2b4f7fb
GZ
256# packages compiled for the host go here
257HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
397fe5cc 258
aebf199f
TP
259# locales to generate
260GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
261
397fe5cc 262# stamp (dependency) files go here
3b2a803d 263STAMP_DIR:=$(BASE_DIR)/stamps
397fe5cc 264
3b2a803d
TP
265BINARIES_DIR:=$(BASE_DIR)/images
266TARGET_DIR:=$(BASE_DIR)/target
4c5bf461 267TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
fbc22eca 268TARGET_SKELETON=$(TOPDIR)/fs/skeleton
397fe5cc 269
7e76f904
LC
270LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
271REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
272LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
273LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
274LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
275LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
276LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
277
17b66aff
TP
278ifeq ($(BR2_CCACHE),y)
279CCACHE:=$(HOST_DIR)/usr/bin/ccache
43329076
TDS
280BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
281export BUILDROOT_CACHE_DIR
17b66aff
TP
282HOSTCC := $(CCACHE) $(HOSTCC)
283HOSTCXX := $(CCACHE) $(HOSTCXX)
284endif
285
7dcbbfbb
BRF
286#############################################################
287#
288# You should probably leave this stuff alone unless you know
289# what you are doing.
290#
291#############################################################
292
6547bced 293all: world
ffde94bd 294
486253db 295include package/Makefile.in
a792668b
TDS
296include support/dependencies/dependencies.mk
297
d06645d8
EA
298# We also need the various per-package makefiles, which also add
299# each selected package to TARGETS if that package was selected
300# in the .config file.
bc994c53 301ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
ed020099 302include toolchain/toolchain-buildroot.mk
26b44b2b 303else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
ed020099 304include toolchain/toolchain-external.mk
10c1eec2
YM
305else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
306include toolchain/toolchain-crosstool-ng.mk
acc706b7
BRF
307endif
308
ee0246e1
TP
309# Include the package override file if one has been provided in the
310# configuration.
311PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
312ifneq ($(PACKAGE_OVERRIDE_FILE),)
313-include $(PACKAGE_OVERRIDE_FILE)
314endif
315
d06645d8 316include package/*/*.mk
d06645d8 317
64d8e9a0
PK
318include boot/common.mk
319include target/Makefile.in
320include linux/linux.mk
321
32faf351 322TARGETS+=target-finalize
d45de0ca 323
b87b4742
PK
324ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
325TARGETS+=target-purgelocales
326endif
327
aebf199f
TP
328ifneq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_CTNG_eglibc)$(BR2_TOOLCHAIN_CTNG_glibc),)
329ifneq ($(GENERATE_LOCALE),)
330TARGETS+=target-generatelocales
331endif
332endif
333
649b5b92 334include fs/common.mk
79f5f1e8 335
08782ae7 336TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
3b08e64d 337TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
08782ae7 338TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
b3efde23 339TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
22c2c6b5
PK
340
341# host-* dependencies have to be handled specially, as those aren't
342# visible in Kconfig and hence not added to a variable like TARGETS.
343# instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
344# variable for each enabled target.
345# Notice: this only works for newstyle gentargets/autotargets packages
346TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
347 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
348 $($(dep)))))
349# Host packages can in turn have their own dependencies. Likewise find
350# all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
351# host package found above. Ideally this should be done recursively until
352# no more packages are found, but that's hard to do in make, so limit to
353# 1 level for now.
354HOST_DEPS = $(sort $(foreach dep,\
355 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
356 $($(dep))))
357HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
358
7e76f904
LC
359TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
360 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
361
acc706b7 362# all targets depend on the crosscompiler and it's prerequisites
b3efde23 363$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
acc706b7 364
cb5710c5 365dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
d0880f70 366 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
f958d897 367
ed7791e2 368$(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
f958d897 369
0b368800 370$(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
c729829c 371 $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
0b368800
TP
372
373prepare: $(BUILD_DIR)/buildroot-config/auto.conf
374
ee7f92e1 375world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
ffde94bd 376
aefad531 377.PHONY: all world dirs clean distclean source outputmakefile \
7e76f904 378 legal-info legal-info-prepare legal-info-clean \
b3efde23 379 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
7e76f904 380 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
cb5710c5 381 $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
d0880f70 382 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
ffde94bd 383
08782ae7
EA
384#############################################################
385#
ef407d3d 386# staging and target directories do NOT list these as
d99c31c6 387# dependencies anywhere else
08782ae7
EA
388#
389#############################################################
7e76f904 390$(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
8d583fc0 391 @mkdir -p $@
3ad3d8a1 392
08782ae7 393$(STAGING_DIR):
9c865d75 394 @mkdir -p $(STAGING_DIR)/bin
bf38723f 395 @mkdir -p $(STAGING_DIR)/lib
8027784c 396 @mkdir -p $(STAGING_DIR)/usr/lib
8027784c 397 @mkdir -p $(STAGING_DIR)/usr/include
a05c337d 398 @mkdir -p $(STAGING_DIR)/usr/bin
5ad139eb 399 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
ffde94bd 400
2b3a43f4
DM
401ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
402TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
403endif
404
397fe5cc 405$(BUILD_DIR)/.root:
7547c7eb 406 mkdir -p $(TARGET_DIR)
f0ca4b82
BRF
407 if ! [ -d "$(TARGET_DIR)/bin" ]; then \
408 if [ -d "$(TARGET_SKELETON)" ]; then \
18d979c7 409 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
74cda1e4 410 fi; \
f0ca4b82 411 fi
fc3eb18b 412 -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf
b9656e81 413 -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
7547c7eb 414 touch $@
08782ae7 415
397fe5cc 416$(TARGET_DIR): $(BUILD_DIR)/.root
c6771dfb 417
2a97045d
TDS
418STRIP_FIND_CMD = find $(TARGET_DIR)
419ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
420STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
421endif
422STRIP_FIND_CMD += -type f -perm +111
423STRIP_FIND_CMD += -not \( $(call findfileclauses,libthread_db*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
424
32faf351 425target-finalize:
d45de0ca 426ifeq ($(BR2_HAVE_DEVFILES),y)
f082c7c5 427 ( support/scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
bc67ca29 428else
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 432endif
e48a72e5
MS
433ifneq ($(BR2_PACKAGE_GDB),y)
434 rm -rf $(TARGET_DIR)/usr/share/gdb
435endif
87b0637b 436ifneq ($(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
442endif
443ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
444 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
445endif
446ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
447 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
32faf351 448endif
2a97045d 449 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
8101c9a3 450 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
0dc940cd 451 xargs -r $(KSTRIPCMD) || true
8101c9a3 452
4ccde7fa
TP
453 mkdir -p $(TARGET_DIR)/etc
454 # Mandatory configuration file and auxilliary cache directory
455 # for recent versions of ldconfig
456 touch $(TARGET_DIR)/etc/ld.so.conf
457 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
e49e2fed
PK
458 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
459 then \
4ccde7fa 460 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
e49e2fed 461 else \
4ccde7fa 462 /sbin/ldconfig -r $(TARGET_DIR); \
e49e2fed 463 fi
451a8878
PK
464 ( \
465 echo "NAME=Buildroot"; \
466 echo "VERSION=$(BR2_VERSION_FULL)"; \
467 echo "ID=buildroot"; \
468 echo "VERSION_ID=$(BR2_VERSION)"; \
469 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
470 ) > $(TARGET_DIR)/etc/os-release
912ea81a 471
eed7d873 472ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"")
eb8fad28 473 @$(call MESSAGE,"Executing post-build script")
eed7d873
DM
474 $(BR2_ROOTFS_POST_BUILD_SCRIPT) $(TARGET_DIR)
475endif
476
b87b4742 477ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
397fe5cc 478LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
6cdf2481 479LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
b87b4742
PK
480
481target-purgelocales:
482 rm -f $(LOCALE_WHITELIST)
483 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
484
485 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
486 do \
487 for lang in $$(cd $$dir; ls .|grep -v man); \
488 do \
489 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
490 done; \
491 done
492endif
493
aebf199f
TP
494ifneq ($(GENERATE_LOCALE),)
495# Generate locale data. Basically, we call the localedef program
496# (built by the host-localedef package) for each locale. The input
497# data comes preferably from the toolchain, or if the toolchain does
498# not have them (Linaro toolchains), we use the ones available on the
499# host machine.
500target-generatelocales: host-localedef
501 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
502 $(Q)for locale in $(GENERATE_LOCALE) ; do \
503 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
504 charmap=`echo $${locale} | cut -f2 -d'.'` ; \
505 if test -z "$${charmap}" ; then \
506 charmap="UTF-8" ; \
507 fi ; \
508 echo "Generating locale $${inputfile}.$${charmap}" ; \
509 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
510 $(HOST_DIR)/usr/bin/localedef \
511 --prefix=$(TARGET_DIR) \
512 --`echo $(BR2_ENDIAN) | tr [A-Z] [a-z]`-endian \
513 -i $${inputfile} -f $${charmap} \
514 $${locale} ; \
515 done
516endif
517
4eb982cf 518source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
08782ae7 519
155971e0 520external-deps:
22c2c6b5 521 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
155971e0 522
7e76f904
LC
523legal-info-clean:
524 @rm -fr $(LEGAL_INFO_DIR)
525
526legal-info-prepare: $(LEGAL_INFO_DIR)
527 @$(call MESSAGE,"Collecting legal info")
528 @$(call legal-license-file,buildroot,COPYING,COPYING)
529 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
530 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
531 @$(call legal-warning,the Buildroot source code has not been saved)
532 @$(call legal-warning,the toolchain has not been saved)
533 @cp $(CONFIG_DIR)/.config $(LEGAL_INFO_DIR)/buildroot.config
534
535legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
536 $(TARGETS_LEGAL_INFO)
537 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
538 @if [ -r $(LEGAL_WARNINGS) ]; then \
539 cat support/legal-info/README.warnings-header \
540 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
541 cat $(LEGAL_WARNINGS); fi
542 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
543 @rm -f $(LEGAL_WARNINGS)
544
b7d6c8ad
TP
545show-targets:
546 @echo $(TARGETS)
547
cfe511b2 548else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
2d523c23
EA
549
550all: menuconfig
551
552# configuration
553# ---------------------------------------------------------------------------
554
c0d7d4e0
BRF
555HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
556export HOSTCFLAGS
557
2cc210c9
PK
558$(BUILD_DIR)/buildroot-config/%onf:
559 mkdir -p $(@D)/lxdialog
17b66aff 560 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
2d523c23 561
1039eb74
TP
562COMMON_CONFIG_ENV = \
563 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
564 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
0b368800 565 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
1039eb74 566 BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
2d523c23 567
aefad531 568xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
39ca6d50 569 @mkdir -p $(BUILD_DIR)/buildroot-config
610255e7 570 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
b0df9df3 571
aefad531 572gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
39ca6d50 573 @mkdir -p $(BUILD_DIR)/buildroot-config
610255e7 574 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
2b42aae7 575
aefad531 576menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
39ca6d50 577 @mkdir -p $(BUILD_DIR)/buildroot-config
610255e7 578 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 579
aefad531 580nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
8b6585a9 581 @mkdir -p $(BUILD_DIR)/buildroot-config
610255e7 582 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 583
aefad531 584config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 585 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 586 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 587
aefad531 588oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 589 mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 590 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
2d523c23 591
aefad531 592randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 593 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 594 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
2d523c23 595
aefad531 596allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 597 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 598 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
2d523c23 599
aefad531 600allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 601 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 602 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
2d523c23 603
aefad531 604randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50
WW
605 @mkdir -p $(BUILD_DIR)/buildroot-config
606 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
1039eb74 607 @$(COMMON_CONFIG_ENV) \
39ca6d50 608 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 609 $< --randconfig $(CONFIG_CONFIG_IN)
39ca6d50 610 @rm -f $(CONFIG_DIR)/.config.nopkg
6652770f 611
aefad531 612allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50
WW
613 @mkdir -p $(BUILD_DIR)/buildroot-config
614 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
1039eb74 615 @$(COMMON_CONFIG_ENV) \
39ca6d50 616 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 617 $< --allyesconfig $(CONFIG_CONFIG_IN)
39ca6d50 618 @rm -f $(CONFIG_DIR)/.config.nopkg
6652770f 619
aefad531 620allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50
WW
621 @mkdir -p $(BUILD_DIR)/buildroot-config
622 @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
1039eb74 623 @$(COMMON_CONFIG_ENV) \
39ca6d50 624 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 625 $< --allnoconfig $(CONFIG_CONFIG_IN)
39ca6d50 626 @rm -f $(CONFIG_DIR)/.config.nopkg
6652770f 627
aefad531 628silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
0b368800
TP
629 @mkdir -p $(BUILD_DIR)/buildroot-config
630 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
631
aefad531 632defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 633 @mkdir -p $(BUILD_DIR)/buildroot-config
33f454bb 634 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(BR2_DEFCONFIG),=$(BR2_DEFCONFIG)) $(CONFIG_CONFIG_IN)
2d523c23 635
aefad531 636%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
6f38119c 637 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 638 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
6f38119c 639
aefad531 640savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
e1b1a18a 641 @mkdir -p $(BUILD_DIR)/buildroot-config
35ac32d1 642 @$(COMMON_CONFIG_ENV) $< --savedefconfig=$(CONFIG_DIR)/defconfig $(CONFIG_CONFIG_IN)
2d523c23 643
6547bced 644# check if download URLs are outdated
07bae756 645source-check:
7c297459 646 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
825ff341 647
406053d5
PK
648endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
649
2d523c23
EA
650#############################################################
651#
652# Cleanup and misc junk
653#
654#############################################################
aefad531
YM
655
656# outputmakefile generates a Makefile in the output directory, if using a
657# separate output directory. This allows convenient use of make in the
658# output directory.
659outputmakefile:
660ifeq ($(NEED_WRAPPER),y)
f082c7c5 661 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
aefad531
YM
662endif
663
2d523c23 664clean:
406053d5 665 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
7e76f904
LC
666 $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
667 $(LEGAL_INFO_DIR)
2d523c23
EA
668
669distclean: clean
406053d5
PK
670ifeq ($(DL_DIR),$(TOPDIR)/dl)
671 rm -rf $(DL_DIR)
672endif
673ifeq ($(O),output)
674 rm -rf $(O)
675endif
610255e7 676 rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
2d523c23 677
b8f28d65
US
678cross: $(BASE_TARGETS)
679
e491fba2
BRF
680help:
681 @echo 'Cleaning:'
406053d5 682 @echo ' clean - delete all files created by build'
e491fba2
BRF
683 @echo ' distclean - delete all non-source files (including .config)'
684 @echo
685 @echo 'Build:'
686 @echo ' all - make world'
040f6a32
SH
687 @echo ' <package>-rebuild - force recompile <package>'
688 @echo ' <package>-reconfigure - force reconfigure <package>'
e491fba2
BRF
689 @echo
690 @echo 'Configuration:'
691 @echo ' menuconfig - interactive curses-based configurator'
15f5bef0 692 @echo ' nconfig - interactive ncurses-based configurator'
c48bbb8c 693 @echo ' xconfig - interactive Qt-based configurator'
2b42aae7 694 @echo ' gconfig - interactive GTK-based configurator'
e491fba2 695 @echo ' oldconfig - resolve any unresolved symbols in .config'
c48bbb8c
PK
696 @echo ' randconfig - New config with random answer to all options'
697 @echo ' defconfig - New config with default answer to all options'
33f454bb 698 @echo ' BR2_DEFCONFIG, if set, is used as input'
d7051da8 699 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
c48bbb8c
PK
700 @echo ' allyesconfig - New config where all options are accepted with yes'
701 @echo ' allnoconfig - New config where all options are answered with no'
6652770f
PK
702 @echo ' randpackageconfig - New config with random answer to package options'
703 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
704 @echo ' allnopackageconfig - New config where package options are answered with no'
4bb33dce
PK
705ifeq ($(BR2_PACKAGE_BUSYBOX),y)
706 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
707endif
708ifeq ($(BR2_LINUX_KERNEL),y)
709 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
f5777ce8 710 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
4bb33dce
PK
711endif
712ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
713 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
714endif
715ifeq ($(BR2_TOOLCHAIN_CTNG),y)
716 @echo ' ctng-menuconfig - Run crosstool-NG menuconfig'
83f1bf9e
JCPV
717endif
718ifeq ($(BR2_TARGET_BAREBOX),y)
719 @echo ' barebox-menuconfig - Run barebox menuconfig'
720 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
4bb33dce 721endif
8792cf9e
TP
722 @echo
723 @echo 'Documentation:'
724 @echo ' manual - build manual in HTML, split HTML, PDF and txt'
725 @echo ' manual-html - build manual in HTML'
726 @echo ' manual-split-html - build manual in split HTML'
727 @echo ' manual-pdf - build manual in PDF'
728 @echo ' manual-txt - build manual in txt'
729 @echo ' manual-epub - build manual in ePub'
e491fba2
BRF
730 @echo
731 @echo 'Miscellaneous:'
732 @echo ' source - download all sources needed for offline-build'
07bae756 733 @echo ' source-check - check selected packages for valid download URLs'
155971e0 734 @echo ' external-deps - list external packages used'
7e76f904 735 @echo ' legal-info - generate info about license compliance'
e491fba2 736 @echo
15f5bef0
PK
737 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
738 @echo ' make O=dir - Locate all output files in "dir", including .config'
739 @echo
b9796199 740 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
58fd779a
PK
741 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
742 @echo
8792cf9e 743 @echo 'See docs/README, or generate the Buildroot manual for further details'
663dee48 744 @echo
ba2e7e02 745
e5e8fae8 746release: OUT=buildroot-$(BR2_VERSION)
0dca7065 747
134ab1ce
PK
748# Create release tarballs. We need to fiddle a bit to add the generated
749# documentation to the git output
0dca7065 750release:
134ab1ce
PK
751 git archive --format=tar --prefix=$(OUT)/ master > $(OUT).tar
752 $(MAKE) O=$(OUT) manual-html manual-txt manual-pdf
753 tar rf $(OUT).tar $(OUT)
754 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
755 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
756 rm -rf $(OUT) $(OUT).tar
e62d2ecd 757
2b91ab7a
AVEM
758print-version:
759 @echo $(BR2_VERSION_FULL)
760
b7285d00 761include docs/manual/manual.mk
8792cf9e 762
6652770f 763.PHONY: $(noconfig_targets)
50cbb4a1 764
This page took 0.365363 seconds and 4 git commands to generate.