Makefile: allow arbitrary character in paths

Today we assume the paths to the build directory do not contain the
character `@` and build the sed commands on top of this
assumption. However, there is no guarantee that this assumption holds.

This patch changes the separating character in sed pattern replacing
commands back to slash ('/') and escape the slashes in the replacements to
make the commands work. That gives more flexibility to the paths where
users can put their configuration files and build the project.

Tracked-On: #6691
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Junjie Mao 2022-01-17 19:35:04 +08:00 committed by acrnsi-robot
parent efb2860104
commit c83c49ae36
1 changed files with 3 additions and 3 deletions

View File

@ -217,9 +217,9 @@ $(HV_ALLOCATION_XML): $(HV_BOARD_XML) $(HV_SCENARIO_XML) | $(HV_CONFIG_DIR)
@echo "$@ generated" @echo "$@ generated"
$(HV_UNIFIED_XML): $(HV_BOARD_XML) $(HV_SCENARIO_XML) $(HV_ALLOCATION_XML) | $(HV_CONFIG_DIR) $(HV_UNIFIED_XML): $(HV_BOARD_XML) $(HV_SCENARIO_XML) $(HV_ALLOCATION_XML) | $(HV_CONFIG_DIR)
@sed "s@{BOARD_FILE}@$(realpath $(HV_BOARD_XML))@g" $(HV_UNIFIED_XML_IN) | \ @sed "s/{BOARD_FILE}/$(subst /,\\/,$(realpath $(HV_BOARD_XML)))/g" $(HV_UNIFIED_XML_IN) | \
sed "s@{SCENARIO_FILE}@$(HV_SCENARIO_XML)@g" | \ sed "s/{SCENARIO_FILE}/$(subst /,\\/,$(HV_SCENARIO_XML))/g" | \
sed "s@{ALLOCATION_FILE}@$(HV_ALLOCATION_XML)@g" > $@ sed "s/{ALLOCATION_FILE}/$(subst /,\\/,$(HV_ALLOCATION_XML))/g" > $@
@echo "$@ generated" @echo "$@ generated"
$(HV_CONFIG_MK): $(HV_UNIFIED_XML) | $(HV_CONFIG_DIR) $(HV_CONFIG_MK): $(HV_UNIFIED_XML) | $(HV_CONFIG_DIR)