From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.5046.1572265467819413768 for ; Mon, 28 Oct 2019 05:24:27 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: linux.intel.com, ip: 192.55.52.151, mailfrom: ryszard.knop@linux.intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 05:24:27 -0700 X-IronPort-AV: E=Sophos;i="5.68,240,1569308400"; d="scan'208";a="374216107" Received: from rknop-mobl.ger.corp.intel.com (HELO [10.102.8.30]) ([10.102.8.30]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Oct 2019 05:24:26 -0700 Subject: Re: [edk2-devel] [Patch 0/1] BaseTools: Using compiler to generate source code dependency files. To: devel@edk2.groups.io, bob.c.feng@intel.com References: <20191028104702.30620-1-bob.c.feng@intel.com> From: "Ryszard Knop" Message-ID: <2d66136b-e92e-e7b2-ecd8-3d1cc59bbdec@linux.intel.com> Date: Mon, 28 Oct 2019 13:23:38 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20191028104702.30620-1-bob.c.feng@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Just a quick note: .d files are used by the D language. You might want to use an extension like .deps instead. On 2019-10-28 11:47, Bob Feng wrote: > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2311 > > To support incremental build, build tool generates the dependent header > file for each of source file. This procedure is done in AutoGen phase. > The build tool goes through all the source file and header file and > use regular expression to find out all the dependent files for a source > file. This procedure is much time-consuming. And this method can't handle > the MACRO in #include, for example #include PATH(xxx.h). > > This patch is going to use compiler to generate dependent files. This method > will be faster and more accurate. > > The basic idea is: > 1. In AutoGen phase, build tool add "!Include deps.txt" into Makefile instead > of defining COMMON_DEPS list. > 2. During the Make phase, the compilers, Trim and C preprocessor generate > dependent files, .d file, for each source file. > 3. After Make, The build tool combines the .d files and generate a file deps.txt > which list all the included files for a module. > 4. Each source file will depends on the Module's includes files. The difference > with orignial behavior is that if the user > change the source file, build tool will only build that source file in > incremental build; while if the user change a module's header file, build tool > will build the whole module in incremental build. > > In this way, the time of AutoGen phase will be reduced much. And since we > will use c preprocessor to handle #include, the MACRO will be handled well > and the final dependent files will be more accurate. > > Feng, Bob C (1): > BaseTools: Using compiler to generate source code dependency files. > > BaseTools/Conf/build_rule.template | 89 ++++++----- > BaseTools/Conf/tools_def.template | 138 +++++++++--------- > BaseTools/Source/Python/AutoGen/GenMake.py | 73 +++------ > .../Source/Python/AutoGen/IncludesAutoGen.py | 99 +++++++++++++ > BaseTools/Source/Python/Trim/Trim.py | 113 +++++++++++--- > BaseTools/Source/Python/build/build.py | 58 ++++++-- > 6 files changed, 378 insertions(+), 192 deletions(-) > create mode 100644 BaseTools/Source/Python/AutoGen/IncludesAutoGen.py >