From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cam-smtp0.cambridge.arm.com (cam-smtp0.cambridge.arm.com [217.140.106.51]) by mx.groups.io with SMTP id smtpd.web10.13957.1581004315755866856 for ; Thu, 06 Feb 2020 07:51:56 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.106.51, mailfrom: pierre.gondois@arm.com) Received: from E119881.Arm.com (E119881.Arm.com [10.1.197.28]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id 016FpqV1032594; Thu, 6 Feb 2020 15:51:53 GMT From: "PierreGondois" To: devel@edk2.groups.io Cc: Pierre Gondois , 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 Message-Id: <20200206155147.61112-3-pierre.gondois@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200206155147.61112-1-pierre.gondois@arm.com> References: <20200206155147.61112-1-pierre.gondois@arm.com> From: Pierre Gondois 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 --- 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)'