BaseTools: Enhance Basetool for incremental build

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2311

Include dependency file in Makefile to enhance
incremental build

Signed-off-by: Bob Feng <bob.c.feng@intel.com>

Cc: Liming Gao <liming.gao@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Bob Feng
2019-11-20 10:58:30 +08:00
committed by mergify[bot]
parent cb277815d5
commit 0c3e8e9947
4 changed files with 380 additions and 73 deletions

View File

@ -1129,8 +1129,31 @@ class ModuleAutoGen(AutoGen):
for Inc in IncludesList:
if Inc not in RetVal:
RetVal.append(str(Inc))
RetVal.extend(self.IncPathFromBuildOptions)
return RetVal
@cached_property
def IncPathFromBuildOptions(self):
IncPathList = []
for tool in self.BuildOption:
if 'FLAGS' in self.BuildOption[tool]:
flags = self.BuildOption[tool]['FLAGS']
whitespace = False
for flag in flags.split(" "):
flag = flag.strip()
if flag.startswith(("/I","-I")):
if len(flag)>2:
if os.path.exists(flag[2:]):
IncPathList.append(flag[2:])
else:
whitespace = True
continue
if whitespace and flag:
if os.path.exists(flag):
IncPathList.append(flag)
whitespace = False
return IncPathList
@cached_property
def IncludePathLength(self):
return sum(len(inc)+1 for inc in self.IncludePathList)