Added option '-u' to skip AutoGen step and option '-e' to force removing all cached...
authorjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 7 Apr 2008 05:25:42 +0000 (05:25 +0000)
committerjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 7 Apr 2008 05:25:42 +0000 (05:25 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1122 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/AutoGen/GenMake.py
Source/Python/Workspace/WorkspaceBuild.py
Source/Python/Workspace/WorkspaceDatabase.py
Source/Python/build/build.py

index 295b18e..e7660a5 100755 (executable)
@@ -506,14 +506,14 @@ fds: init build_fds
 # Build all libraries:\r
 #\r
 build_libraries:\r
-${BEGIN}\tcd ${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) pbuild\r
+${BEGIN}\t@cd ${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) pbuild\r
 ${END}\tcd $(BUILD_DIR)\r
 \r
 #\r
 # Build all modules:\r
 #\r
 build_modules:\r
-${BEGIN}\tcd ${module_build_directory} && "$(MAKE)" $(MAKE_FLAGS) pbuild\r
+${BEGIN}\t@cd ${module_build_directory} && "$(MAKE)" $(MAKE_FLAGS) pbuild\r
 ${END}\tcd $(BUILD_DIR)\r
 \r
 #\r
@@ -535,8 +535,8 @@ run:
 # Clean intermediate files\r
 #\r
 clean:\r
-\t${BEGIN}cd ${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) clean\r
-\t${END}${BEGIN}cd ${module_build_directory} && "$(MAKE)" $(MAKE_FLAGS) clean\r
+\t${BEGIN}@cd ${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) clean\r
+\t${END}${BEGIN}@cd ${module_build_directory} && "$(MAKE)" $(MAKE_FLAGS) clean\r
 \t${END}cd $(BUILD_DIR)\r
 \r
 #\r
@@ -550,7 +550,7 @@ ${END}
 # Clean all library files\r
 #\r
 cleanlib:\r
-\t${BEGIN}cd ${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) cleanall\r
+\t${BEGIN}@cd ${library_build_directory} && "$(MAKE)" $(MAKE_FLAGS) cleanall\r
 \t${END}cd $(BUILD_DIR)\r
 \r
 '''\r
index f423385..6ec16eb 100644 (file)
@@ -56,7 +56,7 @@ class ItemBuild(object):
         self.ModuleDatabase          = {}\r
 \r
 class WorkspaceBuild(object):\r
-    def __init__(self, ActivePlatform, WorkspaceDir):\r
+    def __init__(self, ActivePlatform, WorkspaceDir, Reparse=False):\r
         self.WorkspaceDir            = NormPath(WorkspaceDir)\r
         self.SupArchList             = []\r
         self.BuildTarget             = []\r
@@ -84,7 +84,7 @@ class WorkspaceBuild(object):
         #\r
         # Init build database\r
         #\r
-        self.Db = WorkspaceDatabase(DATABASE_PATH, GlobalData.gGlobalDefines)\r
+        self.Db = WorkspaceDatabase(DATABASE_PATH, GlobalData.gGlobalDefines, Reparse)\r
         self.Db.InitDatabase()\r
         \r
         #\r
index b457f77..3779ccd 100644 (file)
@@ -1833,13 +1833,16 @@ class WorkspaceDatabase(object):
         def __getitem__(self, Key):\r
             pass\r
 \r
-    def __init__(self, DbPath, GlobalMacros={}):\r
+    def __init__(self, DbPath, GlobalMacros={}, RenewDb=False):\r
         self._GlobalMacros = GlobalMacros\r
 \r
         DbDir = os.path.split(DbPath)[0]\r
         if not os.path.exists(DbDir):\r
             os.makedirs(DbDir)\r
 \r
+        if RenewDb and os.path.exists(DbPath):\r
+            os.remove(DbPath)\r
+\r
         self.Conn = sqlite3.connect(DbPath, isolation_level='DEFERRED')\r
         self.Conn.execute("PRAGMA synchronous=OFF")\r
         self.Conn.execute("PRAGMA temp_store=MEMORY")\r
index 43f710b..fa4f9a5 100644 (file)
@@ -28,7 +28,6 @@ from Common import Misc as Utils
 \r
 from Common.TargetTxtClassObject import *\r
 from Common.ToolDefClassObject import *\r
-#from Common.EdkIIWorkspaceBuild import *\r
 from Common.DataType import *\r
 from AutoGen.AutoGen import *\r
 from GenFds.FdfParser import *\r
@@ -630,7 +629,8 @@ class Build():
     #\r
     def __init__(self, Target, WorkspaceDir, Platform, Module, Arch, ToolChain, \r
                  BuildTarget, FlashDefinition, FdList=[], FvList=[], \r
-                 MakefileType="nmake", SpawnMode=False, ThreadNumber=2):\r
+                 MakefileType="nmake", SpawnMode=False, ThreadNumber=2,\r
+                 SkipAutoGen=False, Reparse=False):\r
 \r
         self.WorkspaceDir = WorkspaceDir\r
 \r
@@ -646,6 +646,8 @@ class Build():
         self.MakefileType   = MakefileType\r
         self.SpawnMode      = SpawnMode\r
         self.ThreadNumber   = ThreadNumber\r
+        self.SkipAutoGen    = SkipAutoGen\r
+        self.Reparse        = Reparse\r
 \r
         self.TargetTxt    = TargetTxtClassObject()\r
         self.ToolDef      = ToolDefClassObject()\r
@@ -798,7 +800,7 @@ class Build():
             EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,\r
                             ExtraData="No active platform specified in target.txt or command line! Nothing can be built.\n")\r
 \r
-        Wb = WorkspaceBuild(self.PlatformFile, self.WorkspaceDir)\r
+        Wb = WorkspaceBuild(self.PlatformFile, self.WorkspaceDir, self.Reparse)\r
         PcdSet = {}\r
         if self.Fdf != None:\r
             self.Fdf = NormFile(self.Fdf, self.WorkspaceDir)\r
@@ -890,16 +892,18 @@ class Build():
 \r
         # skip file generation for cleanxxx targets and run target\r
         if Target not in ['clean', 'cleanlib', 'cleanall', 'run']:    \r
-            self.Progress.Start("Generating code")\r
             # for target which must generate AutoGen code and makefile\r
-            AutoGenResult.CreateCodeFile(CreateDepModuleCodeFile)\r
-            self.Progress.Stop("done!")\r
+            if not self.SkipAutoGen or Target == 'genc':\r
+                self.Progress.Start("Generating code")\r
+                AutoGenResult.CreateCodeFile(CreateDepModuleCodeFile)\r
+                self.Progress.Stop("done!")\r
             if Target == "genc":\r
                 return True\r
     \r
-            self.Progress.Start("Generating makefile")\r
-            AutoGenResult.CreateMakeFile(CreateDepModuleMakeFile)\r
-            self.Progress.Stop("done!")\r
+            if not self.SkipAutoGen or Target == 'genmake':\r
+                self.Progress.Start("Generating makefile")\r
+                AutoGenResult.CreateMakeFile(CreateDepModuleMakeFile)\r
+                self.Progress.Stop("done!")\r
             if Target == "genmake":\r
                 return True\r
 \r
@@ -961,11 +965,13 @@ class Build():
                         # Not to auto-gen for targets 'clean', 'cleanlib', 'cleanall', 'run', 'fds'\r
                         if self.Target not in ['clean', 'cleanlib', 'cleanall', 'run', 'fds']:\r
                             # for target which must generate AutoGen code and makefile\r
-                            Ma.CreateCodeFile(True)\r
+                            if not self.SkipAutoGen or self.Target == 'genc':\r
+                                Ma.CreateCodeFile(True)\r
                             if self.Target == "genc":\r
                                 continue\r
 \r
-                            Ma.CreateMakeFile(True)\r
+                            if not self.SkipAutoGen or self.Target == 'genmake':\r
+                                Ma.CreateMakeFile(True)\r
                             if self.Target == "genmake":\r
                                 continue\r
                         # Generate build task for the module\r
@@ -1138,6 +1144,10 @@ def MyOptionParser():
     Parser.add_option("-k", "--msft", action="store_const", dest="MakefileType", const="nmake", help="Make Option: Generate only NMAKE Makefiles: Makefile")\r
     Parser.add_option("-g", "--gcc", action="store_const", dest="MakefileType", const="gmake", help="Make Option: Generate only GMAKE Makefiles: GNUmakefile")\r
     Parser.add_option("-l", "--all", action="store_const", dest="MakefileType", const="all", help="Make Option: Generate both NMAKE and GMAKE makefiles.")\r
+\r
+    Parser.add_option("-u", "--skip-autogen", action="store_true", dest="SkipAutoGen", help="Skip AutoGen step.")\r
+    Parser.add_option("-e", "--re-parse", action="store_true", dest="Reparse", help="Re-parse all meta-data files.")\r
+\r
     # Parser.add_option("-D", action="append", dest="Defines", metavar="NAME[=[VALUE]]",\r
     #     help="Define global macro which can be used in DSC/DEC/INF files.")\r
 \r
@@ -1224,9 +1234,11 @@ def Main():
         if Option.FdfFile != None:\r
             Option.FdfFile = NormFile(Option.FdfFile, Workspace)\r
 \r
-        MyBuild = Build(Target, Workspace, Option.PlatformFile, Option.ModuleFile, Option.TargetArch,\r
-                        Option.ToolChain, Option.BuildTarget, Option.FdfFile, Option.RomImage, Option.FvImage,\r
-                        Option.MakefileType, Option.SpawnMode, Option.ThreadNumber)\r
+        MyBuild = Build(Target, Workspace, Option.PlatformFile, Option.ModuleFile, \r
+                        Option.TargetArch, Option.ToolChain, Option.BuildTarget, \r
+                        Option.FdfFile, Option.RomImage, Option.FvImage, \r
+                        Option.MakefileType, Option.SpawnMode, Option.ThreadNumber, \r
+                        Option.SkipAutoGen, Option.Reparse)\r
         MyBuild.Launch()\r
         MyBuild.DumpBuildData()\r
     except BaseException, X:\r