BaseTools: Remove caret in NASM_INC macro

NASM_INC contains the list of directory to include when using
the nasm assembler.

In nmake makefiles, a trailing backslash escapes the newline char
and replaces it with a space ' '. To have a literal trailing
backslash, it must be escaped with a caret '^'. This is not
necessary for GNU makefiles.

On windows platforms, for the NASM_INC macro, a caret escaping
a trailing a backslash was appended to the last included
folder regardless of the makefile type.
For instance, "/Include/" was replaced by "/Include/^\".

This is causing a build failure on windows platforms using
GNU makefiles since the caret '^' doesn't escape any chars in
GNU makefiles and is thus conserved.
"/Include^\" was replaced by "/Include\/" in nmake makefiles,
but remained "/Include/^\" in GNU makefiles.

This patch removes the caret '^' on the build using GNU makefiles.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>

Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Pierre Gondois 2020-02-10 18:49:08 +08:00 committed by mergify[bot]
parent 818283de3f
commit c44e0a896c
1 changed files with 4 additions and 3 deletions

View File

@ -612,9 +612,10 @@ cleanlib:
IncludePath = self._INC_FLAG_['NASM'] + self.PlaceMacro(P, self.Macros)
if IncludePath.endswith(os.sep):
IncludePath = IncludePath.rstrip(os.sep)
# When compiling .nasm files, need to add a literal backslash at each path
# To specify a literal backslash at the end of the line, precede it with a caret (^)
if P == MyAgo.IncludePathList[-1] and os.sep == '\\':
# When compiling .nasm files, need to add a literal backslash at each path.
# In nmake makfiles, a trailing literal backslash must be escaped with a caret ('^').
# It is otherwise replaced with a space (' '). This is not necessary for GNU makfefiles.
if P == MyAgo.IncludePathList[-1] and self._Platform == WIN32_PLATFORM and self._FileType == NMAKE_FILETYPE:
IncludePath = ''.join([IncludePath, '^', os.sep])
else:
IncludePath = os.path.join(IncludePath, '')