]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - Makefile
libelementary: depends on libethumb
[coffee/buildroot.git] / Makefile
1 # Makefile for buildroot2
2 #
3 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4 # Copyright (C) 2006-2012 by the Buildroot developers <buildroot@uclibc.org>
5 #
6 # This program is free software; you can redistribute it and/or modify
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.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
15 #
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
19 #
20
21 #--------------------------------------------------------------
22 # Just run 'make menuconfig', configure stuff, then run 'make'.
23 # You shouldn't need to mess with anything beyond this point...
24 #--------------------------------------------------------------
25
26 # Set and export the version string
27 export BR2_VERSION:=2013.02
28
29 # Check for minimal make version (note: this check will break at make 10.x)
30 MIN_MAKE_VERSION=3.81
31 ifneq ($(firstword $(sort $(MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MAKE_VERSION))
32 $(error You have make '$(MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required)
33 endif
34
35 export 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
45 # This top-level Makefile can *not* be executed in parallel
46 .NOTPARALLEL:
47
48 # absolute path
49 TOPDIR:=$(shell pwd)
50 CONFIG_CONFIG_IN=Config.in
51 CONFIG=support/kconfig
52 DATE:=$(shell date +%Y%m%d)
53
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)
56 export BR2_VERSION_FULL:=$(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
57
58 noconfig_targets:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \
59         defconfig %_defconfig savedefconfig allyesconfig allnoconfig silentoldconfig release \
60         randpackageconfig allyespackageconfig allnopackageconfig \
61         source-check print-version
62
63 # Strip quotes and then whitespaces
64 qstrip=$(strip $(subst ",,$(1)))
65 #"))
66
67 # Variables for use in Make constructs
68 comma:=,
69 empty:=
70 space:=$(empty) $(empty)
71
72 ifneq ("$(origin O)", "command line")
73 O:=output
74 CONFIG_DIR:=$(TOPDIR)
75 NEED_WRAPPER=
76 else
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
81 MAKEOVERRIDES =
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.
87 override O:=$(O)
88 CONFIG_DIR:=$(O)
89 # we need to pass O= everywhere we call back into the toplevel makefile
90 EXTRAMAKEARGS = O=$(O)
91 NEED_WRAPPER=y
92 endif
93
94 # Pull in the user's configuration file
95 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
96 -include $(CONFIG_DIR)/.config
97 endif
98
99 # To put more focus on warnings, be less verbose as default
100 # Use 'make V=1' to see the full commands
101 ifdef V
102   ifeq ("$(origin V)", "command line")
103     KBUILD_VERBOSE=$(V)
104   endif
105 endif
106 ifndef KBUILD_VERBOSE
107   KBUILD_VERBOSE=0
108 endif
109
110 ifeq ($(KBUILD_VERBOSE),1)
111   quiet=
112   Q=
113 ifndef VERBOSE
114   VERBOSE=1
115 endif
116 else
117   quiet=quiet_
118   Q=@
119 endif
120
121 # we want bash as shell
122 SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
123         else if [ -x /bin/bash ]; then echo /bin/bash; \
124         else echo sh; fi; fi)
125
126 # kconfig uses CONFIG_SHELL
127 CONFIG_SHELL:=$(SHELL)
128
129 export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
130
131 ifndef HOSTAR
132 HOSTAR:=ar
133 endif
134 ifndef HOSTAS
135 HOSTAS:=as
136 endif
137 ifndef HOSTCC
138 HOSTCC:=gcc
139 HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
140 endif
141 HOSTCC_NOCCACHE:=$(HOSTCC)
142 ifndef HOSTCXX
143 HOSTCXX:=g++
144 HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
145 endif
146 HOSTCXX_NOCCACHE:=$(HOSTCXX)
147 ifndef HOSTFC
148 HOSTFC:=gfortran
149 endif
150 ifndef HOSTCPP
151 HOSTCPP:=cpp
152 endif
153 ifndef HOSTLD
154 HOSTLD:=ld
155 endif
156 ifndef HOSTLN
157 HOSTLN:=ln
158 endif
159 ifndef HOSTNM
160 HOSTNM:=nm
161 endif
162 HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
163 HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
164 HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
165 HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
166 HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
167 HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
168 HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
169
170 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
171 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
172
173 # Make sure pkg-config doesn't look outside the buildroot tree
174 unexport PKG_CONFIG_PATH
175 unexport PKG_CONFIG_SYSROOT_DIR
176
177 # Having DESTDIR set in the environment confuses the installation
178 # steps of some packages.
179 unexport DESTDIR
180
181 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
182 # set, so unset it here to not cause problems. Notice that the export
183 # line doesn't affect the environment of $(shell ..) calls, so
184 # explictly throw away any output from 'cd' here.
185 export CDPATH:=
186 BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
187 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
188
189 BUILD_DIR:=$(BASE_DIR)/build
190
191
192 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
193
194 #############################################################
195 #
196 # Hide troublesome environment variables from sub processes
197 #
198 #############################################################
199 unexport CROSS_COMPILE
200 unexport ARCH
201 unexport CC
202 unexport CXX
203 unexport CPP
204 unexport CFLAGS
205 unexport CXXFLAGS
206 unexport GREP_OPTIONS
207 unexport CONFIG_SITE
208 unexport QMAKESPEC
209
210 GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
211
212 ##############################################################
213 #
214 # The list of stuff to build for the target toolchain
215 # along with the packages to build for the target.
216 #
217 ##############################################################
218
219 ifeq ($(BR2_CCACHE),y)
220 BASE_TARGETS += host-ccache
221 endif
222
223 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
224 BASE_TARGETS += uclibc-configured host-binutils cross_compiler uclibc-target-utils kernel-headers
225 else
226 BASE_TARGETS += uclibc
227 endif
228 TARGETS:=
229
230 # silent mode requested?
231 QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
232
233 # Strip off the annoying quoting
234 ARCH:=$(call qstrip,$(BR2_ARCH))
235
236 KERNEL_ARCH:=$(shell echo "$(ARCH)" | sed -e "s/-.*//" \
237         -e s/i.86/i386/ -e s/sun4u/sparc64/ \
238         -e s/arm.*/arm/ -e s/sa110/arm/ \
239         -e s/aarch64/arm64/ \
240         -e s/bfin/blackfin/ \
241         -e s/parisc64/parisc/ \
242         -e s/powerpc64/powerpc/ \
243         -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
244         -e s/sh.*/sh/)
245
246 ZCAT:=$(call qstrip,$(BR2_ZCAT))
247 BZCAT:=$(call qstrip,$(BR2_BZCAT))
248 XZCAT:=$(call qstrip,$(BR2_XZCAT))
249 TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
250
251 # packages compiled for the host go here
252 HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
253
254 # locales to generate
255 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
256
257 # stamp (dependency) files go here
258 STAMP_DIR:=$(BASE_DIR)/stamps
259
260 BINARIES_DIR:=$(BASE_DIR)/images
261 TARGET_DIR:=$(BASE_DIR)/target
262 TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
263 TARGET_SKELETON=$(TOPDIR)/system/skeleton
264
265 LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
266 REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
267 LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
268 LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
269 LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
270 LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
271 LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
272
273 # Location of a file giving a big fat warning that output/target
274 # should not be used as the root filesystem.
275 TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
276
277 ifeq ($(BR2_CCACHE),y)
278 CCACHE:=$(HOST_DIR)/usr/bin/ccache
279 BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
280 export BUILDROOT_CACHE_DIR
281 HOSTCC  := $(CCACHE) $(HOSTCC)
282 HOSTCXX := $(CCACHE) $(HOSTCXX)
283 endif
284
285 #############################################################
286 #
287 # You should probably leave this stuff alone unless you know
288 # what you are doing.
289 #
290 #############################################################
291
292 all: world
293
294 # Include legacy before the other things, because package .mk files
295 # may rely on it.
296 ifneq ($(BR2_DEPRECATED),y)
297 include Makefile.legacy
298 endif
299
300 include package/Makefile.in
301 include support/dependencies/dependencies.mk
302
303 # We also need the various per-package makefiles, which also add
304 # each selected package to TARGETS if that package was selected
305 # in the .config file.
306 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
307 include toolchain/toolchain-buildroot.mk
308 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
309 include toolchain/toolchain-external.mk
310 else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
311 include toolchain/toolchain-crosstool-ng.mk
312 endif
313
314 # Include the package override file if one has been provided in the
315 # configuration.
316 PACKAGE_OVERRIDE_FILE=$(call qstrip,$(BR2_PACKAGE_OVERRIDE_FILE))
317 ifneq ($(PACKAGE_OVERRIDE_FILE),)
318 -include $(PACKAGE_OVERRIDE_FILE)
319 endif
320
321 include package/*/*.mk
322
323 include boot/common.mk
324 include linux/linux.mk
325 include system/system.mk
326
327 TARGETS+=target-finalize
328
329 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
330 TARGETS+=target-purgelocales
331 endif
332
333 ifneq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_CTNG_eglibc)$(BR2_TOOLCHAIN_CTNG_glibc),)
334 ifneq ($(GENERATE_LOCALE),)
335 TARGETS+=target-generatelocales
336 endif
337 endif
338
339 include fs/common.mk
340
341 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
342 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
343 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
344 TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
345
346 # host-* dependencies have to be handled specially, as those aren't
347 # visible in Kconfig and hence not added to a variable like TARGETS.
348 # instead, find all the host-* targets listed in each <PKG>_DEPENDENCIES
349 # variable for each enabled target.
350 # Notice: this only works for newstyle gentargets/autotargets packages
351 TARGETS_HOST_DEPS = $(sort $(filter host-%,$(foreach dep,\
352                 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS))),\
353                 $($(dep)))))
354 # Host packages can in turn have their own dependencies. Likewise find
355 # all the package names listed in the HOST_<PKG>_DEPENDENCIES for each
356 # host package found above. Ideally this should be done recursively until
357 # no more packages are found, but that's hard to do in make, so limit to
358 # 1 level for now.
359 HOST_DEPS = $(sort $(foreach dep,\
360                 $(addsuffix _DEPENDENCIES,$(call UPPERCASE,$(TARGETS_HOST_DEPS))),\
361                 $($(dep))))
362 HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
363
364 TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
365                 $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
366
367 # all targets depend on the crosscompiler and it's prerequisites
368 $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
369
370 dirs: $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
371         $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
372
373 $(BASE_TARGETS): dirs $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake
374
375 $(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
376         $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
377
378 prepare: $(BUILD_DIR)/buildroot-config/auto.conf
379
380 world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
381
382 .PHONY: all world dirs clean distclean source outputmakefile \
383         legal-info legal-info-prepare legal-info-clean \
384         $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
385         $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
386         $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
387         $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
388
389 #############################################################
390 #
391 # staging and target directories do NOT list these as
392 # dependencies anywhere else
393 #
394 #############################################################
395 $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
396         @mkdir -p $@
397
398 $(STAGING_DIR):
399         @mkdir -p $(STAGING_DIR)/bin
400         @mkdir -p $(STAGING_DIR)/lib
401         @mkdir -p $(STAGING_DIR)/usr/lib
402         @mkdir -p $(STAGING_DIR)/usr/include
403         @mkdir -p $(STAGING_DIR)/usr/bin
404         @ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
405
406 ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
407 TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
408 endif
409
410 $(BUILD_DIR)/.root:
411         mkdir -p $(TARGET_DIR)
412         if ! [ -d "$(TARGET_DIR)/bin" ]; then \
413                 if [ -d "$(TARGET_SKELETON)" ]; then \
414                         cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
415                 fi; \
416         fi
417         cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
418         -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf
419         -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
420         touch $@
421
422 $(TARGET_DIR): $(BUILD_DIR)/.root
423
424 STRIP_FIND_CMD = find $(TARGET_DIR)
425 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
426 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
427 endif
428 STRIP_FIND_CMD += -type f -perm +111
429 STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print
430
431 target-finalize:
432 ifeq ($(BR2_HAVE_DEVFILES),y)
433         ( support/scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
434 else
435         rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
436                 $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig
437         find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
438         find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
439 endif
440 ifneq ($(BR2_PACKAGE_GDB),y)
441         rm -rf $(TARGET_DIR)/usr/share/gdb
442 endif
443 ifneq ($(BR2_HAVE_DOCUMENTATION),y)
444         rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
445         rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
446         rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
447         rm -rf $(TARGET_DIR)/usr/share/gtk-doc
448         -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
449 endif
450 ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
451         find $(TARGET_DIR)/usr/lib/ -name '*.pyc' -print0 | xargs -0 rm -f
452 endif
453 ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
454         find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f
455 endif
456         $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true
457         find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \
458                 xargs -r $(KSTRIPCMD) || true
459
460 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
461 # besides the one in which crash occurred; or SIGTRAP kills my program when
462 # I set a breakpoint"
463 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
464         find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
465                 xargs $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
466 endif
467
468         mkdir -p $(TARGET_DIR)/etc
469         # Mandatory configuration file and auxilliary cache directory
470         # for recent versions of ldconfig
471         touch $(TARGET_DIR)/etc/ld.so.conf
472         mkdir -p $(TARGET_DIR)/var/cache/ldconfig
473         if [ -x "$(TARGET_CROSS)ldconfig" ]; \
474         then \
475                 $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \
476         else \
477                 /sbin/ldconfig -r $(TARGET_DIR); \
478         fi
479         ( \
480                 echo "NAME=Buildroot"; \
481                 echo "VERSION=$(BR2_VERSION_FULL)"; \
482                 echo "ID=buildroot"; \
483                 echo "VERSION_ID=$(BR2_VERSION)"; \
484                 echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \
485         ) >  $(TARGET_DIR)/etc/os-release
486
487 ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"")
488         @$(call MESSAGE,"Executing post-build script\(s\)")
489         @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
490                 $(s) $(TARGET_DIR)$(sep))
491 endif
492
493 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
494 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
495 LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
496
497 target-purgelocales:
498         rm -f $(LOCALE_WHITELIST)
499         for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
500
501         for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
502         do \
503                 for lang in $$(cd $$dir; ls .|grep -v man); \
504                 do \
505                         grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
506                 done; \
507         done
508 endif
509
510 ifneq ($(GENERATE_LOCALE),)
511 # Generate locale data. Basically, we call the localedef program
512 # (built by the host-localedef package) for each locale. The input
513 # data comes preferably from the toolchain, or if the toolchain does
514 # not have them (Linaro toolchains), we use the ones available on the
515 # host machine.
516 target-generatelocales: host-localedef
517         $(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
518         $(Q)for locale in $(GENERATE_LOCALE) ; do \
519                 inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
520                 charmap=`echo $${locale} | cut -f2 -d'.'` ; \
521                 if test -z "$${charmap}" ; then \
522                         charmap="UTF-8" ; \
523                 fi ; \
524                 echo "Generating locale $${inputfile}.$${charmap}" ; \
525                 I18NPATH=$(STAGING_DIR)/usr/share/i18n:/usr/share/i18n \
526                 $(HOST_DIR)/usr/bin/localedef \
527                         --prefix=$(TARGET_DIR) \
528                         --`echo $(BR2_ENDIAN) | tr [A-Z] [a-z]`-endian \
529                         -i $${inputfile} -f $${charmap} \
530                         $${locale} ; \
531         done
532 endif
533
534 source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
535
536 external-deps:
537         @$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
538
539 legal-info-clean:
540         @rm -fr $(LEGAL_INFO_DIR)
541
542 legal-info-prepare: $(LEGAL_INFO_DIR)
543         @$(call MESSAGE,"Collecting legal info")
544         @$(call legal-license-file,buildroot,COPYING,COPYING)
545         @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
546         @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
547         @$(call legal-warning,the Buildroot source code has not been saved)
548         @$(call legal-warning,the toolchain has not been saved)
549         @cp $(CONFIG_DIR)/.config $(LEGAL_INFO_DIR)/buildroot.config
550
551 legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
552                 $(TARGETS_LEGAL_INFO)
553         @cat support/legal-info/README.header >>$(LEGAL_REPORT)
554         @if [ -r $(LEGAL_WARNINGS) ]; then \
555                 cat support/legal-info/README.warnings-header \
556                         $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
557                 cat $(LEGAL_WARNINGS); fi
558         @echo "Legal info produced in $(LEGAL_INFO_DIR)"
559         @rm -f $(LEGAL_WARNINGS)
560
561 show-targets:
562         @echo $(TARGETS)
563
564 else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
565
566 all: menuconfig
567
568 # configuration
569 # ---------------------------------------------------------------------------
570
571 HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
572 export HOSTCFLAGS
573
574 $(BUILD_DIR)/buildroot-config/%onf:
575         mkdir -p $(@D)/lxdialog
576         $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
577
578 COMMON_CONFIG_ENV = \
579         KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
580         KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \
581         KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \
582         BUILDROOT_CONFIG=$(CONFIG_DIR)/.config
583
584 xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile
585         @mkdir -p $(BUILD_DIR)/buildroot-config
586         @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
587
588 gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile
589         @mkdir -p $(BUILD_DIR)/buildroot-config
590         @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)
591
592 menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
593         @mkdir -p $(BUILD_DIR)/buildroot-config
594         @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
595
596 nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile
597         @mkdir -p $(BUILD_DIR)/buildroot-config
598         @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
599
600 config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
601         @mkdir -p $(BUILD_DIR)/buildroot-config
602         @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
603
604 oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
605         mkdir -p $(BUILD_DIR)/buildroot-config
606         @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
607
608 randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
609         @mkdir -p $(BUILD_DIR)/buildroot-config
610         @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
611
612 allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
613         @mkdir -p $(BUILD_DIR)/buildroot-config
614         @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
615
616 allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
617         @mkdir -p $(BUILD_DIR)/buildroot-config
618         @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
619
620 randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
621         @mkdir -p $(BUILD_DIR)/buildroot-config
622         @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
623         @grep '^config BR2_PACKAGE_' Config.in.legacy | \
624                 while read config pkg; do \
625                 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
626         @$(COMMON_CONFIG_ENV) \
627                 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
628                 $< --randconfig $(CONFIG_CONFIG_IN)
629         @rm -f $(CONFIG_DIR)/.config.nopkg
630
631 allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
632         @mkdir -p $(BUILD_DIR)/buildroot-config
633         @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
634         @grep '^config BR2_PACKAGE_' Config.in.legacy | \
635                 while read config pkg; do \
636                 echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
637         @$(COMMON_CONFIG_ENV) \
638                 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
639                 $< --allyesconfig $(CONFIG_CONFIG_IN)
640         @rm -f $(CONFIG_DIR)/.config.nopkg
641
642 allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
643         @mkdir -p $(BUILD_DIR)/buildroot-config
644         @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg
645         @$(COMMON_CONFIG_ENV) \
646                 KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
647                 $< --allnoconfig $(CONFIG_CONFIG_IN)
648         @rm -f $(CONFIG_DIR)/.config.nopkg
649
650 silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
651         @mkdir -p $(BUILD_DIR)/buildroot-config
652         $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
653
654 defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
655         @mkdir -p $(BUILD_DIR)/buildroot-config
656         @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(BR2_DEFCONFIG),=$(BR2_DEFCONFIG)) $(CONFIG_CONFIG_IN)
657
658 %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
659         @mkdir -p $(BUILD_DIR)/buildroot-config
660         @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
661
662 savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
663         @mkdir -p $(BUILD_DIR)/buildroot-config
664         @$(COMMON_CONFIG_ENV) $< --savedefconfig=$(CONFIG_DIR)/defconfig $(CONFIG_CONFIG_IN)
665
666 # check if download URLs are outdated
667 source-check:
668         $(MAKE) DL_MODE=SOURCE_CHECK $(EXTRAMAKEARGS) source
669
670 endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
671
672 #############################################################
673 #
674 # Cleanup and misc junk
675 #
676 #############################################################
677
678 # outputmakefile generates a Makefile in the output directory, if using a
679 # separate output directory. This allows convenient use of make in the
680 # output directory.
681 outputmakefile:
682 ifeq ($(NEED_WRAPPER),y)
683         $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
684 endif
685
686 clean:
687         rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
688                 $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
689                 $(LEGAL_INFO_DIR)
690
691 distclean: clean
692 ifeq ($(DL_DIR),$(TOPDIR)/dl)
693         rm -rf $(DL_DIR)
694 endif
695 ifeq ($(O),output)
696         rm -rf $(O)
697 endif
698         rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
699
700 cross: $(BASE_TARGETS)
701
702 help:
703         @echo 'Cleaning:'
704         @echo '  clean                  - delete all files created by build'
705         @echo '  distclean              - delete all non-source files (including .config)'
706         @echo
707         @echo 'Build:'
708         @echo '  all                    - make world'
709         @echo '  <package>-rebuild      - force recompile <package>'
710         @echo '  <package>-reconfigure  - force reconfigure <package>'
711         @echo
712         @echo 'Configuration:'
713         @echo '  menuconfig             - interactive curses-based configurator'
714         @echo '  nconfig                - interactive ncurses-based configurator'
715         @echo '  xconfig                - interactive Qt-based configurator'
716         @echo '  gconfig                - interactive GTK-based configurator'
717         @echo '  oldconfig              - resolve any unresolved symbols in .config'
718         @echo '  randconfig             - New config with random answer to all options'
719         @echo '  defconfig              - New config with default answer to all options'
720         @echo '                             BR2_DEFCONFIG, if set, is used as input'
721         @echo '  savedefconfig          - Save current config as ./defconfig (minimal config)'
722         @echo '  allyesconfig           - New config where all options are accepted with yes'
723         @echo '  allnoconfig            - New config where all options are answered with no'
724         @echo '  randpackageconfig      - New config with random answer to package options'
725         @echo '  allyespackageconfig    - New config where pkg options are accepted with yes'
726         @echo '  allnopackageconfig     - New config where package options are answered with no'
727 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
728         @echo '  busybox-menuconfig     - Run BusyBox menuconfig'
729 endif
730 ifeq ($(BR2_LINUX_KERNEL),y)
731         @echo '  linux-menuconfig       - Run Linux kernel menuconfig'
732         @echo '  linux-savedefconfig    - Run Linux kernel savedefconfig'
733 endif
734 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
735         @echo '  uclibc-menuconfig      - Run uClibc menuconfig'
736 endif
737 ifeq ($(BR2_TOOLCHAIN_CTNG),y)
738         @echo '  ctng-menuconfig        - Run crosstool-NG menuconfig'
739 endif
740 ifeq ($(BR2_TARGET_BAREBOX),y)
741         @echo '  barebox-menuconfig     - Run barebox menuconfig'
742         @echo '  barebox-savedefconfig  - Run barebox savedefconfig'
743 endif
744         @echo
745         @echo 'Documentation:'
746         @echo '  manual                 - build manual in HTML, split HTML, PDF and txt'
747         @echo '  manual-html            - build manual in HTML'
748         @echo '  manual-split-html      - build manual in split HTML'
749         @echo '  manual-pdf             - build manual in PDF'
750         @echo '  manual-txt             - build manual in txt'
751         @echo '  manual-epub            - build manual in ePub'
752         @echo
753         @echo 'Miscellaneous:'
754         @echo '  source                 - download all sources needed for offline-build'
755         @echo '  source-check           - check selected packages for valid download URLs'
756         @echo '  external-deps          - list external packages used'
757         @echo '  legal-info             - generate info about license compliance'
758         @echo
759         @echo '  make V=0|1             - 0 => quiet build (default), 1 => verbose build'
760         @echo '  make O=dir             - Locate all output files in "dir", including .config'
761         @echo
762         @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \
763           printf "  %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
764         @echo
765         @echo 'See docs/README, or generate the Buildroot manual for further details'
766         @echo
767
768 release: OUT=buildroot-$(BR2_VERSION)
769
770 # Create release tarballs. We need to fiddle a bit to add the generated
771 # documentation to the git output
772 release:
773         git archive --format=tar --prefix=$(OUT)/ master > $(OUT).tar
774         $(MAKE) O=$(OUT) manual-html manual-txt manual-pdf
775         tar rf $(OUT).tar $(OUT)
776         gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
777         bzip2 -9 -c < $(OUT).tar > $(OUT).tar.bz2
778         rm -rf $(OUT) $(OUT).tar
779
780 print-version:
781         @echo $(BR2_VERSION_FULL)
782
783 include docs/manual/manual.mk
784
785 .PHONY: $(noconfig_targets)