diff --git a/require-ess/tools/driver.makefile b/require-ess/tools/driver.makefile index 8469fd053ab2d9f8f3d174c343ec3981a088831a..3c87c98ab4c0f2b9a803a9b908345d9e7792d2ed 100644 --- a/require-ess/tools/driver.makefile +++ b/require-ess/tools/driver.makefile @@ -302,7 +302,6 @@ CFGS = ${CONFIGS} CFGS += ${CONFIGS_${EPICSVERSION}} 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) @@ -367,20 +366,6 @@ build:: ${COMMON_DIR}/${METAFILE} 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 ifeq ($(filter O.%,$(notdir ${CURDIR})),) @@ -676,6 +661,7 @@ INSTALL_DBS = $(addprefix ${INSTALL_DB}/,$(notdir ${TEMPLS})) INSTALL_SCRS = $(addprefix ${INSTALL_SCR}/,$(notdir ${SCR})) INSTALL_BINS = $(addprefix ${INSTALL_BIN}/,$(notdir ${BINS})) INSTALL_CONFIGS = $(addprefix ${INSTALL_CONFIG}/,$(notdir ${CFGS})) +INSTALL_LICENSES = $(addprefix ${INSTALL_DOC}/,${LICENSES}) debug:: @echo "INSTALL_LIB = $(INSTALL_LIB)" @@ -694,6 +680,7 @@ debug:: @echo "INSTALL_CONFIGS = $(INSTALL_CONFIGS)" @echo "INSTALL_BIN = $(INSTALL_BIN)" @echo "INSTALL_BINS = $(INSTALL_BINS)" + @echo "INSTALL_LICENSES = $(INSTALL_LICENSES)" @echo "HDR_SUBDIRS = $(HDR_SUBDIRS)" define install_subdirs @@ -708,7 +695,8 @@ debug:: endef $(foreach d,$(HDR_SUBDIRS),$(eval $(call install_subdirs,$d))) -INSTALLS += ${INSTALL_CONFIGS} ${INSTALL_SCRS} ${INSTALL_HDRS} ${INSTALL_DBDS} ${INSTALL_DBS} ${INSTALL_LIBS} ${INSTALL_VLIBS} ${INSTALL_BINS} ${INSTALL_DEPS} +INSTALLS += ${INSTALL_CONFIGS} ${INSTALL_SCRS} ${INSTALL_HDRS} ${INSTALL_DBDS} ${INSTALL_DBS} \ + ${INSTALL_LIBS} ${INSTALL_VLIBS} ${INSTALL_BINS} ${INSTALL_DEPS} ${INSTALL_LICENSES} install: ${INSTALLS} @@ -744,6 +732,13 @@ ${INSTALL_BINS}: $(addprefix ../,$(filter-out /%,${BINS})) $(filter /%,${BINS}) @echo "Installing binaries $^ to $(@D)" $(INSTALL) -d -m$(BIN_PERMISSIONS) $^ $(@D) +define license_install = +$1: $2 + @echo "Installing license file $$^" + $$(INSTALL) -d -m444 $$^ $$(@D) +endef +$(foreach l,$(LICENSES),$(eval $(call license_install,$(INSTALL_DOC)/$l,../$l))) + # Create GPIB code from *.gt file. %.c %.dbd %.list: %.gt @echo "Converting $*.gt" diff --git a/tests/test_build.py b/tests/test_build.py index c19a28cc1347042828b89b4f451271ac9bd83424..4571f96ee95be82cd1ef2673e97ce4b548c859a8 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -743,8 +743,8 @@ def test_install_license(wrapper: Wrapper): rc, out, _ = wrapper.run_make("install") assert rc == 0 - assert re.search("Installing license file LICENSE", out) - assert re.search("Installing license file foo/LICENSE", out) + assert re.search("Installing license file .././LICENSE", out) + assert re.search("Installing license file .././foo/LICENSE", out) file_path = wrapper.package_dir / "doc/LICENSE" assert file_path.exists()