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