public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bob Feng" <bob.c.feng@intel.com>
To: devel@edk2.groups.io
Subject: [Patch 0/1] BaseTools: Using compiler to generate source code dependency files.
Date: Mon, 28 Oct 2019 18:47:01 +0800	[thread overview]
Message-ID: <20191028104702.30620-1-bob.c.feng@intel.com> (raw)

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

-- 
2.20.1.windows.1


             reply	other threads:[~2019-10-28 10:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 10:47 Bob Feng [this message]
2019-10-28 10:47 ` [Patch 1/1] BaseTools: Generate source file dependency in Make phase Bob Feng
2019-10-28 12:23 ` [edk2-devel] [Patch 0/1] BaseTools: Using compiler to generate source code dependency files Ryszard Knop
2019-10-28 14:56   ` Bob Feng
2019-10-28 15:03     ` Yao, Jiewen
2019-10-28 15:25       ` Bob Feng
2019-10-28 17:18       ` Andrew Fish
2019-10-29  1:11         ` Bob Feng
2019-10-29  4:11           ` Andrew Fish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191028104702.30620-1-bob.c.feng@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox