From 6df3ac003834167c483a5ac06c46f007efb4d95b Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Sat, 9 Jun 2018 15:39:28 +0800 Subject: [PATCH] HV: make: add menuconfig This patch enables 'make menuconfig' leveraging the menuconfig.py in kconfiglib, which shows a TUI for modifying the current configurations. Menuconfig.py is python3 only, and thus the existence of 'python3' instead of 'python' is checked and python3 is used to run all the scripts. Signed-off-by: Junjie Mao Acked-by: Anthony Xu Acked-by: Geoffroy VanCutsem --- hypervisor/scripts/kconfig/kconfig.mk | 13 +++++++++---- scripts/deps.mk | 17 ++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/hypervisor/scripts/kconfig/kconfig.mk b/hypervisor/scripts/kconfig/kconfig.mk index fc4736d15..d45d39f4b 100644 --- a/hypervisor/scripts/kconfig/kconfig.mk +++ b/hypervisor/scripts/kconfig/kconfig.mk @@ -21,14 +21,14 @@ $(HV_OBJDIR)/$(HV_CONFIG_MK): $(HV_OBJDIR)/$(HV_CONFIG) $(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG) @mkdir -p $(dir $@) - @python $(KCONFIG_DIR)/generate_header.py Kconfig $< $@ + @python3 $(KCONFIG_DIR)/generate_header.py Kconfig $< $@ # This target forcefully generate a .config based on a given default # one. Overwrite the current .config if it exists. .PHONY: defconfig defconfig: $(KCONFIG_DEPS) @mkdir -p $(HV_OBJDIR) - @python $(KCONFIG_DIR)/defconfig.py Kconfig arch/x86/configs/$(PLATFORM).config $(HV_OBJDIR)/$(HV_CONFIG) + @python3 $(KCONFIG_DIR)/defconfig.py Kconfig arch/x86/configs/$(PLATFORM).config $(HV_OBJDIR)/$(HV_CONFIG) # Use silentoldconfig to forcefully update the current .config, or generate a # new one if no previous .config exists. This target can be used as a @@ -37,13 +37,18 @@ defconfig: $(KCONFIG_DEPS) .PHONY: oldconfig oldconfig: $(KCONFIG_DEPS) @mkdir -p $(HV_OBJDIR) - @python $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y + @python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y # Minimize the current .config. This target can be used to generate a defconfig # for future use. .PHONY: minimalconfig minimalconfig: $(HV_OBJDIR)/$(HV_CONFIG) - @python $(KCONFIG_DIR)/minimalconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) $(HV_OBJDIR)/$(HV_DEFCONFIG) + @python3 $(KCONFIG_DIR)/minimalconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) $(HV_OBJDIR)/$(HV_DEFCONFIG) + +$(eval $(call check_dep_exec,menuconfig,MENUCONFIG_DEPS)) +export KCONFIG_CONFIG := $(HV_OBJDIR)/$(HV_CONFIG) +menuconfig: $(MENUCONFIG_DEPS) $(HV_OBJDIR)/$(HV_CONFIG) + @python3 $(shell which menuconfig) Kconfig -include $(HV_OBJDIR)/$(HV_CONFIG_MK) diff --git a/scripts/deps.mk b/scripts/deps.mk index 8e8759fc0..687ef5590 100644 --- a/scripts/deps.mk +++ b/scripts/deps.mk @@ -14,17 +14,16 @@ check_exec_$(1): fi endef -# usage: check_dep_pylib +# usage: check_dep_py3lib # -# 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 = -$(2) += check_pylib_$(1) -check_pylib_$(1): - @if ! pip list 2>/dev/null | grep $(1) > /dev/null 2>&1; then \ +# Create a target that checks the existence of the specified python 3 library, and +# append that target to the given variable. +define check_dep_py3lib = +$(2) += check_py3lib_$(1) +check_py3lib_$(1): + @if ! pip3 list 2>/dev/null | grep $(1) > /dev/null 2>&1; then \ echo "******** Missing prerequisite tool ********"; \ - echo "The python library *$(1)* is not installed"; \ + echo "The python3 library *$(1)* is not installed"; \ echo "Please refer to the Getting Started Guide" \ "for installation instructions"; \ exit 1; \