]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blobdiff - Makefile
check-package: check Config.* files
[coffee/buildroot.git] / Makefile
index c00e2008d17f0f85e9f9ba666c7eebfab664581c..941bf789c803635aa382b3c67d36baf5fae4179e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 #
 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
 # Copyright (C) 2006-2014 by the Buildroot developers <buildroot@uclibc.org>
-# Copyright (C) 2014-2016 by the Buildroot developers <buildroot@buildroot.org>
+# Copyright (C) 2014-2017 by the Buildroot developers <buildroot@buildroot.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,9 @@
 # You shouldn't need to mess with anything beyond this point...
 #--------------------------------------------------------------
 
+# Delete default rules. We don't use them. This saves a bit of time.
+.SUFFIXES:
+
 # we want bash as shell
 SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
         else if [ -x /bin/bash ]; then echo /bin/bash; \
@@ -34,18 +37,6 @@ SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 # build by preventing it from being forwarded to sub-make calls.
 ifneq ("$(origin O)", "command line")
 O := $(CURDIR)/output
-else
-# Other packages might also support Linux-style out of tree builds
-# with the O=<dir> syntax (E.G. BusyBox does). As make automatically
-# forwards command line variable definitions those packages get very
-# confused. Fix this by telling make to not do so.
-MAKEOVERRIDES :=
-# Strangely enough O is still passed to submakes with MAKEOVERRIDES
-# (with make 3.81 atleast), the only thing that changes is the output
-# of the origin function (command line -> environment).
-# Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
-# To really make O go away, we have to override it.
-override O := $(O)
 endif
 
 # Check if the current Buildroot execution meets all the pre-requisites.
@@ -95,7 +86,9 @@ else # umask / $(CURDIR) / $(O)
 all:
 
 # Set and export the version string
-export BR2_VERSION := 2016.11-git
+export BR2_VERSION := 2017.05-git
+# Actual time the release is cut (for reproducible builds)
+BR2_VERSION_EPOCH = 1488315000
 
 # Save running make version since it's clobbered by the make package
 RUNNING_MAKE_VERSION := $(MAKE_VERSION)
@@ -135,7 +128,8 @@ export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlo
 noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \
        defconfig %_defconfig allyesconfig allnoconfig silentoldconfig release \
        randpackageconfig allyespackageconfig allnopackageconfig \
-       print-version olddefconfig distclean
+       print-version olddefconfig distclean manual manual-html manual-split-html \
+       manual-pdf manual-text manual-epub
 
 # Some global targets do not trigger a build, but are used to collect
 # metadata, or do various checks. When such targets are triggered,
@@ -146,15 +140,25 @@ noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconf
 # We're building in two situations: when MAKECMDGOALS is empty
 # (default target is to build), or when MAKECMDGOALS contains
 # something else than one of the nobuild_targets.
-nobuild_targets := source source-check \
-       legal-info external-deps _external-deps \
-       clean distclean help
+nobuild_targets := source %-source source-check \
+       legal-info %-legal-info external-deps _external-deps \
+       clean distclean help show-targets graph-depends \
+       %-graph-depends %-show-depends %-show-version \
+       graph-build graph-size list-defconfigs \
+       savedefconfig printvars
 ifeq ($(MAKECMDGOALS),)
 BR_BUILDING = y
 else ifneq ($(filter-out $(nobuild_targets),$(MAKECMDGOALS)),)
 BR_BUILDING = y
 endif
 
+# We call make recursively to build packages. The command-line overrides that
+# are passed to Buildroot don't apply to those package build systems. In
+# particular, we don't want to pass down the O=<dir> option for out-of-tree
+# builds, because the value specified on the command line will not be correct
+# for packages.
+MAKEOVERRIDES :=
+
 # Include some helper macros and variables
 include support/misc/utils.mk
 
@@ -170,10 +174,10 @@ endif
 
 # bash prints the name of the directory on 'cd <dir>' if CDPATH is
 # set, so unset it here to not cause problems. Notice that the export
-# line doesn't affect the environment of $(shell ..) calls, so
-# explictly throw away any output from 'cd' here.
+# line doesn't affect the environment of $(shell ..) calls.
 export CDPATH :=
-BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
+
+BASE_DIR := $(CANONICAL_O)
 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
 
 
@@ -244,9 +248,13 @@ endif
 
 # timezone and locale may affect build output
 ifeq ($(BR2_REPRODUCIBLE),y)
-export TZ=UTC
-export LANG=C
-export LC_ALL=C
+export TZ = UTC
+export LANG = C
+export LC_ALL = C
+export GZIP = -n
+BR2_VERSION_GIT_EPOCH = $(shell GIT_DIR=$(TOPDIR)/.git $(GIT) log -1 --format=%at)
+export SOURCE_DATE_EPOCH = $(if $(wildcard $(TOPDIR)/.git),$(BR2_VERSION_GIT_EPOCH),$(BR2_VERSION_EPOCH))
+DEPENDENCIES_HOST_PREREQ += host-fakedate
 endif
 
 # To put more focus on warnings, be less verbose as default
