From: Pierre Gondois <[email protected]>

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.

Escaping the trailing backslash in nmake makefiles on windows
platforms is not needed because:
 * folder names don't require to end with a slash '/' or
   a backslash '\'.
 * a trailing backslash replaces the newline char by a space ' ',
   which is not difference from a newline char in macros.

Signed-off-by: Pierre Gondois <[email protected]>
---

 BaseTools/Source/Python/AutoGen/GenMake.py | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 
b036f726db144c13e98b9e0fb021cb3855ec8e55..b2b27d43fe18e89ebdfdf8456f439c52759a4d9e
 100755
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -608,19 +608,10 @@ cleanlib:
         IncludePathList = []
         asmsource = [item for item in MyAgo.SourceFileList if 
item.File.upper().endswith((".NASM",".ASM",".NASMB","S"))]
         if asmsource:
-            for P in  MyAgo.IncludePathList:
+            for P in MyAgo.IncludePathList:
                 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 == '\\':
-                    IncludePath = ''.join([IncludePath, '^', os.sep])
-                else:
-                    IncludePath = os.path.join(IncludePath, '')
-                IncludePathList.append(IncludePath)
+                IncludePathList.append(os.path.join(IncludePath, ''))
             
FileMacroList.append(self._FILE_MACRO_TEMPLATE.Replace({"macro_name": 
"NASM_INC", "source_file": IncludePathList}))
-
         # Generate macros used to represent files containing list of input 
files
         for ListFileMacro in self.ListFileMacros:
             ListFileName = os.path.join(MyAgo.OutputDir, "%s.lst" % 
ListFileMacro.lower()[:len(ListFileMacro) - 5])
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#53876): https://edk2.groups.io/g/devel/message/53876
Mute This Topic: https://groups.io/mt/71025456/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to