Reviewed-by: Liming Gao <liming....@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of BobCF
> Sent: Monday, October 22, 2018 11:24 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming....@intel.com>
> Subject: [edk2] [Patch] 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.f...@intel.com>
> Cc: Liming Gao <liming....@intel.com>
> ---
>  .../Source/Python/Workspace/DscBuildData.py   | 25 +++++++++++++------
>  1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 17e6f62cac..6fe03ff91a 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -84,10 +84,16 @@ PcdMakefileEnd = '''
>  LIBS = $(LIB_PATH)\Common.lib
> 
>  !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
>  '''
> 
> +AppTarget = '''
> +all: $(APPFILE)
> +$(APPFILE): $(OBJECTS)
> +%s
> +'''
> +
>  PcdGccMakefile = '''
>  MAKEROOT ?= $(EDK_TOOLS_PATH)/Source/C
>  LIBS = -lCommon
>  '''
> 
> @@ -2253,14 +2259,14 @@ class DscBuildData(PlatformBuildClassObject):
>          CAppBaseFileName = os.path.join(self.OutputPath, PcdValueInitName)
>          SaveFileOnChange(CAppBaseFileName + '.c', CApp, False)
> 
>          MakeApp = PcdMakefileHeader
>          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:
>              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 +='
> 
>          IncSearchList = []
>          PlatformInc = OrderedDict()
>          for Cache in self._Bdb._CACHE_.values():
> @@ -2332,10 +2338,13 @@ class DscBuildData(PlatformBuildClassObject):
>                                      CC_FLAGS += ' ' + Item
>          MakeApp += CC_FLAGS
> 
>          if sys.platform == "win32":
>              MakeApp = MakeApp + PcdMakefileEnd
> +            MakeApp = MakeApp + AppTarget % ("""\tcopy $(APPLICATION) 
> $(APPFILE) /y """)
> +        else:
> +            MakeApp = MakeApp + AppTarget % ("""\tcp $(APPLICATION) 
> $(APPFILE) """)
>          MakeApp = MakeApp + '\n'
>          IncludeFileFullPaths = []
>          for includefile in IncludeFiles:
>              for includepath in IncSearchList:
>                  includefullpath = os.path.join(str(includepath), includefile)
> @@ -2355,25 +2364,25 @@ class DscBuildData(PlatformBuildClassObject):
> 
>          InputValueFile = os.path.join(self.OutputPath, 'Input.txt')
>          OutputValueFile = os.path.join(self.OutputPath, 'Output.txt')
>          SaveFileOnChange(InputValueFile, InitByteValue, False)
> 
> -        PcdValueInitExe = PcdValueInitName
> +        Dest_PcdValueInitExe = PcdValueInitName
>          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:
> -            PcdValueInitExe = os.path.join(os.getenv("EDK_TOOLS_PATH"), 
> 'Bin', 'Win32', PcdValueInitName) +".exe"
> -
> +            Dest_PcdValueInitExe = os.path.join(self.OutputPath, 
> PcdValueInitName) +".exe"
>          Messages = ''
>          if sys.platform == "win32":
>              MakeCommand = 'nmake -f %s' % (MakeFileName)
>              returncode, StdOut, StdErr = DscBuildData.ExecuteCommand 
> (MakeCommand)
>              Messages = StdOut
>          else:
>              MakeCommand = 'make -f %s' % (MakeFileName)
>              returncode, StdOut, StdErr = DscBuildData.ExecuteCommand 
> (MakeCommand)
>              Messages = StdErr
> +
>          Messages = Messages.split('\n')
>          MessageGroup = []
>          if returncode != 0:
>              CAppBaseFileName = os.path.join(self.OutputPath, 
> PcdValueInitName)
>              File = open (CAppBaseFileName + '.c', 'r')
> @@ -2414,12 +2423,12 @@ class DscBuildData(PlatformBuildClassObject):
>              if MessageGroup:
>                  EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, 
> "\n".join(MessageGroup) )
>              else:
>                  EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute 
> command: %s' % MakeCommand)
> 
> -        if DscBuildData.NeedUpdateOutput(OutputValueFile, PcdValueInitExe, 
> InputValueFile):
> -            Command = PcdValueInitExe + ' -i %s -o %s' % (InputValueFile, 
> OutputValueFile)
> +        if DscBuildData.NeedUpdateOutput(OutputValueFile, 
> Dest_PcdValueInitExe, InputValueFile):
> +            Command = Dest_PcdValueInitExe + ' -i %s -o %s' % 
> (InputValueFile, OutputValueFile)
>              returncode, StdOut, StdErr = DscBuildData.ExecuteCommand 
> (Command)
>              if returncode != 0:
>                  EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect 
> output from command: %s' % Command)
> 
>          File = open (OutputValueFile, 'r')
> --
> 2.18.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to