<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 5 4 2 2 2 2 2 4;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:-webkit-standard;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
samp
        {mso-style-priority:99;
        font-family:"Courier New";}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Yes. For Gcc and Clang, we can use –MMD –MF <filename.deps> to generate custom name dependency file for each source file. For example, gcc main.c  –MMD –MF main.deps. 
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">For MSVC and Intel compiler, there is a build option /showIncludes which makes compiler print the dependency files on stdout but not a file. The build tool will
 capture the message from stdout and generate .deps files on file system. The format will be the same as GCC generate.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Bob<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> afish@apple.com [mailto:afish@apple.com]
<br>
<b>Sent:</b> Tuesday, October 29, 2019 1:19 AM<br>
<b>To:</b> devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com><br>
<b>Cc:</b> Feng, Bob C <bob.c.feng@intel.com>; Ryszard Knop <ryszard.knop@linux.intel.com><br>
<b>Subject:</b> Re: [edk2-devel] [Patch 0/1] BaseTools: Using compiler to generate source code dependency files.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">The .d is the default file name extension used by GCC for dependency files. Given the dependency files are in the build output and the makefiles reference them explicitly I'm not sure there is going to be lots of confusion. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">But I think it is likely the default dependency file name is mostly just a convenience in constructing the makefiles, since if you use a custom name each invocation has to do string operations to create a file with a custom extension. Given
 our makefiles are generated by a tool this is probably not really an issue for us. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Does Visual Studio have the concept of a dependency file? If yes what suffix does that use, as I guess we could use that? I guess the dependency handling could just be some XML data in some larger Visual Studio meta data....<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">GCC/clang flags around dependencies. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"-webkit-standard",serif;color:black">-MD</span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
<a name="index-MD"></a><samp><span style="color:black">-MD</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> is equivalent to </span><samp><span style="color:black">-M -MF </span></samp><var><span style="font-family:"Courier New";color:black">file</span></var><span style="font-family:"-webkit-standard",serif;color:black">,
 except that </span><samp><span style="color:black">-E</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> is not implied. The driver determines <var><span style="font-family:"-webkit-standard",serif">file</span></var> based on whether
 an </span><samp><span style="color:black">-o</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> option is given. If it is, the driver uses its argument but with a suffix of </span><samp><span style="color:black">.d</span></samp><span style="font-family:"-webkit-standard",serif;color:black">,
 otherwise it takes the name of the input file, removes any directory components and suffix, and applies a </span><samp><span style="color:black">.d</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> suffix.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
<span style="font-family:"-webkit-standard",serif;color:black">If </span><samp><span style="color:black">-MD</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> is used in conjunction with </span><samp><span style="color:black">-E</span></samp><span style="font-family:"-webkit-standard",serif;color:black">,
 any </span><samp><span style="color:black">-o</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> switch is understood to specify the dependency output file (see <a href="https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#dashMF"><span style="color:#003399;text-decoration:none">-MF</span></a>),
 but if used without </span><samp><span style="color:black">-E</span></samp><span style="font-family:"-webkit-standard",serif;color:black">, each </span><samp><span style="color:black">-o</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> is
 understood to specify a target object file.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
<span style="font-family:"-webkit-standard",serif;color:black">Since </span><samp><span style="color:black">-E</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> is not implied, </span><samp><span style="color:black">-MD</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> can
 be used to generate a dependency output file as a side effect of the compilation process<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"-webkit-standard",serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><code><span style="font-size:10.0pt;color:black">-MF </span></code><var><span style="font-size:10.0pt;font-family:"Courier New";color:black">file</span></var><span style="font-family:"-webkit-standard",serif;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
<a name="index-MF"></a><span style="font-family:"-webkit-standard",serif;color:black">When used with </span><samp><span style="color:black">-M</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> or </span><samp><span style="color:black">-MM</span></samp><span style="font-family:"-webkit-standard",serif;color:black">,
 specifies a file to write the dependencies to. If no </span><samp><span style="color:black">-MF</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> switch is given the preprocessor sends the rules to the same place it would send preprocessed
 output.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
<span style="font-family:"-webkit-standard",serif;color:black">When used with the driver options </span><samp><span style="color:black">-MD</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> or </span><samp><span style="color:black">-MMD</span></samp><span style="font-family:"-webkit-standard",serif;color:black">, </span><samp><span style="color:black">-MF</span></samp><span style="font-family:"-webkit-standard",serif;color:black"> overrides
 the default dependency output file.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
