1# usage: check_dep_exec <executable name> <variable>
2#
3# Create a target that checks the existence of the specified executable, and
4# append that target to the given variable.
5define check_dep_exec =
6$(2) += check_exec_$(1)
7check_exec_$(1):
8	@if ! which $(1) > /dev/null; then   \
9	     echo "******** Missing prerequisite tool ********"; \
10	     echo "Cannot find executable *$(1)*"; \
11	     echo "Please refer to the Getting Started Guide" \
12	          "for installation instructions"; \
13	     exit 1; \
14	 fi
15endef
16
17# usage: check_dep_py3lib <library name> <variable>
18#
19# Create a target that checks the existence of the specified python 3 library, and
20# append that target to the given variable.
21define check_dep_py3lib =
22$(2) += check_py3lib_$(1)
23check_py3lib_$(1):
24	@if ! python3 -c "import $(1)" > /dev/null 2>&1; then   \
25	     echo "******** Missing prerequisite tool ********"; \
26	     echo "The python3 library *$(1)* is not installed"; \
27	     echo "Please refer to the Getting Started Guide" \
28	          "for installation instructions"; \
29	     exit 1; \
30	 fi
31endef
32