From fcd4fbf30d77873467ce8e2c386f33425b3ae668 Mon Sep 17 00:00:00 2001
From: Yingke Liu <yingke.d.liu@intel.com>
Date: Thu, 21 Aug 2014 01:39:18 +0000
Subject: 1. AutoGen.c should be generated if it is not empty even if there are
 no C source files. 2. If there are sub directories in current module, the
 corresponding directory in OUTPUT should be created.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Chen, Hesheng <hesheng.chen@intel.com>
Reviewed-by: Feng, Bob C <bob.c.feng@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15860 6f19259b-4bc3-4df7-8a09-765794883524
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'BaseTools/Source/Python/AutoGen')

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 36e43478c7..6c9a4ffd2f 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2491,6 +2491,9 @@ class ModuleAutoGen(AutoGen):
             self._BuildTargets = {}
             self._FileTypes = {}
 
+        SubDirectory = os.path.join(self.OutputDir, File.SubDir)
+        if not os.path.exists(SubDirectory):
+            CreateDirectory(SubDirectory)
         LastTarget = None
         RuleChain = []
         SourceList = [File]
@@ -2604,7 +2607,7 @@ class ModuleAutoGen(AutoGen):
             AutoGenH = TemplateString()
             StringH = TemplateString()
             GenC.CreateCode(self, AutoGenC, AutoGenH, StringH, UniStringAutoGenC, UniStringBinBuffer)
-            if str(AutoGenC) != "" and TAB_C_CODE_FILE in self.FileTypes:
+            if str(AutoGenC) != "":
                 AutoFile = PathClass(gAutoGenCodeFileName, self.DebugDir)
                 self._AutoGenFileList[AutoFile] = str(AutoGenC)
                 self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
-- 
cgit v1.2.3