BaseTools: Move PcdValueInit to platform build folder

PcdValueInit tool is platform scope.
It should be generated into Platform output directory.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob C Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
BobCF 2018-10-22 11:24:13 +08:00 committed by Liming Gao
parent 51d17bb7b0
commit c637c60273
1 changed files with 17 additions and 8 deletions

View File

@ -86,6 +86,12 @@ LIBS = $(LIB_PATH)\Common.lib
!INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
''' '''
AppTarget = '''
all: $(APPFILE)
$(APPFILE): $(OBJECTS)
%s
'''
PcdGccMakefile = ''' PcdGccMakefile = '''
MAKEROOT ?= $(EDK_TOOLS_PATH)/Source/C MAKEROOT ?= $(EDK_TOOLS_PATH)/Source/C
LIBS = -lCommon LIBS = -lCommon
@ -2257,10 +2263,10 @@ class DscBuildData(PlatformBuildClassObject):
MakeApp = PcdMakefileHeader MakeApp = PcdMakefileHeader
if sys.platform == "win32": if sys.platform == "win32":
MakeApp = MakeApp + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj\n' % (self.OutputPath, PcdValueInitName) + 'INC = ' MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj\n' % (self.OutputPath, PcdValueInitName) + 'INC = '
else: else:
MakeApp = MakeApp + PcdGccMakefile MakeApp = MakeApp + PcdGccMakefile
MakeApp = MakeApp + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o\n' % (self.OutputPath, PcdValueInitName) + \ MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o\n' % (self.OutputPath, PcdValueInitName) + \
'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +=' 'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
IncSearchList = [] IncSearchList = []
@ -2336,6 +2342,9 @@ class DscBuildData(PlatformBuildClassObject):
if sys.platform == "win32": if sys.platform == "win32":
MakeApp = MakeApp + PcdMakefileEnd MakeApp = MakeApp + PcdMakefileEnd
MakeApp = MakeApp + AppTarget % ("""\tcopy $(APPLICATION) $(APPFILE) /y """)
else:
MakeApp = MakeApp + AppTarget % ("""\tcp $(APPLICATION) $(APPFILE) """)
MakeApp = MakeApp + '\n' MakeApp = MakeApp + '\n'
IncludeFileFullPaths = [] IncludeFileFullPaths = []
for includefile in IncludeFiles: for includefile in IncludeFiles:
@ -2359,12 +2368,11 @@ class DscBuildData(PlatformBuildClassObject):
OutputValueFile = os.path.join(self.OutputPath, 'Output.txt') OutputValueFile = os.path.join(self.OutputPath, 'Output.txt')
SaveFileOnChange(InputValueFile, InitByteValue, False) SaveFileOnChange(InputValueFile, InitByteValue, False)
PcdValueInitExe = PcdValueInitName Dest_PcdValueInitExe = PcdValueInitName
if not sys.platform == "win32": if not sys.platform == "win32":
PcdValueInitExe = os.path.join(os.getenv("EDK_TOOLS_PATH"), 'Source', 'C', 'bin', PcdValueInitName) Dest_PcdValueInitExe = os.path.join(self.OutputPath, PcdValueInitName)
else: else:
PcdValueInitExe = os.path.join(os.getenv("EDK_TOOLS_PATH"), 'Bin', 'Win32', PcdValueInitName) +".exe" Dest_PcdValueInitExe = os.path.join(self.OutputPath, PcdValueInitName) +".exe"
Messages = '' Messages = ''
if sys.platform == "win32": if sys.platform == "win32":
MakeCommand = 'nmake -f %s' % (MakeFileName) MakeCommand = 'nmake -f %s' % (MakeFileName)
@ -2374,6 +2382,7 @@ class DscBuildData(PlatformBuildClassObject):
MakeCommand = 'make -f %s' % (MakeFileName) MakeCommand = 'make -f %s' % (MakeFileName)
returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand) returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand)
Messages = StdErr Messages = StdErr
Messages = Messages.split('\n') Messages = Messages.split('\n')
MessageGroup = [] MessageGroup = []
if returncode != 0: if returncode != 0:
@ -2418,8 +2427,8 @@ class DscBuildData(PlatformBuildClassObject):
else: else:
EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s' % MakeCommand) EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s' % MakeCommand)
if DscBuildData.NeedUpdateOutput(OutputValueFile, PcdValueInitExe, InputValueFile): if DscBuildData.NeedUpdateOutput(OutputValueFile, Dest_PcdValueInitExe, InputValueFile):
Command = PcdValueInitExe + ' -i %s -o %s' % (InputValueFile, OutputValueFile) Command = Dest_PcdValueInitExe + ' -i %s -o %s' % (InputValueFile, OutputValueFile)
returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (Command) returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (Command)
if returncode != 0: if returncode != 0:
EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect output from command: %s' % Command) EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect output from command: %s' % Command)