public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "PierreGondois" <pierre.gondois@arm.com>
To: devel@edk2.groups.io
Cc: Pierre Gondois <Pierre.Gondois@arm.com>,
	bob.c.feng@intel.com, liming.gao@intel.com, Sami.Mujawar@arm.com,
	pierre.gondois@arm.com, nd@arm.com
Subject: [PATCH v3 2/2] BaseTools: Remove caret in NASM_INC macro
Date: Thu,  6 Feb 2020 15:51:47 +0000	[thread overview]
Message-ID: <20200206155147.61112-3-pierre.gondois@arm.com> (raw)
In-Reply-To: <20200206155147.61112-1-pierre.gondois@arm.com>

From: Pierre Gondois <pierre.gondois@arm.com>

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 <pierre.gondois@arm.com>
---

 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)'


  parent reply	other threads:[~2020-02-06 15:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 15:51 [PATCH v3 0/2] BaseTools: Rationalise makefile generation PierreGondois
2020-02-06 15:51 ` [PATCH v3 1/2] " PierreGondois
2020-02-06 15:51 ` PierreGondois [this message]
2020-02-07  7:14   ` [edk2-devel] [PATCH v3 2/2] BaseTools: Remove caret in NASM_INC macro Bob Feng
2020-02-10 13:29     ` PierreGondois
2020-02-11 13:29       ` Bob Feng
2020-02-11 14:20         ` PierreGondois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200206155147.61112-3-pierre.gondois@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox