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