@@ -315,6 +323,7 @@ HOSTLN := $(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
 HOSTNM := $(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
 HOSTOBJCOPY := $(shell which $(HOSTOBJCOPY) || type -p $(HOSTOBJCOPY) || echo objcopy)
 HOSTRANLIB := $(shell which $(HOSTRANLIB) || type -p $(HOSTRANLIB) || echo ranlib)
+SED := $(shell which sed || type -p sed) -i -e
 
 export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
@@ -393,6 +402,7 @@ unexport QMAKESPEC
 unexport TERMINFO
 unexport MACHINE
 unexport O
+unexport GCC_COLORS
 
 GNU_HOST_NAME := $(shell support/gnuconfig/config.guess)
 
@@ -412,6 +422,7 @@ KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
        -e s/arm.*/arm/ -e s/sa110/arm/ \
        -e s/aarch64.*/arm64/ \
        -e s/bfin/blackfin/ \
+       -e s/or1k/openrisc/ \
        -e s/parisc64/parisc/ \
        -e s/powerpc64.*/powerpc/ \
        -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
@@ -421,6 +432,7 @@ KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
 ZCAT := $(call qstrip,$(BR2_ZCAT))
 BZCAT := $(call qstrip,$(BR2_BZCAT))
 XZCAT := $(call qstrip,$(BR2_XZCAT))
+LZCAT := $(call qstrip,$(BR2_LZCAT))
 TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
 
 # packages compiled for the host go here
@@ -467,6 +479,9 @@ all: world
 include Makefile.legacy
 
 include package/Makefile.in
+# arch/arch.mk.* must be after package/Makefile.in because it may need to
+# complement variables defined therein, like BR_NO_CHECK_HASH_FOR.
+-include $(wildcard arch/arch.mk.*)
 include support/dependencies/dependencies.mk
 
 include toolchain/*.mk
@@ -646,7 +661,7 @@ target-finalize: $(PACKAGES)
                $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
                $(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake
        find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
-       find $(TARGET_DIR)/lib $(TARGET_DIR)/usr/lib $(TARGET_DIR)/usr/libexec \
+       find $(TARGET_DIR)/lib/ $(TARGET_DIR)/usr/lib/ $(TARGET_DIR)/usr/libexec/ \
                \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
 ifneq ($(BR2_PACKAGE_GDB),y)
        rm -rf $(TARGET_DIR)/usr/share/gdb
@@ -661,20 +676,20 @@ endif
        rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
        rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
        rm -rf $(TARGET_DIR)/usr/share/gtk-doc
-       -rmdir $(TARGET_DIR)/usr/share 2>/dev/null
+       rmdir $(TARGET_DIR)/usr/share 2>/dev/null || true
        $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true
 
 # See http://sourceware.org/gdb/wiki/FAQ, "GDB does not see any threads
 # besides the one in which crash occurred; or SIGTRAP kills my program when
 # I set a breakpoint"
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
-       find $(TARGET_DIR)/lib -type f -name 'libpthread*.so*' | \
+       find $(TARGET_DIR)/lib/ -type f -name 'libpthread*.so*' | \
                xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
 endif
 
 # Valgrind needs ld.so with enough information, so only strip
 # debugging symbols.
-       find $(TARGET_DIR)/lib -type f -name 'ld-*.so*' | \
+       find $(TARGET_DIR)/lib/ -type f -name 'ld-*.so*' | \
                xargs -r $(STRIPCMD) $(STRIP_STRIP_DEBUG)
        test -f $(TARGET_DIR)/etc/ld.so.conf && \
                { echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true
@@ -721,7 +736,7 @@ legal-info-prepare: $(LEGAL_INFO_DIR)
        @$(call legal-license-file,buildroot,COPYING,COPYING,HOST)
        @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,TARGET)
        @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE,SOURCE SITE,HOST)
-       @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved,not saved,HOST)
+       @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPL-2.0+,COPYING,not saved,not saved,HOST)
        @$(call legal-warning,the Buildroot source code has not been saved)
        @cp $(BR2_CONFIG) $(LEGAL_INFO_DIR)/buildroot.config
 
@@ -925,7 +940,10 @@ printvars:
                $(sort $(if $(VARS),$(filter $(VARS),$(.VARIABLES)),$(.VARIABLES))), \
                $(if $(filter-out environment% default automatic, \
                                $(origin $V)), \
-               $(info $V=$($V) ($(value $V)))))
+               $(if $(QUOTED_VARS),\
+                       $(info $V='$(subst ','\'',$(if $(RAW_VARS),$(value $V),$($V)))'), \
+                       $(info $V=$(if $(RAW_VARS),$(value $V),$($V))))))
+# ' Syntax colouring...
 
 clean:
        rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
@@ -933,7 +951,7 @@ clean:
                $(LEGAL_INFO_DIR) $(GRAPHS_DIR)
 
 distclean: clean
-ifeq ($(O),output)
+ifeq ($(O),$(CURDIR)/output)
        rm -rf $(O)
 endif
        rm -rf $(TOPDIR)/dl $(BR2_CONFIG) $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/..config.tmp \
@@ -1003,6 +1021,7 @@ help:
        @echo '  source-check           - check selected packages for valid download URLs'
        @echo '  external-deps          - list external packages used'
        @echo '  legal-info             - generate info about license compliance'
+       @echo '  printvars              - dump all the internal variables'
        @echo
        @echo '  make V=0|1             - 0 => quiet build (default), 1 => verbose build'
        @echo '  make O=dir             - Locate all output files in "dir", including .config'
@@ -1056,6 +1075,9 @@ release:
 print-version:
        @echo $(BR2_VERSION_FULL)
 
+.gitlab-ci.yml: .gitlab-ci.yml.in configs/*_defconfig
+       (cd configs; LC_ALL=C ls -1 *_defconfig) | sed 's/$$/: *defconfig/' | cat $< - > $@
+
 include docs/manual/manual.mk
 -include $(foreach dir,$(BR2_EXTERNAL_DIRS),$(dir)/docs/*/*.mk)