<span style="font-family:"-webkit-standard",serif;color:black">If <var><span style="font-family:"-webkit-standard",serif">file</span></var> is </span><samp><span style="color:black">-</span></samp><span style="font-family:"-webkit-standard",serif;color:black">,
 then the dependencies are written to </span><samp><span style="color:black">stdout</span></samp><span style="font-family:"-webkit-standard",serif;color:black">.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Andrew Fish<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Oct 28, 2019, at 8:03 AM, Yao, Jiewen <<a href="mailto:jiewen.yao@intel.com">jiewen.yao@intel.com</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">I think we need avoid confusing for future.<br>
I don’t believe .d is good choice, since it is a known conflict.<br>
<br>
Thank you<br>
Yao Jiewen<br>
<br>
<br style="caret-color: rgb(0, 0, 0);font-variant-caps: normal;text-align:start;-webkit-text-stroke-width: 0px;word-spacing:0px">
<br>
</span><o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">-----Original Message-----<br>
From:<span class="apple-converted-space"> </span><a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a><span class="apple-converted-space"> </span><<a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>> On Behalf Of Bob Feng<br>
Sent: Monday, October 28, 2019 10:57 PM<br>
To: Ryszard Knop <<a href="mailto:ryszard.knop@linux.intel.com">ryszard.knop@linux.intel.com</a>>;<span class="apple-converted-space"> </span><a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a><br>
Subject: Re: [edk2-devel] [Patch 0/1] BaseTools: Using compiler to generate<br>
source code dependency files.<br>
<br>
Thanks for your comment. I think .d file should be fine since edk2 does not<br>
support D language.<br>
<br>
Thanks,<br>
Bob<br>
<br>
-----Original Message-----<br>
From: Ryszard Knop <<a href="mailto:ryszard.knop@linux.intel.com">ryszard.knop@linux.intel.com</a>><br>
Sent: Monday, October 28, 2019 8:24 PM<br>
To: <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>; Feng, Bob C <<a href="mailto:bob.c.feng@intel.com">bob.c.feng@intel.com</a>><br>
Subject: Re: [edk2-devel] [Patch 0/1] BaseTools: Using compiler to generate<br>
source code dependency files.<br>
<br>
Just a quick note: .d files are used by the D language. You might want to use an<br>
extension like .deps instead.<br>
<br>
On 2019-10-28 11:47, Bob Feng wrote:<br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">BZ:
<a href="https://bugzilla.tianocore.org/show_bug.cgi?id=2311">https://bugzilla.tianocore.org/show_bug.cgi?id=2311</a><br>
<br>
To support incremental build, build tool generates the dependent<br>
header file for each of source file. This procedure is done in AutoGen phase.<br>
The build tool goes through all the source file and header file and<br>
use regular expression to find out all the dependent files for a<br>
source file. This procedure is much time-consuming. And this method<br>
can't handle the MACRO in #include, for example #include PATH(xxx.h).<br>
<br>
This patch is going to use compiler to generate dependent files. This<br>
method will be faster and more accurate.<br>
<br>
The basic idea is:<br>
1. In AutoGen phase, build tool add "!Include deps.txt" into Makefile<br>
instead of defining COMMON_DEPS list.<br>
2. During the Make phase, the compilers, Trim and C preprocessor<br>
generate dependent files, .d file, for each source file.<br>
3. After Make, The build tool combines the .d files and generate a<br>
file deps.txt which list all the included files for a module.<br>
4. Each source file will depends on the Module's includes files. The<br>
difference with orignial behavior is that if the user change the<br>
source file, build tool will only build that source file in<br>
incremental build; while if the user change a module's header file,<br>
build tool will build the whole module in incremental build.<br>
<br>
In this way, the time of AutoGen phase will be reduced much. And since<br>
we will use c preprocessor to handle #include, the MACRO will be<br>
handled well and the final dependent files will be more accurate.<br>
<br>
Feng, Bob C (1):<br>
  BaseTools: Using compiler to generate source code dependency files.<br>
<br>
 BaseTools/Conf/build_rule.template            |  89 ++++++-----<br>
 BaseTools/Conf/tools_def.template             | 138 +++++++++---------<br>
 BaseTools/Source/Python/AutoGen/GenMake.py    |  73 +++------<br>
 .../Source/Python/AutoGen/IncludesAutoGen.py  |  99 +++++++++++++<br>
 BaseTools/Source/Python/Trim/Trim.py          | 113 +++++++++++---<br>
 BaseTools/Source/Python/build/build.py        |  58 ++++++--<br>
 6 files changed, 378 insertions(+), 192 deletions(-)<br>
 create mode 100644<br>
BaseTools/Source/Python/AutoGen/IncludesAutoGen.py<o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><o:p> </o:p></span></p>
</blockquote>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br>
<br>
</span><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>

You receive all messages sent to this group.


<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/49568">View/Reply Online (#49568)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/38877548/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>