]> Git Repo - buildroot-mgba.git/blame - Makefile
minidlna: fix linking with libintl if present
[buildroot-mgba.git] / Makefile
CommitLineData
2d523c23 1# Makefile for buildroot2
ffde94bd 2#
15b26aee 3# Copyright (C) 1999-2005 by Erik Andersen <[email protected]>
26b11df7 4# Copyright (C) 2006-2013 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
0c94aa54 27export BR2_VERSION:=2013.08-git
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 \
1ed49963 59 %_defconfig allyesconfig allnoconfig silentoldconfig release \
6652770f 60 randpackageconfig allyespackageconfig allnopackageconfig \
9db3b47e 61 source-check print-version olddefconfig
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
2b0f4552
YM
94BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
95
a1b0651a
US
96# Pull in the user's configuration file
97ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
dcb79995 98-include $(BUILDROOT_CONFIG)
7521f373 99endif
9741a49e 100
afc61c6e
BRF
101# To put more focus on warnings, be less verbose as default
102# Use 'make V=1' to see the full commands
103ifdef V
104 ifeq ("$(origin V)", "command line")
18d979c7 105 KBUILD_VERBOSE=$(V)
afc61c6e
BRF
106 endif
107endif
108ifndef KBUILD_VERBOSE
18d979c7 109 KBUILD_VERBOSE=0
afc61c6e
BRF
110endif
111
112ifeq ($(KBUILD_VERBOSE),1)
4df454e9 113 quiet=
18d979c7 114 Q=
1669b6ed
BRF
115ifndef VERBOSE
116 VERBOSE=1
117endif
afc61c6e
BRF
118else
119 quiet=quiet_
18d979c7 120 Q=@
afc61c6e
BRF
121endif
122
69f85924
PK
123# we want bash as shell
124SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
afc61c6e 125 else if [ -x /bin/bash ]; then echo /bin/bash; \
18d979c7 126 else echo sh; fi; fi)
afc61c6e 127
69f85924
PK
128# kconfig uses CONFIG_SHELL
129CONFIG_SHELL:=$(SHELL)
130
131export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
afc61c6e
BRF
132
133ifndef HOSTAR
134HOSTAR:=ar
135endif
136ifndef HOSTAS
137HOSTAS:=as
138endif
139ifndef HOSTCC
140HOSTCC:=gcc
17b66aff 141HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
afc61c6e 142endif
0df02e12 143HOSTCC_NOCCACHE:=$(HOSTCC)
afc61c6e
BRF
144ifndef HOSTCXX
145HOSTCXX:=g++
17b66aff 146HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
afc61c6e 147endif
0df02e12 148HOSTCXX_NOCCACHE:=$(HOSTCXX)
5f97580e
BRF
149ifndef HOSTFC
150HOSTFC:=gfortran
151endif
356133b4
US
152ifndef HOSTCPP
153HOSTCPP:=cpp
154endif
afc61c6e
BRF
155ifndef HOSTLD
156HOSTLD:=ld
157endif
0f9c5b11
US
158ifndef HOSTLN
159HOSTLN:=ln
160endif
356133b4
US
161ifndef HOSTNM
162HOSTNM:=nm
163endif
69f85924
PK
164HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
165HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
69f85924
PK
166HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
167HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
168HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
169HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
170HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
54e93328 171
5f97580e 172export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
17b66aff 173export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
afc61c6e 174
670cb306
AV
175# Make sure pkg-config doesn't look outside the buildroot tree
176unexport PKG_CONFIG_PATH
4f607edf 177unexport PKG_CONFIG_SYSROOT_DIR
670cb306 178
91123a6f
TP
179# Having DESTDIR set in the environment confuses the installation
180# steps of some packages.
181unexport DESTDIR
182
39ca6d50
WW
183# bash prints the name of the directory on 'cd <dir>' if CDPATH is
184# set, so unset it here to not cause problems. Notice that the export
185# line doesn't affect the environment of $(shell ..) calls, so
186# explictly throw away any output from 'cd' here.
187export CDPATH:=
188BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
189$(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
190
191BUILD_DIR:=$(BASE_DIR)/build
192
afc61c6e 193
cfe511b2 194ifeq ($(BR2_HAVE_DOT_CONFIG),y)
54e098e4 195
95442bb3 196################################################################################
2c649045
PK
197#
198# Hide troublesome environment variables from sub processes
199#
95442bb3 200################################################################################
2c649045
PK
201unexport CROSS_COMPILE
202unexport ARCH
2bf3c166
DN
203unexport CC
204unexport CXX
205unexport CPP
206unexport CFLAGS
207unexport CXXFLAGS
208unexport GREP_OPTIONS
12c9f7dd 209unexport CONFIG_SITE
32314b44 210unexport QMAKESPEC
20ca008d 211unexport TERMINFO
27bc59d4 212
102a93bd 213GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
60281cbf 214
95442bb3 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#
95442bb3 220################################################################################
17b66aff
TP
221
222ifeq ($(BR2_CCACHE),y)
223BASE_TARGETS += host-ccache
224endif
225
bc994c53 226ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
e236fe48 227BASE_TARGETS += toolchain-buildroot
e57e4b96
TP
228else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
229BASE_TARGETS += toolchain-external
230else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
231BASE_TARGETS += toolchain-crosstool-ng
7dcbbfbb 232endif
e57e4b96 233
acc706b7
BRF
234TARGETS:=
235
89464a96
PK
236# silent mode requested?
237QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
238
397fe5cc
TP
239# Strip off the annoying quoting
240ARCH:=$(call qstrip,$(BR2_ARCH))
65e80a0b 241
891973f5
PK
242KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
243 -e s/i.86/i386/ -e s/sun4u/sparc64/ \
f59aeca6 244 -e s/arcle/arc/ \
8332ffab 245 -e s/arceb/arc/ \
891973f5 246 -e s/arm.*/arm/ -e s/sa110/arm/ \
b90a1030 247 -e s/aarch64/arm64/ \
871db074 248 -e s/bfin/blackfin/ \
891973f5
PK
249 -e s/parisc64/parisc/ \
250 -e s/powerpc64/powerpc/ \
251 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
252 -e s/sh.*/sh/)
253
397fe5cc
TP
254ZCAT:=$(call qstrip,$(BR2_ZCAT))
255BZCAT:=$(call qstrip,$(BR2_BZCAT))
177b4b4a 256XZCAT:=$(call qstrip,$(BR2_XZCAT))
397fe5cc
TP
257TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
258
a2b4f7fb
GZ
259# packages compiled for the host go here
260HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
397fe5cc 261
aebf199f
TP
262# locales to generate
263GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
264
397fe5cc 265# stamp (dependency) files go here
3b2a803d 266STAMP_DIR:=$(BASE_DIR)/stamps
397fe5cc 267
3b2a803d
TP
268BINARIES_DIR:=$(BASE_DIR)/images
269TARGET_DIR:=$(BASE_DIR)/target
6c3e3ad4 270TARGET_SKELETON=$(TOPDIR)/system/skeleton
397fe5cc 271
7e76f904
LC
272LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
273REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
274LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
275LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
276LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
277LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
278LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
279
9226a990
TP
280# Location of a file giving a big fat warning that output/target
281# should not be used as the root filesystem.
282TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
283
17b66aff
TP
284ifeq ($(BR2_CCACHE),y)
285CCACHE:=$(HOST_DIR)/usr/bin/ccache
43329076
TDS
286BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
287export BUILDROOT_CACHE_DIR
17b66aff
TP
288HOSTCC := $(CCACHE) $(HOSTCC)
289HOSTCXX := $(CCACHE) $(HOSTCXX)
290endif
291
2b0f4552
YM
292# Scripts in support/ or post-build scripts may need to reference
293# these locations, so export them so it is easier to use
294export BUILDROOT_CONFIG
295export TARGET_DIR
296export STAGING_DIR
297export HOST_DIR
298export BINARIES_DIR
1300cb55 299export BASE_DIR
2b0f4552 300
95442bb3 301################################################################################
7dcbbfbb
BRF
302#
303# You should probably leave this stuff alone unless you know
304# what you are doing.
305#
95442bb3 306################################################################################
7dcbbfbb 307
6547bced 308all: world
ffde94bd 309
ebcfa987
AVEM
310# Include legacy before the other things, because package .mk files
311# may rely on it.
312ifneq ($(BR2_DEPRECATED),y)
313include Makefile.legacy
314endif
315
486253db 316include package/Makefile.in
a792668b
TDS
317include support/dependencies/dependencies.mk
318
d06645d8
EA
319# We also need the various per-package makefiles, which also add
320# each selected package to TARGETS if that package was selected
321# in the .config file.
bc994c53 322ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
ed020099 323include toolchain/toolchain-buildroot.mk
26b44b2b 324else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
ed020099 325include toolchain/toolchain-external.mk
10c1eec2
YM
326else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
327include toolchain/toolchain-crosstool-ng.mk
acc706b7
BRF
328endif
329
ee0246e1
TP
330# Include the package override file if one has been provided in the
331# configuration.
332PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
333ifneq ($(PACKAGE_OVERRIDE_FILE),)
334-include $(PACKAGE_OVERRIDE_FILE)
335endif
336
d06645d8 337include package/*/*.mk
d06645d8 338
64d8e9a0 339include boot/common.mk
64d8e9a0 340include linux/linux.mk
ec100c7e 341include system/system.mk
64d8e9a0 342
32faf351 343TARGETS+=target-finalize
d45de0ca 344
b87b4742
PK
345ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
346TARGETS+=target-purgelocales
347endif
348
381616e7 349ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
aebf199f
TP
350ifneq ($(GENERATE_LOCALE),)
351TARGETS+=target-generatelocales
352endif
353endif
354
217ef08a
TP
355ifeq ($(BR2_ECLIPSE_REGISTER),y)
356TARGETS+=toolchain-eclipse-register
357endif
358
649b5b92 359include fs/common.mk
79f5f1e8 360
9fa32ba0
TP
361TARGETS+=target-post-image
362
08782ae7 363TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
3b08e64d 364TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
08782ae7 365TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
b3efde23 366TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
22c2c6b5
PK
367
368# host-* dependencies have to be handled specially, as those aren't
369# visible in Kconfig and hence not added to a variable like TARGETS.
370# instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
371# variable for each enabled target.
372# Notice: this only works for newstyle gentargets/autotargets packages
373TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
374 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
375 $($(dep)))))
376# Host packages can in turn have their own dependencies. Likewise find
377# all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
378# host package found above. Ideally this should be done recursively until
379# no more packages are found, but that's hard to do in make, so limit to
380# 1 level for now.
381HOST_DEPS = $(sort $(foreach dep,\
382 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
383 $($(dep))))
384HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
385
7e76f904
LC
386TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
387 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
388
acc706b7 389# all targets depend on the crosscompiler and it's prerequisites
b3efde23 390$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
acc706b7 391
d21a176b 392dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
d0880f70 393 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
f958d897 394
ed7791e2 395$(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
f958d897 396
dcb79995 397$(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG)
c729829c 398 $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
0b368800
TP
399
400prepare: $(BUILD_DIR)/buildroot-config/auto.conf
401
2a786415 402toolchain: prepare dirs dependencies $(BASE_TARGETS)
ffde94bd 403
2a786415
FP
404world: toolchain $(TARGETS_ALL)
405
406.PHONY: all world toolchain dirs clean distclean source outputmakefile \
7e76f904 407 legal-info legal-info-prepare legal-info-clean \
b3efde23 408 $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
7e76f904 409 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
d21a176b 410 $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
d0880f70 411 $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
ffde94bd 412
95442bb3 413################################################################################
08782ae7 414#
ef407d3d 415# staging and target directories do NOT list these as
d99c31c6 416# dependencies anywhere else
08782ae7 417#
95442bb3 418################################################################################
d21a176b 419$(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
8d583fc0 420 @mkdir -p $@
3ad3d8a1 421
08782ae7 422$(STAGING_DIR):
9c865d75 423 @mkdir -p $(STAGING_DIR)/bin
bf38723f 424 @mkdir -p $(STAGING_DIR)/lib
8027784c 425 @mkdir -p $(STAGING_DIR)/usr/lib
8027784c 426 @mkdir -p $(STAGING_DIR)/usr/include
a05c337d 427 @mkdir -p $(STAGING_DIR)/usr/bin
5ad139eb 428 @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
ffde94bd 429
2b3a43f4
DM
430ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
431TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
432endif
433
397fe5cc 434$(BUILD_DIR)/.root:
7547c7eb 435 mkdir -p $(TARGET_DIR)
e97376a0
DM
436 rsync -a \
437 --exclude .empty --exclude .svn --exclude .git \
438 --exclude .hg --exclude=CVS --exclude '*~' \
13c07c79 439 $(TARGET_SKELETON)/ $(TARGET_DIR)/
9226a990 440 cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
7547c7eb 441 touch $@
08782ae7 442
397fe5cc 443$(TARGET_DIR): $(BUILD_DIR)/.root
c6771dfb 444
2a97045d
TDS
445STRIP_FIND_CMD = find $(TARGET_DIR)
446ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
447STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
448endif
449STRIP_FIND_CMD += -type f -perm +111
6ae7886f 450STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
2a97045d 451
32faf351 452target-finalize:
94d3aa17 453 rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
df99efb3
LC
454 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
455 $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
456 find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
027aa1d2
WB
457 find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
458 find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
e48a72e5
MS
459ifneq ($(BR2_PACKAGE_GDB),y)
460 rm -rf $(TARGET_DIR)/usr/share/gdb
461endif
87b0637b 462ifneq ($(BR2_HAVE_DOCUMENTATION),y)
32faf351 463 rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
32faf351 464 rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
87b0637b 465 rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
d701a823 466 rm -rf $(TARGET_DIR)/usr/share/gtk-doc
68ad6d4e 467 -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
b0c86bcc
TP
468endif
469ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
470 find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
471endif
472ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
473 find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
32faf351 474endif
2a97045d 475 $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
8101c9a3 476 find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
0dc940cd 477 xargs -r $(KSTRIPCMD) || true
8101c9a3 478
6ae7886f
RB
479# See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
480# besides the one in which crash occurred; or SIGTRAP kills my program when
481# I set a breakpoint"
482ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
483 find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
484 xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
485endif
486
4ccde7fa
TP
487 mkdir -p $(TARGET_DIR)/etc
488 # Mandatory configuration file and auxilliary cache directory
489 # for recent versions of ldconfig
490 touch $(TARGET_DIR)/etc/ld.so.conf
491 mkdir -p $(TARGET_DIR)/var/cache/ldconfig
e49e2fed
PK
492 if [ -x "$(TARGET_CROSS)ldconfig" ]; \
493 then \
4ccde7fa 494 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
e49e2fed 495 else \
4ccde7fa 496 /sbin/ldconfig -r $(TARGET_DIR); \
e49e2fed 497 fi
451a8878
PK
498 ( \
499 echo "NAME=Buildroot"; \
500 echo "VERSION=$(BR2_VERSION_FULL)"; \
501 echo "ID=buildroot"; \
502 echo "VERSION_ID=$(BR2_VERSION)"; \
503 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
504 ) > $(TARGET_DIR)/etc/os-release
912ea81a 505
e9b77128
LC
506 @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
507 $(call MESSAGE,"Copying overlay $(d)"); \
7f860892 508 rsync -a \
afea3037 509 --exclude .empty --exclude .svn --exclude .git \
e97376a0 510 --exclude .hg --exclude=CVS --exclude '*~' \
e9b77128 511 $(d)/ $(TARGET_DIR)$(sep))
7f860892 512
dbf4978e 513 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
1b9b1685 514 $(call MESSAGE,"Executing post-build script $(s)"); \
f1f97b3a 515 $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
eed7d873 516
b87b4742 517ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
397fe5cc 518LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
6cdf2481 519LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
b87b4742
PK
520
521target-purgelocales:
522 rm -f $(LOCALE_WHITELIST)
523 for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
524
525 for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
526 do \
527 for lang in $$(cd $$dir; ls .|grep -v man); \
528 do \
529 grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
530 done; \
531 done
532endif
533
aebf199f
TP
534ifneq ($(GENERATE_LOCALE),)
535# Generate locale data. Basically, we call the localedef program
536# (built by the host-localedef package) for each locale. The input
537# data comes preferably from the toolchain, or if the toolchain does
538# not have them (Linaro toolchains), we use the ones available on the
539# host machine.
540target-generatelocales: host-localedef
541 $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
542 $(Q)for locale in $(GENERATE_LOCALE) ; do \
543 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
544 charmap=`echo $${locale} | cut -f2 -d'.'` ; \
545 if test -z "$${charmap}" ; then \
546 charmap="UTF-8" ; \
547 fi ; \
548 echo "Generating locale $${inputfile}.$${charmap}" ; \
549 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
550 $(HOST_DIR)/usr/bin/localedef \
551 --prefix=$(TARGET_DIR) \
552 --`echo $(BR2_ENDIAN) | tr [A-Z] [a-z]`-endian \
553 -i $${inputfile} -f $${charmap} \
554 $${locale} ; \
555 done
556endif
557
9fa32ba0 558target-post-image:
9fa32ba0 559 @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
6d90a69f 560 $(call MESSAGE,"Executing post-image script $(s)"); \
f1f97b3a 561 $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
9fa32ba0 562
217ef08a
TP
563toolchain-eclipse-register:
564 ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
565
4eb982cf 566source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
08782ae7 567
155971e0 568external-deps:
22c2c6b5 569 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
155971e0 570
7e76f904
LC
571legal-info-clean:
572 @rm -fr $(LEGAL_INFO_DIR)
573
574legal-info-prepare: $(LEGAL_INFO_DIR)
575 @$(call MESSAGE,"Collecting legal info")
576 @$(call legal-license-file,buildroot,COPYING,COPYING)
577 @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
578 @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
579 @$(call legal-warning,the Buildroot source code has not been saved)
580 @$(call legal-warning,the toolchain has not been saved)
dcb79995 581 @cp $(BUILDROOT_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
7e76f904
LC
582
583legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
584 $(TARGETS_LEGAL_INFO)
585 @cat support/legal-info/README.header >>$(LEGAL_REPORT)
586 @if [ -r $(LEGAL_WARNINGS) ]; then \
587 cat support/legal-info/README.warnings-header \
588 $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
589 cat $(LEGAL_WARNINGS); fi
590 @echo "Legal info produced in $(LEGAL_INFO_DIR)"
591 @rm -f $(LEGAL_WARNINGS)
592
b7d6c8ad
TP
593show-targets:
594 @echo $(TARGETS)
595
cfe511b2 596else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
2d523c23
EA
597
598all: menuconfig
599
1ed49963
AVEM
600endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
601
2d523c23
EA
602# configuration
603# ---------------------------------------------------------------------------
604
c0d7d4e0
BRF
605HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
606export HOSTCFLAGS
607
2cc210c9
PK
608$(BUILD_DIR)/buildroot-config/%onf:
609 mkdir -p $(@D)/lxdialog
17b66aff 610 $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
2d523c23 611
1ed49963
AVEM
612DEFCONFIG = $(call qstrip,$(BR2_DEFCONFIG))
613
614# We don't want to fully expand BR2_DEFCONFIG here, so Kconfig will
615# recognize that if it's still at its default $(CONFIG_DIR)/defconfig
1039eb74 616COMMON_CONFIG_ENV = \
1ed49963 617 BR2_DEFCONFIG='$(call qstrip,$(value BR2_DEFCONFIG))' \
1039eb74
TP
618 KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
619 KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
0b368800 620 KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
dcb79995 621 BUILDROOT_CONFIG=$(BUILDROOT_CONFIG)
2d523c23 622
aefad531 623xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
39ca6d50 624 @mkdir -p $(BUILD_DIR)/buildroot-config
610255e7 625 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
b0df9df3 626
aefad531 627gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
39ca6d50 628 @mkdir -p $(BUILD_DIR)/buildroot-config
610255e7 629 @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
2b42aae7 630
aefad531 631menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
39ca6d50 632 @mkdir -p $(BUILD_DIR)/buildroot-config
610255e7 633 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 634
aefad531 635nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
8b6585a9 636 @mkdir -p $(BUILD_DIR)/buildroot-config
610255e7 637 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 638
aefad531 639config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 640 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 641 @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
2d523c23 642
aefad531 643oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 644 mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 645 @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
2d523c23 646
aefad531 647randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 648 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 649 @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
2d523c23 650
aefad531 651allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 652 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 653 @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
2d523c23 654
aefad531 655allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 656 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 657 @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
2d523c23 658
aefad531 659randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 660 @mkdir -p $(BUILD_DIR)/buildroot-config
dcb79995 661 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
8a46d4bf
PK
662 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
663 while read config pkg; do \
664 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
1039eb74 665 @$(COMMON_CONFIG_ENV) \
39ca6d50 666 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 667 $< --randconfig $(CONFIG_CONFIG_IN)
39ca6d50 668 @rm -f $(CONFIG_DIR)/.config.nopkg
6652770f 669
aefad531 670allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 671 @mkdir -p $(BUILD_DIR)/buildroot-config
dcb79995 672 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
8a46d4bf
PK
673 @grep '^config BR2_PACKAGE_' Config.in.legacy | \
674 while read config pkg; do \
675 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
1039eb74 676 @$(COMMON_CONFIG_ENV) \
39ca6d50 677 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 678 $< --allyesconfig $(CONFIG_CONFIG_IN)
39ca6d50 679 @rm -f $(CONFIG_DIR)/.config.nopkg
6652770f 680
aefad531 681allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 682 @mkdir -p $(BUILD_DIR)/buildroot-config
dcb79995 683 @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
1039eb74 684 @$(COMMON_CONFIG_ENV) \
39ca6d50 685 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
1039eb74 686 $< --allnoconfig $(CONFIG_CONFIG_IN)
39ca6d50 687 @rm -f $(CONFIG_DIR)/.config.nopkg
6652770f 688
aefad531 689silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
0b368800
TP
690 @mkdir -p $(BUILD_DIR)/buildroot-config
691 $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
692
9db3b47e
TP
693olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
694 @mkdir -p $(BUILD_DIR)/buildroot-config
695 $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
696
aefad531 697defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
39ca6d50 698 @mkdir -p $(BUILD_DIR)/buildroot-config
1ed49963 699 @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
2d523c23 700
aefad531 701%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
6f38119c 702 @mkdir -p $(BUILD_DIR)/buildroot-config
1039eb74 703 @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
6f38119c 704
aefad531 705savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
e1b1a18a 706 @mkdir -p $(BUILD_DIR)/buildroot-config
1ed49963
AVEM
707 @$(COMMON_CONFIG_ENV) $< \
708 --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
709 $(CONFIG_CONFIG_IN)
2d523c23 710
6547bced 711# check if download URLs are outdated
07bae756 712source-check:
7c297459 713 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
825ff341 714
1ed49963 715.PHONY: defconfig savedefconfig
406053d5 716
95442bb3 717################################################################################
2d523c23
EA
718#
719# Cleanup and misc junk
720#
95442bb3 721################################################################################
aefad531
YM
722
723# outputmakefile generates a Makefile in the output directory, if using a
724# separate output directory. This allows convenient use of make in the
725# output directory.
726outputmakefile:
727ifeq ($(NEED_WRAPPER),y)
f082c7c5 728 $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
aefad531
YM
729endif
730
2d523c23 731clean:
406053d5 732 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
d21a176b 733 $(STAMP_DIR) $(BUILD_DIR) $(BASE_DIR)/staging \
7e76f904 734 $(LEGAL_INFO_DIR)
2d523c23
EA
735
736distclean: clean
406053d5
PK
737ifeq ($(DL_DIR),$(TOPDIR)/dl)
738 rm -rf $(DL_DIR)
739endif
740ifeq ($(O),output)
741 rm -rf $(O)
742endif
dcb79995 743 rm -rf $(BUILDROOT_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
2d523c23 744
e491fba2
BRF
745help:
746 @echo 'Cleaning:'
406053d5 747 @echo ' clean - delete all files created by build'
e491fba2
BRF
748 @echo ' distclean - delete all non-source files (including .config)'
749 @echo
750 @echo 'Build:'
751 @echo ' all - make world'
2a786415 752 @echo ' toolchain - build toolchain'
040f6a32
SH
753 @echo ' <package>-rebuild - force recompile <package>'
754 @echo ' <package>-reconfigure - force reconfigure <package>'
e491fba2
BRF
755 @echo
756 @echo 'Configuration:'
757 @echo ' menuconfig - interactive curses-based configurator'
15f5bef0 758 @echo ' nconfig - interactive ncurses-based configurator'
c48bbb8c 759 @echo ' xconfig - interactive Qt-based configurator'
2b42aae7 760 @echo ' gconfig - interactive GTK-based configurator'
e491fba2 761 @echo ' oldconfig - resolve any unresolved symbols in .config'
9db3b47e
TP
762 @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
763 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
c48bbb8c
PK
764 @echo ' randconfig - New config with random answer to all options'
765 @echo ' defconfig - New config with default answer to all options'
33f454bb 766 @echo ' BR2_DEFCONFIG, if set, is used as input'
d7051da8 767 @echo ' savedefconfig - Save current config as ./defconfig (minimal config)'
c48bbb8c
PK
768 @echo ' allyesconfig - New config where all options are accepted with yes'
769 @echo ' allnoconfig - New config where all options are answered with no'
6652770f
PK
770 @echo ' randpackageconfig - New config with random answer to package options'
771 @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
772 @echo ' allnopackageconfig - New config where package options are answered with no'
4bb33dce
PK
773ifeq ($(BR2_PACKAGE_BUSYBOX),y)
774 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
775endif
776ifeq ($(BR2_LINUX_KERNEL),y)
777 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
f5777ce8 778 @echo ' linux-savedefconfig - Run Linux kernel savedefconfig'
4bb33dce
PK
779endif
780ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
781 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
782endif
783ifeq ($(BR2_TOOLCHAIN_CTNG),y)
784 @echo ' ctng-menuconfig - Run crosstool-NG menuconfig'
83f1bf9e
JCPV
785endif
786ifeq ($(BR2_TARGET_BAREBOX),y)
787 @echo ' barebox-menuconfig - Run barebox menuconfig'
788 @echo ' barebox-savedefconfig - Run barebox savedefconfig'
4bb33dce 789endif
8792cf9e
TP
790 @echo
791 @echo 'Documentation:'
792 @echo ' manual - build manual in HTML, split HTML, PDF and txt'
793 @echo ' manual-html - build manual in HTML'
794 @echo ' manual-split-html - build manual in split HTML'
795 @echo ' manual-pdf - build manual in PDF'
796 @echo ' manual-txt - build manual in txt'
797 @echo ' manual-epub - build manual in ePub'
e491fba2
BRF
798 @echo
799 @echo 'Miscellaneous:'
800 @echo ' source - download all sources needed for offline-build'
07bae756 801 @echo ' source-check - check selected packages for valid download URLs'
155971e0 802 @echo ' external-deps - list external packages used'
7e76f904 803 @echo ' legal-info - generate info about license compliance'
e491fba2 804 @echo
15f5bef0
PK
805 @echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
806 @echo ' make O=dir - Locate all output files in "dir", including .config'
807 @echo
b9796199 808 @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
58fd779a
PK
809 printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
810 @echo
8792cf9e 811 @echo 'See docs/README, or generate the Buildroot manual for further details'
663dee48 812 @echo
ba2e7e02 813
e5e8fae8 814release: OUT=buildroot-$(BR2_VERSION)
0dca7065 815
134ab1ce
PK
816# Create release tarballs. We need to fiddle a bit to add the generated
817# documentation to the git output
0dca7065 818release:
134ab1ce
PK
819 git archive --format=tar --prefix=$(OUT)/ master > $(OUT).tar
820 $(MAKE) O=$(OUT) manual-html manual-txt manual-pdf
821 tar rf $(OUT).tar $(OUT)
822 gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
823 bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
824 rm -rf $(OUT) $(OUT).tar
e62d2ecd 825
2b91ab7a
AVEM
826print-version:
827 @echo $(BR2_VERSION_FULL)
828
b7285d00 829include docs/manual/manual.mk
8792cf9e 830
6652770f 831.PHONY: $(noconfig_targets)
This page took 0.479395 seconds and 4 git commands to generate.