]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
BaseTools/Build: Do not use Common.lib in Structured PCD app
authorKinney, Michael D <michael.d.kinney@intel.com>
Thu, 6 Feb 2020 23:07:12 +0000 (07:07 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 7 Feb 2020 07:04:16 +0000 (07:04 +0000)
https://bugzilla.tianocore.org/show_bug.cgi?id=2496

Reduce the build and env dependencies for the Structured PCD
application by removing the dependency on Common.lib that
is only built when BaseTools is built which does not
happen if pre-compiled BaseToools are used.  Change the
makefile for the Structure PCD application to build all
files from sources which adds PcdValueCommon.c to the
makefile.  Also remove PcdValueCommon.c from Common.lib.

With the change to the makefile for the Structured PCD
application, multiple C files are compiled.  Only
PcdValueInit.c contains the extra information expected
by the error/warning message parser.  Only parse the
DSC line number into an error message if there is an
error/warning in PcdValueInit.c.  Errors/warnings in
other files should be passed through.  This fixes a build
failure with no useful log information that was observed
when there was a compiler error in PcdValueCommon.c.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/C/Common/GNUmakefile
BaseTools/Source/C/Common/Makefile
BaseTools/Source/Python/Workspace/DscBuildData.py

index d09111bd64552b0f268d1f993de8b9f4acdeae08..b3eef7460f14c40a33ba447f1fc4d3f0fa956175 100644 (file)
@@ -28,7 +28,6 @@ OBJECTS = \
   PeCoffLoaderEx.o \\r
   SimpleFileParsing.o \\r
   StringFuncs.o \\r
-  TianoCompress.o \\r
-  PcdValueCommon.o\r
+  TianoCompress.o\r
 \r
 include $(MAKEROOT)/Makefiles/lib.makefile\r
index ff35540dc87c0be11d07c288ea37ed5df81f0254..ec61e45c81d848c624f72c97aacd126e45a1fe5e 100644 (file)
@@ -28,8 +28,7 @@ OBJECTS = \
   PeCoffLoaderEx.obj \\r
   SimpleFileParsing.obj \\r
   StringFuncs.obj \\r
-  TianoCompress.obj \\r
-  PcdValueCommon.obj\r
+  TianoCompress.obj\r
 \r
 !INCLUDE ..\Makefiles\ms.lib\r
 \r
index be6688dc751f64e0d07d81fb9da6c668134c9b72..476c7edaf9da6852f58ae3ccbe585d11939c7307 100644 (file)
@@ -91,9 +91,6 @@ WindowsCFLAGS = 'CFLAGS = $(CFLAGS) /wd4200 /wd4034 /wd4101 '
 LinuxCFLAGS = 'BUILD_CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable '\r
 PcdMakefileEnd = '''\r
 !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common\r
-\r
-LIBS = $(LIB_PATH)\Common.lib\r
-\r
 !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app\r
 '''\r
 \r
@@ -2637,10 +2634,10 @@ class DscBuildData(PlatformBuildClassObject):
 \r
         MakeApp = PcdMakefileHeader\r
         if sys.platform == "win32":\r
-            MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj\n' % (self.OutputPath, PcdValueInitName) + 'INC = '\r
+            MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + 'INC = '\r
         else:\r
             MakeApp = MakeApp + PcdGccMakefile\r
-            MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o\n' % (self.OutputPath, PcdValueInitName) + \\r
+            MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName, os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + \\r
                       'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='\r
 \r
         IncSearchList = []\r
@@ -2739,8 +2736,8 @@ class DscBuildData(PlatformBuildClassObject):
                     IncludeFileFullPaths.append(os.path.normpath(includefullpath))\r
                     break\r
         SearchPathList = []\r
-        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gWorkspace, "BaseTools/Source/C/Include")))\r
-        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gWorkspace, "BaseTools/Source/C/Common")))\r
+        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "BaseTools/Source/C/Include")))\r
+        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "BaseTools/Source/C/Common")))\r
         SearchPathList.extend(str(item) for item in IncSearchList)\r
         IncFileList = GetDependencyList(IncludeFileFullPaths, SearchPathList)\r
         for include_file in IncFileList:\r
@@ -2768,6 +2765,7 @@ class DscBuildData(PlatformBuildClassObject):
             returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand)\r
             Messages = StdErr\r
 \r
+        EdkLogger.verbose ('%s\n%s\n%s' % (MakeCommand, StdOut, StdErr))\r
         Messages = Messages.split('\n')\r
         MessageGroup = []\r
         if returncode != 0:\r
@@ -2777,16 +2775,21 @@ class DscBuildData(PlatformBuildClassObject):
             File.close()\r
             for Message in Messages:\r
                 if " error" in Message or "warning" in Message:\r
-                    FileInfo = Message.strip().split('(')\r
-                    if len (FileInfo) > 1:\r
-                        FileName = FileInfo [0]\r
-                        FileLine = FileInfo [1].split (')')[0]\r
-                    else:\r
-                        FileInfo = Message.strip().split(':')\r
-                        if len(FileInfo) < 2:\r
-                            continue\r
-                        FileName = FileInfo [0]\r
-                        FileLine = FileInfo [1]\r
+                    try:\r
+                        FileInfo = Message.strip().split('(')\r
+                        if len (FileInfo) > 1:\r
+                            FileName = FileInfo [0]\r
+                            FileLine = FileInfo [1].split (')')[0]\r
+                        else:\r
+                            FileInfo = Message.strip().split(':')\r
+                            if len(FileInfo) < 2:\r
+                                continue\r
+                            FileName = FileInfo [0]\r
+                            FileLine = FileInfo [1]\r
+                    except:\r
+                        continue\r
+                    if "PcdValueInit.c" not in FileName:\r
+                        continue\r
                     if FileLine.isdigit():\r
                         error_line = FileData[int (FileLine) - 1]\r
                         if r"//" in error_line:\r
@@ -2812,13 +2815,14 @@ class DscBuildData(PlatformBuildClassObject):
             if MessageGroup:\r
                 EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "\n".join(MessageGroup) )\r
             else:\r
-                EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s' % MakeCommand)\r
+                EdkLogger.error('Build', COMMAND_FAILURE, 'Can not execute command: %s\n%s\n%s' % (MakeCommand, StdOut, StdErr))\r
 \r
         if DscBuildData.NeedUpdateOutput(OutputValueFile, Dest_PcdValueInitExe, InputValueFile):\r
             Command = Dest_PcdValueInitExe + ' -i %s -o %s' % (InputValueFile, OutputValueFile)\r
             returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (Command)\r
+            EdkLogger.verbose ('%s\n%s\n%s' % (Command, StdOut, StdErr))\r
             if returncode != 0:\r
-                EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect output from command: %s' % Command)\r
+                EdkLogger.warn('Build', COMMAND_FAILURE, 'Can not collect output from command: %s\n%s\n' % (Command, StdOut, StdErr))\r
 \r
         File = open (OutputValueFile, 'r')\r
         FileBuffer = File.readlines()\r