Skip to content
Snippets Groups Projects
Commit 1d813df9 authored by Lucas Magalhães's avatar Lucas Magalhães
Browse files

Install license files automatically

Most EPICS modules need the license file to be distributed with
binaries. This commits fixes it by automatically installing every
license file on the project.
parent b7df42fd
No related branches found
No related tags found
1 merge request!146E3-1160: Install license files automatically
Pipeline #156946 passed
...@@ -258,6 +258,12 @@ CFGS = ${CONFIGS} ...@@ -258,6 +258,12 @@ CFGS = ${CONFIGS}
CFGS += ${CONFIGS_${EPICSVERSION}} CFGS += ${CONFIGS_${EPICSVERSION}}
export CFGS export CFGS
INSTALL_LICENSE = ${MODULE_LOCATION}/doc
# Find all license files to distribute with binaries
LICENSES = $(shell find -not -path '*/.*' -type f -iname LICENSE)
LICENSES += $(shell find -not -path '*/.*' -type f -iname Copyright)
export LICENSES
# Filter architectures to build using EXCLUDE_ARCHS and ARCH_FILTER. # Filter architectures to build using EXCLUDE_ARCHS and ARCH_FILTER.
ALL_ARCHS = ${EPICS_HOST_ARCH} ${CROSS_COMPILER_TARGET_ARCHS} ALL_ARCHS = ${EPICS_HOST_ARCH} ${CROSS_COMPILER_TARGET_ARCHS}
BUILD_ARCHS = $(filter-out $(addprefix %,${EXCLUDE_ARCHS}),$(filter-out $(addsuffix %,${EXCLUDE_ARCHS}),\ BUILD_ARCHS = $(filter-out $(addprefix %,${EXCLUDE_ARCHS}),$(filter-out $(addsuffix %,${EXCLUDE_ARCHS}),\
...@@ -309,6 +315,7 @@ debug:: ...@@ -309,6 +315,7 @@ debug::
@echo "LIBVERSION = ${LIBVERSION}" @echo "LIBVERSION = ${LIBVERSION}"
@echo "E3_SITEMODS_PATH = ${E3_SITEMODS_PATH}" @echo "E3_SITEMODS_PATH = ${E3_SITEMODS_PATH}"
@echo "EPICS_MODULES = ${EPICS_MODULES}" @echo "EPICS_MODULES = ${EPICS_MODULES}"
@echo "LICENSES = ${LICENSES}"
# Create e.g. build-$(T_A) rules for each architecture, so that we can just do # Create e.g. build-$(T_A) rules for each architecture, so that we can just do
# build: build-arch1 build-arch2 # build: build-arch1 build-arch2
...@@ -349,6 +356,20 @@ build:: ${COMMON_DIR}/${METAFILE} ...@@ -349,6 +356,20 @@ build:: ${COMMON_DIR}/${METAFILE}
install:: ${INSTALL_META} install:: ${INSTALL_META}
# The licenses should be installed after everything
define license_install =
$1: $2
@echo "Installing license file $$^"
$$(INSTALL) -d -m444 $$^ $$(@D)
install:: $1
endef
# Creates a target for every license file to be installed. Some modules have
# more than one license file that needs distribution. For them we add the
# previous directory so we have them separate by projects inside /doc.
$(foreach d, $(LICENSES), $(eval $(call license_install, $(INSTALL_LICENSE)/$(filter-out ., $(lastword $(subst /, , $(dir $(d))))/$(notdir $(d))), $(d))))
else # T_A else # T_A
ifeq ($(filter O.%,$(notdir ${CURDIR})),) ifeq ($(filter O.%,$(notdir ${CURDIR})),)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment