Add an error-checking template for Makefile shell calls onlpm --find-file.

Makefiles that call $(shell onlpm --find-file *) have always failed poorly
when the file cannot be found.

The onlp_find_file template can be called to both assign and check the
results. If an error occurred in getting the value then a Makefile error is raised.
This commit is contained in:
Jeffrey Townsend
2019-05-27 18:56:46 +00:00
parent 28a1802136
commit 165009cd8d
2 changed files with 8 additions and 0 deletions

View File

@@ -89,3 +89,5 @@ ONL_MAKE := $(MAKE) $(ONL_MAKE_FLAGS)
#
export SUBMODULE_INFRA := $(ONL)/sm/infra
export SUBMODULE_BIGCODE := $(ONL)/sm/bigcode
include $(ONL)/make/templates.mk

6
make/templates.mk Normal file
View File

@@ -0,0 +1,6 @@
define onlpm_find_file
$(1) := $$(shell $(ONLPM) --find-file $(2) $(3))
ifeq ($$($(1)),)
$$(error $(2):$(3) not found)
endif
endef