Skip to content

Commit 216f4e7

Browse files
junjiemao1jren1
authored andcommitted
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>
1 parent 063557a commit 216f4e7

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

hypervisor/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
183183
VERSION := bsp/$(PLATFORM)/include/bsp/version.h
184184

185185
.PHONY: all
186-
all: $(BUILD_DEPS) $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
186+
all: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
187187
rm -f $(VERSION)
188188

189189
ifeq ($(PLATFORM), uefi)

hypervisor/scripts/kconfig/kconfig.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ HV_CONFIG_MK := include/config.mk
55

66
KCONFIG_DIR := $(BASEDIR)/../scripts/kconfig
77

8-
$(eval $(call check_dep_exec,python))
9-
$(eval $(call check_dep_exec,pip))
10-
$(eval $(call check_dep_pylib,kconfiglib))
8+
$(eval $(call check_dep_exec,python3,KCONFIG_DEPS))
9+
$(eval $(call check_dep_exec,pip3,KCONFIG_DEPS))
10+
$(eval $(call check_dep_py3lib,kconfiglib,KCONFIG_DEPS))
1111

1212
# This target invoke silentoldconfig to generate or update a .config. Useful as
1313
# a prerequisite of other targets depending on .config.
@@ -26,7 +26,7 @@ $(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG)
2626
# This target forcefully generate a .config based on a given default
2727
# one. Overwrite the current .config if it exists.
2828
.PHONY: defconfig
29-
defconfig:
29+
defconfig: $(KCONFIG_DEPS)
3030
@mkdir -p $(HV_OBJDIR)
3131
@python $(KCONFIG_DIR)/defconfig.py Kconfig arch/x86/configs/$(PLATFORM).config $(HV_OBJDIR)/$(HV_CONFIG)
3232

@@ -35,7 +35,7 @@ defconfig:
3535
# prerequisite of all the others to make sure that the .config is consistent
3636
# even it has been modified manually before.
3737
.PHONY: oldconfig
38-
oldconfig:
38+
oldconfig: $(KCONFIG_DEPS)
3939
@mkdir -p $(HV_OBJDIR)
4040
@python $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y
4141

scripts/deps.mk

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# check the existence of a specific executable
2-
# usage: check_dep_exec <executable name>
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.
35
define check_dep_exec =
4-
BUILD_DEPS += check_$(1)
5-
check_$(1):
6+
$(2) += check_exec_$(1)
7+
check_exec_$(1):
68
@if ! which $(1) > /dev/null; then \
79
echo "******** Missing prerequisite tool ********"; \
810
echo "Cannot find executable *$(1)*"; \
@@ -12,11 +14,14 @@ check_$(1):
1214
fi
1315
endef
1416

15-
# check the existence of a specific python library
16-
# usage: check_dep_pylib <library name>
17+
# usage: check_dep_pylib <library name> <variable>
18+
#
19+
# Create a target that checks the existence of the specified python library, and
20+
# append that target to the given variable. The default python version (which
21+
# can be either 2.x or 3.x) is used.
1722
define check_dep_pylib =
18-
BUILD_DEPS += check_$(1)
19-
check_$(1):
23+
$(2) += check_pylib_$(1)
24+
check_pylib_$(1):
2025
@if ! pip list 2>/dev/null | grep $(1) > /dev/null 2>&1; then \
2126
echo "******** Missing prerequisite tool ********"; \
2227
echo "The python library *$(1)* is not installed"; \

0 commit comments

Comments
 (0)