From c83c49ae3667b5c4f03e205c963c1244a7d60c01 Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Mon, 17 Jan 2022 19:35:04 +0800 Subject: [PATCH] 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 Acked-by: Anthony Xu --- hypervisor/scripts/makefile/config.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/scripts/makefile/config.mk b/hypervisor/scripts/makefile/config.mk index d7a8c86c6..43c168e28 100644 --- a/hypervisor/scripts/makefile/config.mk +++ b/hypervisor/scripts/makefile/config.mk @@ -217,9 +217,9 @@ $(HV_ALLOCATION_XML): $(HV_BOARD_XML) $(HV_SCENARIO_XML) | $(HV_CONFIG_DIR) @echo "$@ generated" $(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@{SCENARIO_FILE}@$(HV_SCENARIO_XML)@g" | \ - sed "s@{ALLOCATION_FILE}@$(HV_ALLOCATION_XML)@g" > $@ + @sed "s/{BOARD_FILE}/$(subst /,\\/,$(realpath $(HV_BOARD_XML)))/g" $(HV_UNIFIED_XML_IN) | \ + sed "s/{SCENARIO_FILE}/$(subst /,\\/,$(HV_SCENARIO_XML))/g" | \ + sed "s/{ALLOCATION_FILE}/$(subst /,\\/,$(HV_ALLOCATION_XML))/g" > $@ @echo "$@ generated" $(HV_CONFIG_MK): $(HV_UNIFIED_XML) | $(HV_CONFIG_DIR)