summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorLuca Ceresoli <luca@lucaceresoli.net>2012-05-17 19:33:00 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2012-07-17 19:05:49 +0200
commit7e76f904d208e4ef0bf722583897d4044264f546 (patch)
tree42d13db7331256d045dfd44e7a847d2d3533589c /Makefile
parent8d19377d24b2b1d6ded278559c16252ec320bef6 (diff)
downloadbuildroot-novena-7e76f904d208e4ef0bf722583897d4044264f546.tar.gz
buildroot-novena-7e76f904d208e4ef0bf722583897d4044264f546.zip
legal-info: infrastructure to collect legally-relevant material
This allows to automatically collect material that may be needed to comply with the license of packages that Buildroot prepares for the target device. The core of the implementation is made by the following parts: - in package/pkg-utils.mk some helper functions are defined for common actions such as generating a warning, producing info about a package etc; - in package/pkg-gentargets.mk, within the GENTARGETS framework, a new <PKG>-legal-info target produces all the info for a given package; - Makefile implements the top-level targets: - legal-info-prepare creates the output directory and produces legal info about Buildroot itself and the toolchain, which mostly means just warning the user that this is not implemented; - legal-info, the only target that is supposed to be used directly, depends on all of the above and finishes things by producing the README files from the various pieces. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile42
1 files changed, 39 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index b80477f7f..d55b136a8 100644
--- a/Makefile
+++ b/Makefile
@@ -257,6 +257,14 @@ TARGET_DIR:=$(BASE_DIR)/target
TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
TARGET_SKELETON=$(TOPDIR)/fs/skeleton
+LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
+REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
+LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
+LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
+LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
+LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
+LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
+
ifeq ($(BR2_CCACHE),y)
CCACHE:=$(HOST_DIR)/usr/bin/ccache
BUILDROOT_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
@@ -338,6 +346,9 @@ HOST_DEPS = $(sort $(foreach dep,\
$($(dep))))
HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
+TARGETS_LEGAL_INFO:=$(patsubst %,%-legal-info,\
+ $(TARGETS) $(BASE_TARGETS) $(TARGETS_HOST_DEPS) $(HOST_DEPS))))
+
# all targets depend on the crosscompiler and it's prerequisites
$(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
@@ -354,8 +365,9 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
.PHONY: all world dirs clean distclean source outputmakefile \
+ legal-info legal-info-prepare legal-info-clean \
$(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
- $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
+ $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
$(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
$(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
@@ -365,7 +377,7 @@ world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
# dependencies anywhere else
#
#############################################################
-$(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR):
+$(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR):
@mkdir -p $@
$(STAGING_DIR):
@@ -498,6 +510,28 @@ source: dirs $(TARGETS_SOURCE) $(HOST_SOURCE)
external-deps:
@$(MAKE) -Bs DL_MODE=SHOW_EXTERNAL_DEPS $(EXTRAMAKEARGS) source | sort -u
+legal-info-clean:
+ @rm -fr $(LEGAL_INFO_DIR)
+
+legal-info-prepare: $(LEGAL_INFO_DIR)
+ @$(call MESSAGE,"Collecting legal info")
+ @$(call legal-license-file,buildroot,COPYING,COPYING)
+ @$(call legal-manifest,PACKAGE,VERSION,LICENSE,LICENSE FILES,SOURCE ARCHIVE)
+ @$(call legal-manifest,buildroot,$(BR2_VERSION_FULL),GPLv2+,COPYING,not saved)
+ @$(call legal-warning,the Buildroot source code has not been saved)
+ @$(call legal-warning,the toolchain has not been saved)
+ @cp $(CONFIG_DIR)/.config $(LEGAL_INFO_DIR)/buildroot.config
+
+legal-info: dirs legal-info-clean legal-info-prepare $(REDIST_SOURCES_DIR) \
+ $(TARGETS_LEGAL_INFO)
+ @cat support/legal-info/README.header >>$(LEGAL_REPORT)
+ @if [ -r $(LEGAL_WARNINGS) ]; then \
+ cat support/legal-info/README.warnings-header \
+ $(LEGAL_WARNINGS) >>$(LEGAL_REPORT); \
+ cat $(LEGAL_WARNINGS); fi
+ @echo "Legal info produced in $(LEGAL_INFO_DIR)"
+ @rm -f $(LEGAL_WARNINGS)
+
show-targets:
@echo $(TARGETS)
@@ -619,7 +653,8 @@ endif
clean:
rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
- $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging
+ $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
+ $(LEGAL_INFO_DIR)
distclean: clean
ifeq ($(DL_DIR),$(TOPDIR)/dl)
@@ -687,6 +722,7 @@ endif
@echo ' source - download all sources needed for offline-build'
@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
@echo ' make V=0|1 - 0 => quiet build (default), 1 => verbose build'
@echo ' make O=dir - Locate all output files in "dir", including .config'