BaseTools: Fixed a incremental build bug

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2451

If removing a header file from source code and file
system, the incremental build will fail.

This patch is to fix this issue by setting each header file
as a target without any actions in makefile.

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

Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Bob Feng
2020-01-17 11:11:27 +08:00
committed by mergify[bot]
parent 18fcb37598
commit 5cd3d4bc43
3 changed files with 13 additions and 4 deletions

View File

@ -1,7 +1,7 @@
## @file
# Create makefile for MS nmake and GNU make
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@ -191,6 +191,9 @@ class BuildFile(object):
if not os.path.exists(os.path.join(self._AutoGenObject.MakeFileDir, "dependency")):
with open(os.path.join(self._AutoGenObject.MakeFileDir, "dependency"),"w+") as fd:
fd.write("")
if not os.path.exists(os.path.join(self._AutoGenObject.MakeFileDir, "deps_target")):
with open(os.path.join(self._AutoGenObject.MakeFileDir, "deps_target"),"w+") as fd:
fd.write("")
return SaveFileOnChange(os.path.join(self._AutoGenObject.MakeFileDir, FileName), FileContent, False)
## Return a list of directory creation command string
@ -696,7 +699,9 @@ cleanlib:
"file_macro" : FileMacroList,
"file_build_target" : self.BuildTargetList,
"backward_compatible_target": BcTargetList,
"INCLUDETAG" : self._INCLUDE_CMD_[self._FileType] + " " + os.path.join("$(MODULE_BUILD_DIR)","dependency")
"INCLUDETAG" : "\n".join([self._INCLUDE_CMD_[self._FileType] + " " + os.path.join("$(MODULE_BUILD_DIR)","dependency"),
self._INCLUDE_CMD_[self._FileType] + " " + os.path.join("$(MODULE_BUILD_DIR)","deps_target")
])
}
return MakefileTemplateDict