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

@ -183,7 +183,7 @@ DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
VERSION := bsp/$(PLATFORM)/include/bsp/version.h VERSION := bsp/$(PLATFORM)/include/bsp/version.h
.PHONY: all .PHONY: all
all: $(BUILD_DEPS) $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin all: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
rm -f $(VERSION) rm -f $(VERSION)
ifeq ($(PLATFORM), uefi) ifeq ($(PLATFORM), uefi)

View File

@ -5,9 +5,9 @@ HV_CONFIG_MK := include/config.mk
KCONFIG_DIR := $(BASEDIR)/../scripts/kconfig KCONFIG_DIR := $(BASEDIR)/../scripts/kconfig
$(eval $(call check_dep_exec,python)) $(eval $(call check_dep_exec,python3,KCONFIG_DEPS))
$(eval $(call check_dep_exec,pip)) $(eval $(call check_dep_exec,pip3,KCONFIG_DEPS))
$(eval $(call check_dep_pylib,kconfiglib)) $(eval $(call check_dep_py3lib,kconfiglib,KCONFIG_DEPS))
# This target invoke silentoldconfig to generate or update a .config. Useful as # This target invoke silentoldconfig to generate or update a .config. Useful as
# a prerequisite of other targets depending on .config. # a prerequisite of other targets depending on .config.
@ -26,7 +26,7 @@ $(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG)
# This target forcefully generate a .config based on a given default # This target forcefully generate a .config based on a given default
# one. Overwrite the current .config if it exists. # one. Overwrite the current .config if it exists.
.PHONY: defconfig .PHONY: defconfig
defconfig: defconfig: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR) @mkdir -p $(HV_OBJDIR)
@python $(KCONFIG_DIR)/defconfig.py Kconfig arch/x86/configs/$(PLATFORM).config $(HV_OBJDIR)/$(HV_CONFIG) @python $(KCONFIG_DIR)/defconfig.py Kconfig arch/x86/configs/$(PLATFORM).config $(HV_OBJDIR)/$(HV_CONFIG)
@ -35,7 +35,7 @@ defconfig:
# prerequisite of all the others to make sure that the .config is consistent # prerequisite of all the others to make sure that the .config is consistent
# even it has been modified manually before. # even it has been modified manually before.
.PHONY: oldconfig .PHONY: oldconfig
oldconfig: oldconfig: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR) @mkdir -p $(HV_OBJDIR)
@python $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y @python $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y

View File

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