HV: make: append dependency checking targets to a given variable

The current implementation of the check_dep_* macros always append the
prerequisite checking target to BUILD_DEPS, but there are some cases when some
prerequisites are only necessary for some specific targets instead of general
builds.

This patch adds a second parameter to the check_dep_* macros specifying which
variable the generated target should be appended to.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
Acked-by: Geoffroy VanCutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
Junjie Mao
2018-06-09 15:37:55 +08:00
committed by Jack Ren
parent 063557a263
commit 216f4e78a8
3 changed files with 19 additions and 14 deletions

View File

@@ -1,8 +1,10 @@
# check the existence of a specific executable
# usage: check_dep_exec <executable name>
# usage: check_dep_exec <executable name> <variable>
#
# Create a target that checks the existence of the specified executable, and
# append that target to the given variable.
define check_dep_exec =
BUILD_DEPS += check_$(1)
check_$(1):
$(2) += check_exec_$(1)
check_exec_$(1):
@if ! which $(1) > /dev/null; then \
echo "******** Missing prerequisite tool ********"; \
echo "Cannot find executable *$(1)*"; \
@@ -12,11 +14,14 @@ check_$(1):
fi
endef
# check the existence of a specific python library
# usage: check_dep_pylib <library name>
# usage: check_dep_pylib <library name> <variable>
#
# Create a target that checks the existence of the specified python library, and
# append that target to the given variable. The default python version (which
# can be either 2.x or 3.x) is used.
define check_dep_pylib =
BUILD_DEPS += check_$(1)
check_$(1):
$(2) += check_pylib_$(1)
check_pylib_$(1):
@if ! pip list 2>/dev/null | grep $(1) > /dev/null 2>&1; then \
echo "******** Missing prerequisite tool ********"; \
echo "The python library *$(1)* is not installed"; \