From 0acb3d286258f50aec7dea6f86f4567078705ffa Mon Sep 17 00:00:00 2001 From: Abner Chang Date: Thu, 11 Sep 2014 06:44:17 +0000 Subject: [PATCH] Add support for ${s_*} and ${d_*} macros for in FDF file for the INF files, and for each statement in the build rules. The following keywords are supported: "src", "s_path", "s_dir", "s_name", "s_base", "s_ext", "dst", "d_path", "d_name", "d_base", "d_ext" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Abner Chang Reviewed-by: Yingke Liu Reviewed-by: Larry Hauch git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16094 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Source/Python/GenFds/FfsInfStatement.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index cc85a32796..6f5aac02f5 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -2,6 +2,7 @@ # process FFS generation from INF statement # # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -362,7 +363,31 @@ class FfsInfStatement(FfsInfStatementClassObject): # self.__InfParse__(Dict) + SrcFile = os.path.join( GenFdsGlobalVariable.WorkSpaceDir , self.InfFileName); + DestFile = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs') + SrcFileDir = "." + SrcPath = os.path.dirname(SrcFile) + SrcFileName = os.path.basename(SrcFile) + SrcFileBase, SrcFileExt = os.path.splitext(SrcFileName) + DestPath = os.path.dirname(DestFile) + DestFileName = os.path.basename(DestFile) + DestFileBase, DestFileExt = os.path.splitext(DestFileName) + self.MacroDict = { + # source file + "${src}" : SrcFile, + "${s_path}" : SrcPath, + "${s_dir}" : SrcFileDir, + "${s_name}" : SrcFileName, + "${s_base}" : SrcFileBase, + "${s_ext}" : SrcFileExt, + # destination file + "${dst}" : DestFile, + "${d_path}" : DestPath, + "${d_name}" : DestFileName, + "${d_base}" : DestFileBase, + "${d_ext}" : DestFileExt + } # # Allow binary type module not specify override rule in FDF file. # @@ -420,6 +445,7 @@ class FfsInfStatement(FfsInfStatementClassObject): '$(NAMED_GUID)' : self.ModuleGuid } String = GenFdsGlobalVariable.MacroExtend(String, MacroDict) + String = GenFdsGlobalVariable.MacroExtend(String, self.MacroDict) return String ## __GetRule__() method