]> Git Repo - buildroot-mgba.git/blame - Makefile
lame: fix build if host has libgtk12-dev (gtk-config)
[buildroot-mgba.git] / Makefile
CommitLineData
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 27export 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
33TOPDIR:=$(shell pwd)
18d979c7 34CONFIG_CONFIG_IN=Config.in
18d979c7 35CONFIG=package/config
a8ee1240 36DATE:=$(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)
40export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/scripts/setlocalversion)
41
8b6585a9 42noconfig_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
48qstrip=$(strip $(subst ",,$(1)))
49#"))
50
f85f2de1
PK
51# Variables for use in Make constructs
52comma:=,
53empty:=
54space:=$(empty) $(empty)
55
39ca6d50
WW
56ifneq ("$(origin O)", "command line")
57O:=output
58CONFIG_DIR:=$(TOPDIR)
aefad531 59NEED_WRAPPER=
39ca6d50
WW
60else
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
65MAKEOVERRIDES =
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.
71override O:=$(O)
72CONFIG_DIR:=$(O)
de846f6e
PK
73# we need to pass O= everywhere we call back into the toplevel makefile
74EXTRAMAKEARGS = O=$(O)
aefad531 75NEED_WRAPPER=y
39ca6d50
WW
76endif
77
a1b0651a
US
78# Pull in the user's configuration file
79ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
39ca6d50 80-include $(CONFIG_DIR)/.config
7521f373 81endif
9741a49e 82
efd8576c
US
83# Override BR2_DL_DIR if shell variable defined
84ifneq ($(BUILDROOT_DL_DIR),)
85BR2_DL_DIR:=$(BUILDROOT_DL_DIR)
86endif
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
90ifdef V
91 ifeq ("$(origin V)", "command line")
18d979c7 92 KBUILD_VERBOSE=$(V)
afc61c6e
BRF
93 endif
94endif
95ifndef KBUILD_VERBOSE
18d979c7 96 KBUILD_VERBOSE=0
afc61c6e
BRF
97endif
98
99ifeq ($(KBUILD_VERBOSE),1)
4df454e9 100 quiet=
18d979c7 101 Q=
1669b6ed
BRF
102ifndef VERBOSE
103 VERBOSE=1
104endif
afc61c6e
BRF
105else
106 quiet=quiet_
18d979c7 107 Q=@
afc61c6e
BRF
108endif
109
69f85924
PK
110# we want bash as shell
111SHELL:=$(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
116CONFIG_SHELL:=$(SHELL)
117
118export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
afc61c6e
BRF
119
120ifndef HOSTAR
121HOSTAR:=ar
122endif
123ifndef HOSTAS
124HOSTAS:=as
125endif
126ifndef HOSTCC
127HOSTCC:=gcc
17b66aff 128HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
afc61c6e 129endif
0df02e12 130HOSTCC_NOCCACHE:=$(HOSTCC)
afc61c6e
BRF
131ifndef HOSTCXX
132HOSTCXX:=g++
17b66aff 133HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
afc61c6e 134endif
0df02e12 135HOSTCXX_NOCCACHE:=$(HOSTCXX)
5f97580e
BRF
136ifndef HOSTFC
137HOSTFC:=gfortran
138endif
356133b4
US
139ifndef HOSTCPP
140HOSTCPP:=cpp
141endif
afc61c6e
BRF
142ifndef HOSTLD
143HOSTLD:=ld
144endif
0f9c5b11
US
145ifndef HOSTLN
146HOSTLN:=ln
147endif
356133b4
US
148ifndef HOSTNM
149HOSTNM:=nm
150endif
69f85924
PK
151HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
152HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
69f85924
PK
153HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
154HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
155HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
156HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
157HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
54e93328 158
5f97580e 159export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
17b66aff 160export 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.
166export CDPATH:=
167BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
168$(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
169
170BUILD_DIR:=$(BASE_DIR)/build
171
afc61c6e 172
cfe511b2 173ifeq ($(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 179cc-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#############################################################
187unexport CROSS_COMPILE
188unexport ARCH
2bf3c166
DN
189unexport CC
190unexport CXX
191unexport CPP
192unexport CFLAGS
193unexport CXXFLAGS
194unexport GREP_OPTIONS
27bc59d4 195
c71816a8 196GNU_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 203ifneq ($(findstring linux,$(GNU_HOST_NAME)),)
c6e43c9d
BRF
204HOST_EXEEXT:=
205HOST_LIBEXT:=.a
206HOST_SHREXT:=.so
3096f34d 207endif
60281cbf 208ifneq ($(findstring apple,$(GNU_HOST_NAME)),)
c6e43c9d
BRF
209HOST_EXEEXT:=
210HOST_LIBEXT:=.a
211HOST_SHREXT:=.dylib
3096f34d 212endif
60281cbf 213ifneq ($(findstring cygwin,$(GNU_HOST_NAME)),)
c6e43c9d
BRF
214HOST_EXEEXT:=.exe
215HOST_LIBEXT:=.lib
216HOST_SHREXT:=.dll
f894e85e 217HOST_LOADLIBES=-lcurses -lintl
2c279671 218export HOST_LOADLIBES
3096f34d 219endif
60281cbf 220ifneq ($(findstring mingw,$(GNU_HOST_NAME)),)
c6e43c9d
BRF
221HOST_EXEEXT:=.exe
222HOST_LIBEXT:=.lib
223HOST_SHREXT:=.dll
3096f34d 224endif
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
233ifeq ($(BR2_CCACHE),y)
234BASE_TARGETS += host-ccache
235endif
236
bc994c53 237ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
009407e6 238BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
10c1eec2 239else
17b66aff 240BASE_TARGETS += uclibc
7dcbbfbb 241endif
acc706b7
BRF
242TARGETS:=
243
89464a96
PK
244# silent mode requested?
245QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
246
397fe5cc
TP
247# Strip off the annoying quoting
248ARCH:=$(call qstrip,$(BR2_ARCH))
249ifeq ($(ARCH),xtensa)
250ARCH:=$(ARCH)_$(call qstrip,$(BR2_xtensa_core_name))
251endif
65e80a0b 252
891973f5
PK
253KERNEL_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
262ZCAT:=$(call qstrip,$(BR2_ZCAT))
263BZCAT:=$(call qstrip,$(BR2_BZCAT))
264TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
265
397fe5cc
TP
266GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX))
267
a2b4f7fb
GZ
268# packages compiled for the host go here
269HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
397fe5cc
TP
270
271# stamp (dependency) files go here
3b2a803d 272STAMP_DIR:=$(BASE_DIR)/stamps
397fe5cc 273
3b2a803d
TP
274BINARIES_DIR:=$(BASE_DIR)/images
275TARGET_DIR:=$(BASE_DIR)/target
4c5bf461 276TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
fbc22eca 277TARGET_SKELETON=$(TOPDIR)/fs/skeleton
397fe5cc 278
397fe5cc 279BR2_DEPENDS_DIR=$(BUILD_DIR)/buildroot-config
1dbe6e33 280
17b66aff
TP
281ifeq ($(BR2_CCACHE),y)
282CCACHE:=$(HOST_DIR)/usr/bin/ccache
283CCACHE_CACHE_DIR=$(HOME)/.buildroot-ccache
284HOSTCC := $(CCACHE) $(HOSTCC)
285HOSTCXX := $(CCACHE) $(HOSTCXX)
286endif
287
7dcbbfbb
BRF
288include toolchain/Makefile.in
289include 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 298all: 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 303ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
ed020099 304include toolchain/toolchain-buildroot.mk
26b44b2b 305else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
ed020099 306include toolchain/toolchain-external.mk
10c1eec2
YM
307else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
308include toolchain/toolchain-crosstool-ng.mk
acc706b7
BRF
309endif
310
d06645d8 311include package/*/*.mk
d06645d8 312
64d8e9a0
PK
313include boot/common.mk
314include target/Makefile.in
315include linux/linux.mk
316
32faf351 317TARGETS+=target-finalize
d45de0ca 318
b87b4742
PK
319ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
320TARGETS+=target-purgelocales
321endif
322
649b5b92 323include fs/common.mk
79f5f1e8 324
02a623dd 325TARGETS+=erase-fakeroots
c2fc93bc 326
08782ae7 327TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
3b08e64d 328TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
08782ae7 329TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
b3efde23 330TARGETS_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
337TARGETS_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.
345HOST_DEPS = $(sort $(foreach dep,\
346 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
347 $($(dep))))
348HOST_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 353dirs: $(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
361prepare: $(BUILD_DIR)/buildroot-config/auto.conf
362
363world: 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
404ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
405TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
406endif
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 422erase-fakeroots:
397fe5cc 423 rm -f $(BUILD_DIR)/.fakeroot*
412ca2a4 424
32faf351 425target-finalize:
d45de0ca
JV
426ifeq ($(BR2_HAVE_DEVFILES),y)
427 ( 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
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
467ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"")
468 $(BR2_ROOTFS_POST_BUILD_SCRIPT) $(TARGET_DIR)
469endif
470
b87b4742 471ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
397fe5cc 472LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
6cdf2481 473LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
b87b4742
PK
474
475target-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
486endif
487
3b08e64d 488source: $(TARGETS_SOURCE) $(HOST_SOURCE)
08782ae7 489
6547bced 490_source-check:
d147b81f 491 $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
825ff341 492
155971e0 493external-deps:
22c2c6b5 494 @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
155971e0 495
b7d6c8ad
TP
496show-targets:
497 @echo $(TARGETS)
498
cfe511b2 499else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
2d523c23
EA
500
501all: menuconfig
502
503# configuration
504# ---------------------------------------------------------------------------
505
c0d7d4e0
BRF
506HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
507export 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
513COMMON_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 519xconfig: $(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 523gconfig: $(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 527menuconfig: $(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 531nconfig: $(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 535config: $(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 539oldconfig: $(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 543randconfig: $(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 547allyesconfig: $(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 551allnoconfig: $(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 555randpackageconfig: $(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 563allyespackageconfig: $(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 571allnopackageconfig: $(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 579silentoldconfig: $(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 583defconfig: $(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 591savedefconfig: $(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 596source-check: allyesconfig
de846f6e 597 $(MAKE) $(EXTRAMAKEARGS) _source-check
825ff341 598
406053d5
PK
599endif # 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.
610outputmakefile:
611ifeq ($(NEED_WRAPPER),y)
612 $(Q)$(TOPDIR)/scripts/mkmakefile $(TOPDIR) $(O)
613endif
614
2d523c23 615clean:
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
619distclean: clean
406053d5
PK
620ifeq ($(DL_DIR),$(TOPDIR)/dl)
621 rm -rf $(DL_DIR)
622endif
623ifeq ($(O),output)
624 rm -rf $(O)
625endif
610255e7 626 rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
2d523c23 627
b8f28d65
US
628cross: $(BASE_TARGETS)
629
e491fba2
BRF
630help:
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
652ifeq ($(BR2_PACKAGE_BUSYBOX),y)
653 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
654endif
655ifeq ($(BR2_LINUX_KERNEL),y)
656 @echo ' linux-menuconfig - Run Linux kernel menuconfig'
657endif
658ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
659 @echo ' uclibc-menuconfig - Run uClibc menuconfig'
660endif
661ifeq ($(BR2_TOOLCHAIN_CTNG),y)
662 @echo ' ctng-menuconfig - Run crosstool-NG menuconfig'
663endif
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 679release: OUT=buildroot-$(BR2_VERSION)
0dca7065
PK
680
681release:
e5e8fae8 682 git archive --format=tar --prefix=$(OUT)/ master|gzip -9 >$(OUT).tar.gz
e62d2ecd 683
6652770f 684.PHONY: $(noconfig_targets)
50cbb4a1 685
This page took 0.371854 seconds and 4 git commands to generate.