diff --git a/require-ess/tools/driver.makefile b/require-ess/tools/driver.makefile index 8469fd053ab2d9f8f3d174c343ec3981a088831a..a992e2cc93945d53fa27a9481620d65291c246f3 100644 --- a/require-ess/tools/driver.makefile +++ b/require-ess/tools/driver.makefile @@ -553,7 +553,11 @@ ifneq ($(MODULELIB),) LIBOBJS += $(addsuffix $(OBJ),$(basename ${VERSIONFILE})) endif # MODULELIB -MODULE_RULES = ${CFGS:%=../%} +MODULE_CONFIGS = $(foreach cfg,${CFGS},$(if $(filter CONFIG%,$(notdir $(cfg))),$(if $(filter /%,$(cfg)),$(cfg),../$(cfg)))) +MODULE_CONFIGS += $(foreach m,$(REQ),$(wildcard $(E3_SITEMODS_PATH)/$m/$($(m)_VERSION)/cfg/CONFIG*)) +MODULE_CONFIGS += $(foreach m,$(REQ),$(wildcard $(EPICS_MODULES)/$m/$($(m)_VERSION)/cfg/CONFIG*)) + +MODULE_RULES = $(foreach cfg,${CFGS},$(if $(filter RULES%,$(notdir $(cfg))),$(if $(filter /%,$(cfg)),$(cfg),../$(cfg)))) MODULE_RULES += $(foreach m,$(REQ),$(wildcard $(E3_SITEMODS_PATH)/$m/$($(m)_VERSION)/cfg/RULES*)) MODULE_RULES += $(foreach m,$(REQ),$(wildcard $(EPICS_MODULES)/$m/$($(m)_VERSION)/cfg/RULES*)) @@ -580,6 +584,7 @@ debug:: @echo "TEMPLS = ${TEMPLS}" @echo "LIBVERSION = ${LIBVERSION}" @echo "MODULE_LOCATION = ${MODULE_LOCATION}" + @echo "MODULE_CONFIGS = ${MODULE_CONFIGS}" @echo "MODULE_RULES = ${MODULE_RULES}" build: MODULEINFOS @@ -597,6 +602,9 @@ INSTALL_LOADABLE_SHRLIBS= # We ony want to include ${BASERULES} from EPICS base if we are /not/ in debug # mode. Including this causes all of the source files to be compiled! ifeq (,$(findstring debug,${MAKECMDGOALS})) + ifneq ($(strip $(MODULE_CONFIGS)),) + include $(MODULE_CONFIGS) + endif include ${BASERULES} ifneq ($(strip $(MODULE_RULES)),) include $(MODULE_RULES) diff --git a/tests/test_build.py b/tests/test_build.py index c19a28cc1347042828b89b4f451271ac9bd83424..3a25956a7ee0ee8e472b6fe4f0573c59af8d7b7e 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -751,3 +751,15 @@ def test_install_license(wrapper: Wrapper): file_path = wrapper.package_dir / "doc/foo/LICENSE" assert file_path.exists() + + +def test_load_custom_config_files(wrapper: Wrapper): + custom_config_file = wrapper.config_dir / "CONFIG_FOO" + custom_config_file.write_text("$(error foobarbaz)") + + wrapper.add_file(custom_config_file) + wrapper.add_var_to_module_makefile("CONFIGS", str(custom_config_file)) + + rc, _, errs = wrapper.run_make("build") + assert rc == 2 + assert "foobarbaz" in errs