From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.2317.1571206663291974008 for ; Tue, 15 Oct 2019 23:17:43 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0192aff2aa=derek.lin2@hpe.com) Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9G6BSiT016380; Wed, 16 Oct 2019 06:17:42 GMT Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 2vn9b11m8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Oct 2019 06:17:42 +0000 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g9t5009.houston.hpe.com (Postfix) with ESMTP id 727C455; Wed, 16 Oct 2019 06:17:41 +0000 (UTC) Received: from SZC0PA4FXD.asiapacific.hpqcorp.net (szc0pa4fxd.asiapacific.hpqcorp.net [10.43.42.135]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id 8D17648; Wed, 16 Oct 2019 06:17:39 +0000 (UTC) From: "Lin, Derek (HPS SW)" To: devel@edk2.groups.io Cc: derek.lin2@hpe.com, bob.c.feng@intel.com, liming.gao@intel.com, zhijux.fan@intel.com Subject: [PATCH] BaseTools: Fix an incremental build issue caused by macro in #include Date: Wed, 16 Oct 2019 14:17:26 +0800 Message-Id: <20191016061726.122168-1-derek.lin2@hpe.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-16_02:2019-10-15,2019-10-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=925 adultscore=0 impostorscore=0 priorityscore=1501 clxscore=1011 malwarescore=0 lowpriorityscore=0 suspectscore=1 bulkscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1910160058 Content-Transfer-Encoding: 8bit When c/h file use macro after #include, for example, In this case, GenMake is not able to create a healthy dependency for the c file. GenMake used to add $(FORCE_REBUILD) dependency in the c file, this guarantee the c file is always compiled in incremental build. But, this function is broken since 05217d210e8da37b47d0be58ec363f7af2fa1c18 which enable /MP for MSVC compiler, in order to compile multiple c files in one command multi-processing. The fix here is adding '$(FORCE_REBUILD)' back to retain the original function. Line number 1728 and 978 are the code pieces which handle this logic. Signed-off-by: Derek Lin --- BaseTools/Source/Python/AutoGen/GenMake.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 97ba158ff2..59a01a7f24 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1080,13 +1080,17 @@ cleanlib: else: CmdCppDict[item.Target.SubDir] = ['$(MAKE_FILE)', Path] if CppPath.Path in DependencyDict: - for Temp in DependencyDict[CppPath.Path]: - try: - Path = self.PlaceMacro(Temp.Path, self.Macros) - except: - continue - if Path not in (self.CommonFileDependency + CmdCppDict[item.Target.SubDir]): - CmdCppDict[item.Target.SubDir].append(Path) + if '$(FORCE_REBUILD)' in DependencyDict[CppPath.Path]: + if '$(FORCE_REBUILD)' not in (self.CommonFileDependency + CmdCppDict[item.Target.SubDir]): + CmdCppDict[item.Target.SubDir].append('$(FORCE_REBUILD)') + else: + for Temp in DependencyDict[CppPath.Path]: + try: + Path = self.PlaceMacro(Temp.Path, self.Macros) + except: + continue + if Path not in (self.CommonFileDependency + CmdCppDict[item.Target.SubDir]): + CmdCppDict[item.Target.SubDir].append(Path) if T.Commands: CommandList = T.Commands[:] for Item in CommandList[:]: -- 2.20.1.windows.1