Makefile: parameters check for board and scenario

When user use make parameters to specify BOARD and SCENARIO, there might
be some conflict because parameter of KCONFIG_FILE/BOARD_FILE/SCENARIO_FILE
also includes BOARD/SCENARIO info. To simplify, we only alow below valid
usages:

 1. make <target>
 2. make <target> KCONFIG_FILE=xxx
 3. make <target> BOARD=xxx SCENARIO=xxx
 4. make <target> BOARD_FILE=xxx SCENARIO_FILE=xxx
 5. make <target> KCONFIG_FILE=xxx BOARD_FILE=xxx SCENARIO_FILE=xxx

Especially for case 1 that no any parameters are specified:
    a. If hypervisor/build/.config file which generated by "make menuconfig"
       exist, the .config file will be loaded as KCONFIG_FILE:
       i.e. equal: make <target> KCONFIG_FILE=hypervisor/build/.config

    b. If hypervisor/build/.config file does not exist,
       the default BOARD/SCENARIO will be loaded:
       i.e. equal: make <target> BOARD=$(BOARD) SCENARIO=$(SCENARIO)

Tracked-On: #4517

Signed-off-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Victor Sun
2020-03-16 23:53:05 +08:00
committed by wenlingz
parent 2db5ae08d1
commit 471f7e5b28
3 changed files with 113 additions and 68 deletions

View File

@@ -12,18 +12,27 @@ ifneq ($$(BOARD_IN_XML),)
endif
endif
ifeq ($$(CONFIG_XML_ENABLED),true)
override BOARD := $$(BOARD_IN_XML)
override SCENARIO := $$(SCENARIO_IN_XML)
endif
endef
ifeq ($(CONFIG_XML_ENALBED),)
ifeq ($(CONFIG_XML_ENABLED),)
$(eval $(call check_xml_enabled,$(BOARD_FILE),$(SCENARIO_FILE)))
endif
ifeq ($(CONFIG_XML_ENABLED),true)
ifneq ($(BOARD_IN_KCONFIG),)
ifneq ($(BOARD_IN_XML),$(BOARD_IN_KCONFIG))
$(error BOARD $(BOARD_IN_XML) in $(BOARD_FILE) does not match BOARD $(BOARD_IN_KCONFIG) in $(KCONFIG_FILE))
endif
endif
ifneq ($(SCENARIO_IN_KCONFIG),)
ifneq ($(SCENARIO_IN_XML),$(SCENARIO_IN_KCONFIG))
$(error SCENARIO $(SCENARIO_IN_XML) in $(SCENARIO_FILE) does not match SCENARIO $(SCENARIO_IN_KCONFIG) in $(KCONFIG_FILE))
endif
endif
override BOARD := $(BOARD_IN_XML)
override SCENARIO := $(SCENARIO_IN_XML)
endif
update_config:
ifeq ($(CONFIG_XML_ENABLED),true)
@if [ ! -f $(UPDATE_RESULT) ]; then \