From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web10.4177.1571226844475798012 for ; Wed, 16 Oct 2019 04:54:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f+QTZV3P; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571226843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OZBcsS+ocyvVBbdtYZN8tzmeX7nLn7vQlon++IFwSXg=; b=f+QTZV3PhTXOXBDYda/lEwUzaH9veUH1FKBQrbN70lG1ZS/r6qBR0hH+99qh2V2/ZcnhnZ 7wv9jgJ3aIYj2d2EwbHmxmJ83kkoKmHTfNRK/9nAvl7uLrrKBPYf8ZGuCKEh+4tnMOlBTm iPkmILQMs8ZveBCMMJJMv0fYBT0Q6tg= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-gvgqvp5CNqeSL70g06BsOw-1; Wed, 16 Oct 2019 07:54:02 -0400 Received: by mail-wm1-f70.google.com with SMTP id j125so1094488wmj.6 for ; Wed, 16 Oct 2019 04:54:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=E7lMhFWz17nwhXsiSxW2S4FZ6vFhJi/FQpZS7dPudms=; b=QLDPkqCZji5oLgpt3vxL94rhvLPmTIK81uJ2ju6wTgIF1iP6EhiTJ2PFGBXzCZMlqx z86GmsxCStZKJDHegWnfoxAndVQtc86FtdTpj9GvFiVbEpGmtI9CVe0N6bS4QaMhWwyO nsFwWVMukRdnevck9d7rRYYmTnkEjIfr32gwRPn/93y+WTQMZHTgJ3hLX5T7JKMw0Lb2 sxqtTOG26wESzYGX+7WSjCzC3pgd8yfWwlRuSBdLWaYEro5FXHgI814zN7zPt1L7uEk2 w4hLvxElvPRURdthomWw/RAomwxK3bZx31Pe/gGsCEhbznXQLsTeZyMbDgB6vnwsY5fX t/EA== X-Gm-Message-State: APjAAAWjzQrsjdcjUAshZHZbRkqbb8/Kk6s5JTduyaDjEpT9DGjVGpK8 /P9i5uTnBg9kKO80EVc0yRyNV3LF0bLtOXJ8kQKaRFCsXmkUPwmY4XqlxpYczmd+P3lLeoHU6Ot peA2VN1pS6DFAIw== X-Received: by 2002:a7b:c7d3:: with SMTP id z19mr2908147wmk.83.1571226840740; Wed, 16 Oct 2019 04:54:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfLlZbzl5luQAV8eIhP5cJcIJpoBETNe/mHA8TxF1ZRG539tlPsjq+BXXbtKfTe0MMItZqIA== X-Received: by 2002:a7b:c7d3:: with SMTP id z19mr2908125wmk.83.1571226840506; Wed, 16 Oct 2019 04:54:00 -0700 (PDT) Return-Path: Received: from [192.168.1.36] (14.red-88-21-201.staticip.rima-tde.net. [88.21.201.14]) by smtp.gmail.com with ESMTPSA id s12sm26871426wra.82.2019.10.16.04.53.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Oct 2019 04:53:59 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH] BaseTools: Fix an incremental build issue caused by macro in #include To: devel@edk2.groups.io, derek.lin2@hpe.com Cc: bob.c.feng@intel.com, liming.gao@intel.com, zhijux.fan@intel.com References: <20191016061726.122168-1-derek.lin2@hpe.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <7bc1022a-d6c4-437d-e710-ba6ec0a72d65@redhat.com> Date: Wed, 16 Oct 2019 13:53:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191016061726.122168-1-derek.lin2@hpe.com> X-MC-Unique: gvgqvp5CNqeSL70g06BsOw-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Derek, On 10/16/19 8:17 AM, Lin, Derek (HPS SW) wrote: > When c/h file use macro after #include, for example, Apparently you forgot to write your 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. >=20 > Line number 1728 and 978 are the code pieces which handle this logic. >=20 > Signed-off-by: Derek Lin > --- > BaseTools/Source/Python/AutoGen/GenMake.py | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Sourc= e/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] =3D ['$(MAKE_FIL= E)', Path] > if CppPath.Path in DependencyDict: > - for Temp in DependencyDict[CppPath.Path]: > - try: > - Path =3D self.PlaceMacro(Temp.Path, self= .Macros) > - except: > - continue > - if Path not in (self.CommonFileDependency + = CmdCppDict[item.Target.SubDir]): > - CmdCppDict[item.Target.SubDir].append(Pa= th) > + if '$(FORCE_REBUILD)' in DependencyDict[CppPath.= Path]: > + if '$(FORCE_REBUILD)' not in (self.CommonFil= eDependency + CmdCppDict[item.Target.SubDir]): > + CmdCppDict[item.Target.SubDir].append('$= (FORCE_REBUILD)') > + else: > + for Temp in DependencyDict[CppPath.Path]: > + try: > + Path =3D self.PlaceMacro(Temp.Path, = self.Macros) > + except: > + continue > + if Path not in (self.CommonFileDependenc= y + CmdCppDict[item.Target.SubDir]): > + CmdCppDict[item.Target.SubDir].appen= d(Path) > if T.Commands: > CommandList =3D T.Commands[:] > for Item in CommandList[:]: >=20