]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/Tools/GenCfgOpt.py
IntelFsp2Pkg/GenCfgOpt.py: Incremental build with UPD in sub DSC.
[mirror_edk2.git] / IntelFsp2Pkg / Tools / GenCfgOpt.py
index af7e14a10ad95c82fb99e4e01578bcbc632063df..a0b8bba81e6ba46d7be799538329b9ce686a1d7d 100644 (file)
@@ -313,6 +313,7 @@ EndList
         self._DscFile     = ''\r
         self._FvDir       = ''\r
         self._MapVer      = 0\r
+        self._DscTime     = 0\r
 \r
     def ParseMacros (self, MacroDefStr):\r
         # ['-DABC=1', '-D', 'CFG_DEBUG=1', '-D', 'CFG_OUTDIR=Build']\r
@@ -423,6 +424,9 @@ EndList
         self._DscFile     = DscFile\r
         self._FvDir       = FvDir\r
 \r
+        # Initial DSC time is parent DSC time.\r
+        self._DscTime     = os.path.getmtime(DscFile)\r
+\r
         IsDefSect       = False\r
         IsPcdSect       = False\r
         IsUpdSect       = False\r
@@ -530,6 +534,12 @@ EndList
                                         if IncludeDsc == None:\r
                                             print("ERROR: Cannot open file '%s'" % IncludeFilePath)\r
                                             raise SystemExit\r
+\r
+                                        # Update DscTime when newer DSC time found.\r
+                                        CurrentDscTime = os.path.getmtime(os.path.realpath(IncludeDsc.name))\r
+                                        if CurrentDscTime > self._DscTime:\r
+                                            self._DscTime = CurrentDscTime\r
+\r
                                         NewDscLines = IncludeDsc.readlines()\r
                                         IncludeDsc.close()\r
                                         DscLines = NewDscLines + DscLines\r
@@ -815,9 +825,8 @@ EndList
         if not os.path.exists(OutPutFile):\r
             NoFileChange = False\r
         else:\r
-            DscTime = os.path.getmtime(self._DscFile)\r
             OutputTime = os.path.getmtime(OutPutFile)\r
-            if DscTime > OutputTime:\r
+            if self._DscTime > OutputTime:\r
                 NoFileChange = False\r
         return NoFileChange\r
 \r