ref: c413c8f18eb1932b100850505031980e27160d5f
parent: ebbe5b82a052a316b0df52a5109071f512b7d23c
author: Daniel Sommermann <dcsommer@gmail.com>
date: Mon Aug 17 05:42:08 EDT 2020
Escape number sign in Makefiles Number signs are handled differently in Makefile variable parsing as compared to bash variable parsing. See this demo: ``` $ cat Makefile A=foo#bar B='foo#bar' C="foo#bar" D=foo\#bar E='foo\#bar' F="foo\#bar" $(info $(A)) $(info $(B)) $(info $(C)) $(info $(D)) $(info $(E)) $(info $(F)) $ make foo 'foo "foo foo#bar 'foo#bar' "foo#bar" make: *** No targets. Stop. $ make -v GNU Make 4.2.1 ``` In other words, the `#` character is evaluated first when parsing Makefiles, causing the rest of the line to become a comment. The effect of this is that paths that contain embedded `#` symbols are not handled properly in the vpx build system. To test this change, clone vpx to a directory containing a `#` symbol and attempt a build. With this change, it worked for me on Fedora 31, however without the change the build failed. Change-Id: Iaee6383e2435049b680484cc5cefdea9f2d9df46
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -262,6 +262,9 @@
source_path="`pwd`"
disable_feature source_path_used
fi
+# Makefiles greedily process the '#' character as a comment, even if it is
+# inside quotes. So, this character must be escaped in all paths in Makefiles.
+source_path_mk=$(echo $source_path | sed -e 's;\#;\\\#;g')
if test ! -z "$TMPDIR" ; then
TMPDIRx="${TMPDIR}"
@@ -481,11 +484,11 @@
cat >> $1 << EOF
# This file automatically generated by configure. Do not edit!
-SRC_PATH="$source_path"
-SRC_PATH_BARE=$source_path
+SRC_PATH="$source_path_mk"
+SRC_PATH_BARE=$source_path_mk
BUILD_PFX=${BUILD_PFX}
TOOLCHAIN=${toolchain}
-ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl}
+ASM_CONVERSION=${asm_conversion_cmd:-${source_path_mk}/build/make/ads2gas.pl}
GEN_VCPROJ=${gen_vcproj_cmd}
MSVS_ARCH_DIR=${msvs_arch_dir}
@@ -984,7 +987,7 @@
fi
enabled debug && add_asflags -g
- asm_conversion_cmd="${source_path}/build/make/ads2gas.pl"
+ asm_conversion_cmd="${source_path_mk}/build/make/ads2gas.pl"
case ${tgt_os} in
win*)
@@ -1006,7 +1009,7 @@
# respective SDKs' limitations. Fortunately, these are all 32-bit ABIs
# and so can be selected as 'win32'.
if [ ${tgt_os} = "win32" ]; then
- asm_conversion_cmd="${source_path}/build/make/ads2armasm_ms.pl"
+ asm_conversion_cmd="${source_path_mk}/build/make/ads2armasm_ms.pl"
AS_SFX=.S
msvs_arch_dir=arm-msvs
disable_feature multithread
@@ -1141,7 +1144,7 @@
fi
fi
- asm_conversion_cmd="${source_path}/build/make/ads2gas_apple.pl"
+ asm_conversion_cmd="${source_path_mk}/build/make/ads2gas_apple.pl"
;;
linux*)