Changeset 47

Show
Ignore:
Timestamp:
06/09/06 03:08:27 (6 years ago)
Author:
Derek Parnell
Message:

Upload version 3.01 (Build #2060)
modified trunk/Docs/autobuild.html
modified trunk/Docs/change_log.html
modified trunk/Docs/command_line.html
modified trunk/Docs/configuration_file.html
modified trunk/Docs/dlls.html
modified trunk/Docs/introduction.html
modified trunk/Docs/macros.html
modified trunk/Docs/pragmas.html
modified trunk/Docs/profile_file.html
modified trunk/Docs/response_file.html
modified trunk/Docs/rules.html
modified trunk/Docs/style.css
modified trunk/Docs/switches.html
modified trunk/Docs/todo.html
modified trunk/Docs/User_Manual.html
modified trunk/Source/build.d
modified trunk/Source/build_bn.d
modified trunk/Source/default.rdf
modified trunk/Source/docsrc/change_log.d
modified trunk/Source/docsrc/configuration_file.d
modified trunk/Source/docsrc/rules.d
modified trunk/Source/docsrc/style.css
modified trunk/Source/docsrc/switches.d
modified trunk/Source/docsrc/User_Manual.d
modified trunk/Source/docsrc/user_manual.ddoc
modified trunk/Source/source.d
modified trunk/Source/source_bn.d
modified trunk/Source/util/booltype.d
modified trunk/Source/util/fdt_bn.d
modified trunk/Source/util/fileex.d
modified trunk/Source/util/fileex_bn.d
modified trunk/Source/util/linetoken_bn.d
modified trunk/Source/util/pathex.d
modified trunk/Source/util/pathex_bn.d
modified trunk/Source/util/str_bn.d
added downloads/build-3.01.doc.zip
added downloads/build-3.01.src.zip
added downloads/build_win_3.01.dbg.exe
added downloads/build_win_3.01.exe

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Docs/User_Manual.html

    r45 r47  
    6060    <ul><li><a href="switches.html#switch_help"><span class="subtoc">-?</span></a></li></ul> 
    6161    <ul><li><a href="switches.html#switch_allobj"><span class="subtoc">-allobj</span></a></li></ul> 
     62    <ul><li><a href="switches.html#switch_autowinlibs"><span class="subtoc">-AutoWinLibs</span></a></li></ul> 
    6263    <ul><li><a href="switches.html#switch_CFPATH"><span class="subtoc">-CFPATH</span></a></li></ul> 
    6364    <ul><li><a href="switches.html#switch_cleanup"><span class="subtoc">-clean</span></a></li></ul> 
     
    9192    <ul><li><a href="switches.html#switch_T"><span class="subtoc">-T&lt;name&gt;</span></a></li></ul> 
    9293    <ul><li><a href="switches.html#switch_test"><span class="subtoc">-test</span></a></li></ul> 
     94    <ul><li><a href="switches.html#switch_uses"><span class="subtoc">-uses</span></a></li></ul> 
    9395    <ul><li><a href="switches.html#switch_UMB"><span class="subtoc">-UMB</span></a></li></ul> 
    9496    <ul><li><a href="switches.html#switch_v"><span class="subtoc">-v (lowercase)</span></a></li></ul> 
     
    137139 
    138140 
    139 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     141<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    140142 </span></body> 
    141143                 </html> 
  • trunk/Docs/autobuild.html

    r45 r47  
    6666 
    6767 
    68 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     68<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    6969 </span></body> 
    7070                 </html> 
  • trunk/Docs/change_log.html

    r45 r47  
    1616<p>A list of changes and fixes that have been made. 
    1717</p> 
     18 
     19<a name=""><h3 class="subsection">v3.01 -- 09/June/2006 </h3></a> 
     20<ul><span class="list">    <li><span class="item">** <b>FIX: Ticket #18</b> The tool now ignores duplicate source 
     21    file names supplied to it from anywhere.</span></li> 
     22    <li><span class="item">** <b>FIX: Ticket #19</b> The tool now only passes object files, 
     23    library files, DigitalMars .def files, and resource files to the linker.</span></li> 
     24    <li><span class="item">** <b>FIX: Ticket #20</b> The 'Rules' system can now handle creation 
     25    of D source files.</span></li> 
     26    <li><span class="item">** <b>FIX: Ticket #22</b> A few spelling errors corrected in the 
     27    documentation.</span></li> 
     28    <li><span class="item">** <b>FIX: Ticket #23</b> When using a response file for the 
     29    DigitalMars linker, the tool now makes provision for Resource Files.</span></li> 
     30    <li><span class="item">** <b>FIX: Ticket #24</b> The tool now recognises .di files as 
     31    source files for the purposes of determining dependancies, but does 
     32    not allow them to be presented on the DMD compiler's command line.</span></li> 
     33    <li><span class="item">** <b>FIX: Ticket #25</b> The tool now scans the PATH environment 
     34    symbol rather than assuming that supplie executable file names that 
     35    do not have a path are in the current directory.</span></li> 
     36    <li><span class="item">** <b>FIX: Ticket #26</b> The LINKCMD configuration item is now 
     37    corrected parsed.</span></li> 
     38    <li><span class="item">** <b>ENH:</b> The 'Rules' functionality now allows some new special 
     39    tokens that represent the Basename and Path of the input and output files.</span></li> 
     40    <li><span class="item">** <b>ENH:</b> The 'Rules' functionality now ensures that the 
     41    output file's path exists prior to running the Rule's tool application.</span></li> 
     42    <li><span class="item">** <b>ENH:</b> The LINKCMD is now able to be used in the Build 
     43    configuration file.</span></li> 
     44    <li><span class="item">** <b>ENH:</b> A new switch "-uses" will cause the tool to 
     45    create a cross-reference file that details what modules use what, 
     46    and what modules are used by other modules.</span></li> 
     47</span></ul> 
     48 
     49 
    1850<a name=""><h3 class="subsection">v3.00 -- 05/June/2006 </h3></a> 
    1951<ul><span class="list">    <li><span class="item">** <b>FIX:</b> <i>Build</i> was using the wrong object file during 
     
    565597</span></ul> 
    566598 
    567 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     599<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    568600 </span></body> 
    569601                 </html> 
  • trunk/Docs/command_line.html

    r45 r47  
    128128 
    129129 
    130 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     130<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    131131 </span></body> 
    132132                 </html> 
  • trunk/Docs/configuration_file.html

    r45 r47  
    4141you want to invoke when creating libraries. 
    4242<pre class="code">   LIBCMD=D:\Applications\dm\bin\lib.exe 
     43</pre> 
     44 
     45<b>LINKCMD</b> <br> 
     46This specifies the location and program name for the linker application 
     47you want to invoke when creating executables. 
     48<pre class="code">   LINKCMD=ld 
    4349</pre> 
    4450 
     
    371377 
    372378 
    373 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     379<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    374380 </span></body> 
    375381                 </html> 
  • trunk/Docs/dlls.html

    r45 r47  
    3636 
    3737 
    38 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     38<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    3939 </span></body> 
    4040                 </html> 
  • trunk/Docs/introduction.html

    r45 r47  
    2828</p> 
    2929 
    30 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     30<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    3131 </span></body> 
    3232                 </html> 
  • trunk/Docs/macros.html

    r45 r47  
    9898<p><hr/> There are some special tokens that can be in the 
    9999replacement text. 
    100 <table><tr class="macrorow"><td class="macrocell">&nbsp;\n&nbsp;</td> <td class="macrocell">&nbsp;New Line&nbsp;</td> <td class="macrocell">&nbsp;An end-of-line marker replaces this token.&nbsp;</td> </tr> 
     100<table class="table"><tr class="macrorow"><td class="macrocell">&nbsp;\n&nbsp;</td> <td class="macrocell">&nbsp;New Line&nbsp;</td> <td class="macrocell">&nbsp;An end-of-line marker replaces this token.&nbsp;</td> </tr> 
    101101<tr class="macrorow"><td class="macrocell">&nbsp;\t&nbsp;</td> <td class="macrocell">&nbsp;Tab&nbsp;</td> <td class="macrocell">&nbsp;A tabulator character (ASCII 09) replaces this token.&nbsp;</td> </tr> 
    102102<tr class="macrorow"><td class="macrocell">&nbsp;\s&nbsp;</td> <td class="macrocell">&nbsp;Conditional Space&nbsp;</td> <td class="macrocell">&nbsp;If the previous output character 
     
    116116    </ul> 
    117117where &lt;type&gt; can be 
    118     <table>      <thead class="macrothead">        <tr class="macrorow"><td class="macrothcell"><b>Type</b></td>        <td class="macrothcell">Description</td> <td class="macrothcell">Example</td> <td class="macrothcell">Default</td></tr> 
     118    <table class="table">      <thead class="macrothead">        <tr class="macrorow"><td class="macrothcell"><b>Type</b></td>        <td class="macrothcell">Description</td> <td class="macrothcell">Example</td> <td class="macrothcell">Default</td></tr> 
    119119      </thead> 
    120120        <tr class="macrorow"><td class="macrocell">&nbsp;<b>open</b>&nbsp;</td>          <td class="macrocell">&nbsp;Begins a pattern or replacement text&nbsp;</td> <td class="macrocell">&nbsp;open=&lt;&nbsp;</td> <td class="macrocell">&nbsp;"&nbsp;</td></tr> 
     
    151151</p> 
    152152 
    153 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     153<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    154154 </span></body> 
    155155                 </html> 
  • trunk/Docs/pragmas.html

    r45 r47  
    203203</p> 
    204204 
    205 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     205<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    206206 </span></body> 
    207207                 </html> 
  • trunk/Docs/profile_file.html

    r45 r47  
    100100 
    101101 
    102 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     102<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    103103 </span></body> 
    104104                 </html> 
  • trunk/Docs/response_file.html

    r45 r47  
    5050 
    5151 
    52 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     52<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    5353 </span></body> 
    5454                 </html> 
  • trunk/Docs/rules.html

    r45 r47  
    3838The <i>tool</i> line can contain special tokens. These are keywords enclosed 
    3939in braces. At compile time, the tokens are replaced by replacement text 
    40 taken from the pragma(build) statement. There are two predefined tokens 
    41 that can be used. <b>{@IN}</b> is replaced by the name of the input file, 
    42 and <b>{@OUT}</b> is replaced by the name of the output file. 
    43  
     40taken from the pragma(build) statement. 
     41<table class="table"><thead class="thead"><tr class="row"><td class="thcell">Token&nbsp;</td> <td class="thcell">Usage&nbsp;</td></tr> 
     42</thead> 
     43<tr class="row"><td class="cell">@IN&nbsp;</td> <td class="cell">the name of the input file&nbsp;</td></tr> 
     44<tr class="row"><td class="cell">@OUT&nbsp;</td> <td class="cell">the name of the output file&nbsp;</td></tr> 
     45<tr class="row"><td class="cell">@IBASE&nbsp;</td> <td class="cell">the basename* of the input file.&nbsp;</td></tr> 
     46<tr class="row"><td class="cell">@OBASE&nbsp;</td> <td class="cell">the basename* of the output file.&nbsp;</td></tr> 
     47<tr class="row"><td class="cell">@IPATH&nbsp;</td> <td class="cell">the path of the input file.&nbsp;</td></tr> 
     48<tr class="row"><td class="cell">@OPATH&nbsp;</td> <td class="cell">the path of the output file.&nbsp;</td></tr> 
     49</table> 
     50<p class="note"><span class="noteid">NOTE:</span><span class="notebody"> *This is everything up to but not including the final '.' character in the name.</span></p> 
     51<i>Build</i> ensures that the outfile's path will exist before the tool 
     52application is run. 
    4453<pre class="code">----- Windows Resource Compiler -------- 
    4554This uses pragma( <b>build</b>, &lt;sourcefile&gt;.rc); 
     
    6271 
    6372 
    64 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     73<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    6574 </span></body> 
    6675                 </html> 
  • trunk/Docs/style.css

    r44 r47  
    1717} 
    1818 
     19td.thcell 
     20{ 
     21    vertical-align: top; 
     22    border: 1px #FFD0D0 solid; 
     23    background: #00CCFF; 
     24    color: #000088; 
     25    font-size: larger; 
     26    text-align: center; 
     27} 
     28 
     29td.cell 
     30{ 
     31    vertical-align: top; 
     32    border: 1px #FFD0D0 solid; 
     33} 
    1934 
    2035h1.topic 
     
    277292} 
    278293 
     294span.noteid 
     295{ 
     296    font-weight: bold; 
     297    font-style: italic; 
     298    font-size: smaller; 
     299} 
     300 
     301span.notebody 
     302{ 
     303    font-weight: normal; 
     304    font-style: italic; 
     305    font-size: smaller; 
     306} 
  • trunk/Docs/switches.html

    r45 r47  
    370370</ul> 
    371371 
     372 
     373<a name="switch_autowinlibs"><h2 class="section">switch: -AutoWinLibs(=&lt;Yes/No&gt;)<span class="secdef"> 
     374   Give Windows libraries to linker</span></h2></a> 
     375<ul class="indent">By default, when creating a Windows GUI application, <i>Build</i> will 
     376supply a list of commonly used windows libraries to the linker. However, 
     377if for some reason you do not want this to happen, you can use this switch 
     378to disable that. <br/>&nbsp;<br/> 
     379<b>Note:</b> that this switch is not valid for Posix editions of <i>Build</i>. 
     380</ul> 
     381 
    372382<a name="switch_modules"><h2 class="section">switch: -modules(=&lt;name&gt;)<span class="secdef"> 
    373383   Create a Module List File</span></h2></a> 
     
    387397</ul> 
    388398 
    389 <a name="switch_UMB"><h2 class="section">switch: -UBM=&lt;Yes/No&gt;<span class="secdef"> 
     399<a name="switch_uses"><h2 class="section">switch: -uses[=outputname]<span class="secdef"> 
     400    Create the Uses/Used-By cross reference file.</span></h2></a> 
     401<ul class="indent">This causes <i>Build</i> to create a file that details the modules that 
     402are used by a module and the modules that uses a module. 
     403<br/>&nbsp;<br/> 
     404You can optionally specify a name for the cross reference file. If you 
     405don't then the name of the cross reference file takes the Target file's 
     406base name and adds the extention ".use". 
     407<br/>&nbsp;<br/> 
     408The file is in two sections. The first, headed by the line <span class="quote">&quot;[USES]&quot;</span> 
     409lists each file that has been analyzed. Each line has the file name followed 
     410by <span class="quote">&quot;&lt;&gt;&quot;</span> followed by the path of a module that the file uses. 
     411The second, headed by the line <span class="quote">&quot;[USEDBY]&quot;</span> 
     412lists each module that has been used. Each line has the module followed 
     413by <span class="quote">&quot;&lt;&gt;&quot;</span> followed by the name of the file that uses it. 
     414<br/>&nbsp;<br/> 
     415Each section is sorted in ascending order. 
     416 
     417<p><span class="example"><i>Example:</i> The layout of the cross reference file</span><pre class="code">build tres -uses=xref.txt 
     418type xref.txt 
     419<pre class="code">[USES] 
     420bar.d &lt;&gt; y:\dmd\src\phobos\std\stdio.d 
     421foo.d &lt;&gt; bar.d 
     422tres.d &lt;&gt; foo.d 
     423tres.d &lt;&gt; tres_bn.d 
     424tres.d &lt;&gt; y:\dmd\src\phobos\std\stdio.d 
     425[USEDBY] 
     426bar.d &lt;&gt; foo.d 
     427foo.d &lt;&gt; tres.d 
     428tres_bn.d &lt;&gt; tres.d 
     429y:\dmd\src\phobos\std\stdio.d &lt;&gt; bar.d 
     430y:\dmd\src\phobos\std\stdio.d &lt;&gt; tres.d 
     431</pre> 
     432</pre></p> 
     433</ul> 
     434 
     435<a name="switch_UMB"><h2 class="section">switch: -UMB=&lt;Yes/No&gt;<span class="secdef"> 
    390436    Determines where the linker expects the object files.</span></h2></a> 
    391437<ul class="indent">For <b>DMD</b> environments, <i>Build</i> expects that object files will be created 
     
    414460</ul> 
    415461 
    416 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     462<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    417463 </span></body> 
    418464                 </html> 
  • trunk/Docs/todo.html

    r45 r47  
    3939 
    4040 
    41 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun  6 15:21:49 2006 
     41<br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun  9 16:40:49 2006 
    4242 </span></body> 
    4343                 </html> 
  • trunk/Source/build.d

    r44 r47  
    66 Authors: Derek Parnell, Melbourne 
    77 Initial Creation: January 2005 
    8  Version: 3.00 
     8 Version: 3.01 
    99 Date: August 2005 
    1010 License: 
     
    4040    version(Windows) { 
    4141        // OptLink Definition File 
    42         pragma (build_def, "VERSION 3.00"); 
     42        pragma (build_def, "VERSION 3.01"); 
    4343    } 
    4444} 
     
    114114    } 
    115115    char[] vSrcExtention=`d`; 
     116    char[] vSrcDInterfaceExt = `di`; 
    116117    char[] vMacroExtention=`mac`; 
    117118    char[] vDdocExtention=`ddoc`; 
     
    242243    version(BuildVerbose) Bool         vVerbose; 
    243244    Bool         vMacroInput; 
     245    Bool         vCollectUses; 
    244246    Bool         vNames; 
    245247    Bool         vAllObjects; 
     
    250252    Bool         vConsoleApp; 
    251253 
     254    char[]       vUsesOutput; 
    252255    char[]       vSymbolOutName; 
    253256    char[]       vRunParms; 
     
    261264    char[]       vAppPath; 
    262265    char[]       vAppName; 
    263     char[]       vAppVersion = "3.00"; 
     266    char[]       vAppVersion = "3.01"; 
    264267    char[]       vTargetName;           // Output name from first file name. 
    265268    char[]       vPragmaTargetName;     // Output name from pragma. 
     
    277280    } 
    278281    ExternRef[]  vExternals; 
     282    bool[char[]] vResourceFileTypes; 
     283    char[][]     vUDResTypes; 
    279284 
    280285 
     
    283288        char[]       vWinVer = ""; 
    284289        ubyte        vWinVerNum; 
     290        bool         vAutoWinLibs = true; 
    285291    } 
    286292 
     
    304310    version(BuildVerbose) vVerbose = False; 
    305311    vMacroInput = True; 
     312    vCollectUses = False; 
    306313    vNames = False; 
    307314    vAllObjects = False; 
     
    433440    writefln("            the object file to be created or residing in the current"); 
    434441    writefln("            directory."); 
     442    version(Windows) 
     443    { 
     444    writefln("  -AutoWinLibs=<Yes/No> If 'No' this prevents the tool from"); 
     445    writefln("              passing the standard set of Windows libraries"); 
     446    writefln("              to the linker for GUI applications. 'Yes' is"); 
     447    writefln("              is the default."); 
     448    } 
    435449    writefln("  [...]      All other options, objectfiles and libraries are"); 
    436450    writefln("              passed to the compiler"); 
     
    451465//------------------------------------------------------- 
    452466{ 
     467 
     468    if (vExeExtention.length > 0) 
     469    { 
     470        if (std.path.getExt(pExeName).length == 0) 
     471            pExeName ~= "." ~ vExeExtention; 
     472    } 
     473 
     474    if (util.pathex.IsRelativePath(pExeName) == True) 
     475    { 
     476        char[] lExePath; 
     477        lExePath = FindFileInPathList(vPathId, pExeName); 
     478        if (util.str.ends(lExePath, std.path.sep) == False) 
     479            lExePath ~= std.path.sep; 
     480 
     481        pExeName = util.pathex.CanonicalPath(lExePath ~ pExeName, false); 
     482    } 
     483 
    453484    if (util.fileex.FileExists(pExeName) == false) 
    454485    { 
     
    693724        { 
    694725            char[] lKeyValues; 
    695  
    696             lKeyValues = "@IN=" ~ lInFile ~ "," ~ "@OUT=" ~ lOutFile; 
     726            char[] lExe; 
     727            char[] lArgs; 
     728            int lPos; 
     729            int lInQuote; 
     730 
     731            // Ensure that the output file's path exists. 
     732            util.pathex.MakePath(lOutFile); 
     733 
     734            // Build up the parameters for the tool. 
     735            lKeyValues = "@IN=" ~ lInFile ~ "," ~ "@OUT=" ~ lOutFile ~ "," ~ 
     736                         "@IBASE=" ~ util.pathex.GetBaseName(lInFile) ~ "," ~ 
     737                         "@OBASE=" ~ util.pathex.GetBaseName(lOutFile) ~ "," ~ 
     738                         "@IPATH=" ~ std.path.getDirName(lInFile) ~ "," ~ 
     739                         "@OPATH=" ~ std.path.getDirName(lOutFile) 
     740                    ; 
    697741            foreach(char[] lOpt; pRef.ToolOpts) 
    698742            { 
     
    702746            lCommand = util.str.Expand(r.Tool,lKeyValues); 
    703747 
     748            // Separate the tool executable from its arguments. 
     749            lInQuote = 0; 
     750            for(lPos = 0; lPos < lCommand.length; lPos++) 
     751            { 
     752                if (lInQuote != 1) 
     753                { 
     754                    if (lCommand[lPos] == ' ' || lInQuote > 1) 
     755                    { 
     756                        lExe = lCommand[0.. lPos].dup; 
     757                        if (lInQuote > 1) 
     758                            lPos--; 
     759                        lArgs = lCommand[lPos+1 .. $].dup; 
     760                        break; 
     761                    } 
     762                    else if (lCommand[lPos] == '"') 
     763                    { 
     764                        lInQuote++; 
     765                    } 
     766                } 
     767                else if (lCommand[lPos] == '"') 
     768                { 
     769                    lInQuote++; 
     770                } 
     771            } 
     772 
    704773            // Run Compiler to compile the source files that need it. 
    705             lResult = RunCommand(lCommand); 
     774            lResult = RunCommand(lExe, lArgs); 
    706775            if (lResult != 0) 
    707776                return lResult; 
    708777        } 
    709         AddLink(lOutFile); 
     778        if (r.Output == vSrcExtention || r.Output == vSrcDInterfaceExt) 
     779        { 
     780            new Source(lOutFile, Source.EMode.Update); 
     781        } 
     782        else 
     783        { 
     784            AddLink(lOutFile); 
     785        } 
    710786 
    711787    } 
     
    783859    } 
    784860 
     861    // Run any external tools referenced in the source files. 
     862    foreach( ExternRef lRef; vExternals) 
     863    { 
     864        lRunResult = ProcessExternal( lRef ); 
     865        if (lRunResult != 0) 
     866            // If an external tool fails, stop immediately. 
     867            return lRunResult; 
     868    } 
     869 
    785870    // I'm linking if I'm not building a library, and a 'main' was 
    786871    // found, and I was not explicitly told not to link. 
     
    909994    } 
    910995 
    911     // Run any external tools referenced in the source files. 
    912     foreach( ExternRef lRef; vExternals) 
    913     { 
    914         lRunResult = ProcessExternal( lRef ); 
    915         if (lRunResult != 0) 
    916             // If an external tool fails, stop immediately. 
    917             return lRunResult; 
    918     } 
    919  
    920996    if (Source.FileCount == 0) 
    921997    { 
     
    9341010        } 
    9351011    } 
    936     else foreach(int i, Source lCurrentSource; Source) 
    937     { 
    938         // Check each source to see if we need to recompile it. 
    939         Bool lNeedsCompiling; 
    940         char[] lShortFileName; 
    941         char[] lFileType; 
    942  
    943         lNeedsCompiling = vForceCompile; 
    944  
    945         if (lCurrentSource.Ignore) 
    946             continue; 
    947  
    948         lShortFileName = util.pathex.AbbreviateFileName(lCurrentSource.FileName); 
    949         lFileType = std.path.getExt(lShortFileName); 
    950         if (lFileType != vSrcExtention && lFileType != vDdocExtention) 
    951             continue; 
    952  
    953         // Only source files are examined from here on. 
    954         if (lCurrentSource.NoLink || lFileType == vDdocExtention) 
    955         { 
    956             lNonLinkingSources ~= lCurrentSource; 
    957         } 
    958  
    959         if(lCurrentSource.FilesTime > lCurrentSource.ObjectsTime) 
    960         { 
    961             version(BuildVerbose) 
    962             { 
    963                 if (vVerbose == True) 
    964                     writefln("%s newer than its object file", lShortFileName); 
    965             } 
    966  
    967             lNeedsCompiling = True; 
    968  
    969         } else if(lCurrentSource.DependantsTime > lCurrentSource.ObjectsTime) { 
    970             version(BuildVerbose) 
    971             { 
    972                 if (vVerbose == True) 
    973                     writefln("%s has newer dependants than its object file.", 
    974                                 lShortFileName); 
    975             } 
    976  
    977             lNeedsCompiling = True; 
    978         } 
    979  
    980         if(lNeedsCompiling == True) 
    981         { 
    982             lBuildRequired = True; 
    983             lCompiling = True; 
    984             lFilesToCompile ~= lShortFileName; 
    985  
    986             // Check to see if I'm allowed to link this file. 
    987             if (lCurrentSource.NoLink == false) 
     1012    else 
     1013    { 
     1014        int lInitCount; 
     1015 
     1016        do 
     1017        { 
     1018            lInitCount = Source.FileCount; 
     1019            foreach(int i, Source lCurrentSource; Source) 
     1020            { 
     1021                if (lCurrentSource.HasBeenScanned == false) 
     1022                { 
     1023                    lCurrentSource.search(); 
     1024                } 
     1025            } 
     1026        } while (lInitCount != Source.FileCount); 
     1027 
     1028        foreach(int i, Source lCurrentSource; Source) 
     1029        { 
     1030            // Check each source to see if we need to recompile it. 
     1031            Bool lNeedsCompiling; 
     1032            char[] lShortFileName; 
     1033            char[] lFileType; 
     1034 
     1035            lNeedsCompiling = vForceCompile; 
     1036 
     1037            if (lCurrentSource.Ignore) 
     1038                continue; 
     1039 
     1040            lShortFileName = util.pathex.AbbreviateFileName(lCurrentSource.FileName); 
     1041            lFileType = std.path.getExt(lShortFileName); 
     1042            if (lFileType != vSrcExtention && lFileType != vDdocExtention) 
     1043                continue; 
     1044 
     1045            // Only source files are examined from here on. 
     1046            if (lCurrentSource.NoLink || lFileType == vDdocExtention) 
     1047            { 
     1048                lNonLinkingSources ~= lCurrentSource; 
     1049            } 
     1050 
     1051            if(lCurrentSource.FilesTime > lCurrentSource.ObjectsTime) 
     1052            { 
     1053                version(BuildVerbose) 
     1054                { 
     1055                    if (vVerbose == True) 
     1056                        writefln("%s newer than its object file", lShortFileName); 
     1057                } 
     1058 
     1059                lNeedsCompiling = True; 
     1060 
     1061            } else if(lCurrentSource.DependantsTime > lCurrentSource.ObjectsTime) { 
     1062                version(BuildVerbose) 
     1063                { 
     1064                    if (vVerbose == True) 
     1065                        writefln("%s has newer dependants than its object file.", 
     1066                                    lShortFileName); 
     1067                } 
     1068 
     1069                lNeedsCompiling = True; 
     1070            } 
     1071 
     1072            if(lNeedsCompiling == True) 
     1073            { 
     1074                lBuildRequired = True; 
     1075                lCompiling = True; 
     1076                lFilesToCompile ~= lShortFileName; 
     1077 
     1078                // Check to see if I'm allowed to link this file. 
     1079                if (lCurrentSource.NoLink == false) 
     1080                    lFilesToLink ~= util.pathex.AbbreviateFileName(lCurrentSource.ObjectName); 
     1081 
     1082                version(BuildVerbose) 
     1083                { 
     1084                    if (vTestRun == False) 
     1085                    { 
     1086                        if (lCurrentSource.IncrementBuildNumber()) 
     1087                        { 
     1088                            if (vVerbose == True) 
     1089                                writefln("New build number %d for %s", 
     1090                                           lCurrentSource.BuildNumber, 
     1091                                            lCurrentSource.ModuleName); 
     1092                         } 
     1093                    } 
     1094                } 
     1095            } 
     1096            else if (lCurrentSource.NoLink == false) 
     1097            { 
    9881098                lFilesToLink ~= util.pathex.AbbreviateFileName(lCurrentSource.ObjectName); 
    989  
    990             version(BuildVerbose) 
    991             { 
    992                 if (vTestRun == False) 
    993                 { 
    994                     if (lCurrentSource.IncrementBuildNumber()) 
    995                     { 
    996                         if (vVerbose == True) 
    997                             writefln("New build number %d for %s", 
    998                                        lCurrentSource.BuildNumber, 
    999                                         lCurrentSource.ModuleName); 
    1000                      } 
    1001                 } 
    1002             } 
    1003         } 
    1004         else if (lCurrentSource.NoLink == false) 
    1005         { 
    1006             lFilesToLink ~= util.pathex.AbbreviateFileName(lCurrentSource.ObjectName); 
    1007         } 
    1008  
     1099            } 
     1100 
     1101        } 
    10091102    } 
    10101103 
     
    10301123            else 
    10311124                AddBuildDef("SUBSYSTEM WINDOWS"); 
    1032             vDefaultLibs ~= "gdi32.lib"; 
    1033             vDefaultLibs ~= "advapi32.lib"; 
    1034             vDefaultLibs ~= "COMCTL32.LIB"; 
    1035             vDefaultLibs ~= "comdlg32.lib"; 
    1036             vDefaultLibs ~= "CTL3D32.LIB"; 
    1037             vDefaultLibs ~= "kernel32.lib"; 
    1038             vDefaultLibs ~= "ODBC32.LIB"; 
    1039             vDefaultLibs ~= "ole32.lib"; 
    1040             vDefaultLibs ~= "OLEAUT32.LIB"; 
    1041             vDefaultLibs ~= "shell32.lib"; 
    1042             vDefaultLibs ~= "user32.lib"; 
    1043             vDefaultLibs ~= "uuid.lib"; 
    1044             vDefaultLibs ~= "winmm.lib"; 
    1045             vDefaultLibs ~= "winspool.lib"; 
    1046             vDefaultLibs ~= "wsock32.lib"; 
     1125            if (vAutoWinLibs == true) 
     1126            { 
     1127                vDefaultLibs ~= "gdi32.lib"; 
     1128                vDefaultLibs ~= "advapi32.lib"; 
     1129                vDefaultLibs ~= "COMCTL32.LIB"; 
     1130                vDefaultLibs ~= "comdlg32.lib"; 
     1131                vDefaultLibs ~= "CTL3D32.LIB"; 
     1132                vDefaultLibs ~= "kernel32.lib"; 
     1133                vDefaultLibs ~= "ODBC32.LIB"; 
     1134                vDefaultLibs ~= "ole32.lib"; 
     1135                vDefaultLibs ~= "OLEAUT32.LIB"; 
     1136                vDefaultLibs ~= "shell32.lib"; 
     1137                vDefaultLibs ~= "user32.lib"; 
     1138                vDefaultLibs ~= "uuid.lib"; 
     1139                vDefaultLibs ~= "winmm.lib"; 
     1140                vDefaultLibs ~= "winspool.lib"; 
     1141                vDefaultLibs ~= "wsock32.lib"; 
     1142            } 
    10471143        } 
    10481144        else if (Source.WasMainDLL) { 
     
    11411237            Bool IsMapping = False; 
    11421238 
     1239            // Prepare list of known resource file types. 
     1240            if (vResourceFileTypes.length == 0) 
     1241            { 
     1242                if (vUDResTypes.length == 0) 
     1243                { 
     1244                    vUDResTypes ~= "res"; 
     1245                } 
     1246                foreach( char[] lResType; vUDResTypes) 
     1247                { 
     1248                    vResourceFileTypes[lResType] = true; 
     1249                } 
     1250            } 
     1251 
    11431252            // Build the command line for the linker. 
    11441253            lCommandLine = ""; 
     
    12221331                { 
    12231332                    int lCnt; 
     1333 
    12241334                    foreach(char[] lFile; lFilesToLink) 
    12251335                    { 
     
    12281338                        lExt = std.path.getExt(lFile); 
    12291339                        lCnt = 0; 
    1230                         // Only include non OBJECT and non LIBRARY files
    1231                         if (lExt != vObjExtention && lExt != vLibExtention
     1340                        // Only include fiels with the correct extention type
     1341                        if (lExt in vResourceFileTypes
    12321342                        { 
    12331343                            lCommandLine ~= lFile; 
     
    12391349                    if (lCnt > 0) 
    12401350                        lCommandLine[$-1] = '\n'; 
     1351                    else 
     1352                        lCommandLine ~= "\n"; 
    12411353                } 
    12421354 
     
    18781990 
    18791991// ------------------------------------------- 
    1880 void ReadConfigFile() 
     1992void ReadCompilerConfigFile() 
    18811993// ------------------------------------------- 
    18821994{ 
     
    19672079        // Examine LINKCMD 
    19682080        lPos = std.string.find(lLine, "LINKCMD="); 
    1969         if(lPos == 0) { 
    1970             // Strip out any quotes 
    1971             while( (lPos = std.string.find(lLine, "\"")) != -1) 
    1972             { 
    1973                 lLine = lLine[0..lPos] ~ lLine[lPos+1 .. $]; 
    1974             } 
    1975  
    1976             vLinkerPath = std.path.getDirName(lLine[8..$]) ~ std.path.sep; 
    1977             vLinkerPath = util.pathex.CanonicalPath(vLinkerPath); 
    1978             vLinkerExe = std.path.getBaseName(lLine[7..$]); 
    1979             version(BuildVerbose) 
    1980             { 
    1981                 if(vVerbose == True) 
    1982                 { 
    1983                     writefln(" linker path %s",vLinkerPath); 
    1984                     writefln(" linker is %s",vLinkerExe); 
    1985                 } 
    1986             } 
     2081        if(lPos == 0) 
     2082        { 
     2083            SetFileLocation(lLine[8..$], vLinkerPath, vLinkerExe, "linker"); 
    19872084            continue; 
    19882085        } 
     
    19902087        lPos = std.string.find(lLine, "LIBCMD="); 
    19912088        if(lPos == 0) { 
    1992             // Strip out any quotes 
    1993             while( (lPos = std.string.find(lLine, "\"")) != -1) 
    1994             { 
    1995                 lLine = lLine[0..lPos] ~ lLine[lPos+1 .. $]; 
    1996             } 
    1997             vLibrarianPath = std.path.getDirName(lLine[7..$]) ~ std.path.sep; 
    1998             vLibrarianPath = util.pathex.CanonicalPath(vLibrarianPath); 
    1999  
    2000             vLibrarian = std.path.getBaseName(lLine[7..$]); 
    2001             version(BuildVerbose) 
    2002             { 
    2003                 if(vVerbose == True) 
    2004                 { 
    2005                     writefln(" librarian path %s",vLibrarianPath); 
    2006                     writefln(" librarian is %s",vLibrarian); 
    2007                 } 
    2008             } 
    2009         } 
    2010  
    2011  
    2012         if (vLinkerPath.length == 0) 
    2013             vLinkerPath = vCompilerPath; 
    2014         if (vLibrarianPath.length == 0) 
    2015             vLibrarianPath = vLinkerPath; 
     2089            SetFileLocation(lLine[7..$], vLibrarianPath, vLibrarian, "librarian"); 
     2090            continue; 
     2091        } 
     2092 
     2093    } 
     2094 
     2095    if (vLinkerPath.length == 0) 
     2096        SetFileLocation(vLinkerExe.dup, vLinkerPath, vLinkerExe, "linker"); 
     2097 
     2098    if (vLibrarianPath.length == 0) 
     2099        SetFileLocation(vLibrarian.dup, vLibrarianPath, vLibrarian, "librarian"); 
     2100
     2101 
     2102 
     2103void SetFileLocation(char[] pCmdValue, inout char[] pFilePath, inout char[] pFileExe, char[] pType) 
     2104
     2105    char[] lCmdValue; 
     2106    int lPos; 
     2107 
     2108    lCmdValue = pCmdValue.dup; 
     2109 
     2110    // Strip out any quotes 
     2111    while( (lPos = std.string.find(lCmdValue, "\"")) != -1) 
     2112    { 
     2113        lCmdValue = lCmdValue[0..lPos] ~ lCmdValue[lPos+1 .. $]; 
     2114    } 
     2115 
     2116    if (vExeExtention.length > 0) 
     2117    { 
     2118        if (std.path.getExt(lCmdValue).length == 0) 
     2119            lCmdValue ~= "." ~ vExeExtention; 
     2120    } 
     2121 
     2122    if (util.pathex.IsRelativePath(lCmdValue) == True) 
     2123    { 
     2124        pFilePath = FindFileInPathList(vPathId,lCmdValue); 
     2125        if (util.str.ends(pFilePath, std.path.sep) == False) 
     2126            pFilePath ~= std.path.sep; 
     2127 
     2128        pFilePath = util.pathex.CanonicalPath(pFilePath ~ lCmdValue, false); 
     2129    } 
     2130    else 
     2131    { 
     2132        pFilePath = util.pathex.CanonicalPath(lCmdValue, false); 
     2133    } 
     2134    pFileExe = std.path.getBaseName(pFilePath).dup; 
     2135    pFilePath = std.path.getDirName(pFilePath) ~ std.path.sep; 
     2136 
     2137    version(BuildVerbose) 
     2138    { 
     2139        if(vVerbose == True) 
     2140        { 
     2141            writefln(" %s path '%s'",pType, pFilePath); 
     2142            writefln(" %s is '%s'",pType, pFileExe); 
     2143        } 
    20162144    } 
    20172145} 
     
    20732201    char[] lPossiblePath; 
    20742202    char[] lLocalPath; 
    2075  
    2076     if (util.pathex.IsRelativePath(pFileName) == True && pScanList.length > 0) 
    2077     { 
    2078         // Do explicit scanning of supplied paths. 
    2079         foreach(char[] lNextRoot; pScanList) { 
    2080             lPossiblePath = ( lNextRoot ~ pFileName ); 
    2081             if(util.fileex.FileExists(lPossiblePath)) { 
     2203    char[] lFileBase; 
     2204    char[][] lFileExtList; 
     2205 
     2206    lFileExtList ~= std.file.getExt(pFileName); 
     2207    if (lFileExtList[0] == vSrcExtention) 
     2208    { 
     2209        lFileExtList ~= vSrcExtention; 
     2210        lFileExtList[0] = vSrcDInterfaceExt; 
     2211    } 
     2212    lFileBase = std.path.getName(pFileName); 
     2213    foreach (char[] lExt; lFileExtList) 
     2214    { 
     2215        char[] lTestFileName; 
     2216 
     2217        lTestFileName = lFileBase ~ "." ~ lExt; 
     2218        if (util.pathex.IsRelativePath(lTestFileName) == True && pScanList.length > 0) 
     2219        { 
     2220            // Do explicit scanning of supplied paths. 
     2221            foreach(char[] lNextRoot; pScanList) { 
     2222                lPossiblePath = ( lNextRoot ~ lTestFileName ); 
     2223                if(util.fileex.FileExists(lPossiblePath)) { 
     2224                    return util.pathex.AbbreviateFileName(lPossiblePath); 
     2225                } 
     2226            } 
     2227 
     2228            // If not found in scan list, drop through to standard scan. 
     2229        } 
     2230 
     2231        // Look for file in current folder first. 
     2232        lLocalPath = util.pathex.CanonicalPath(lTestFileName, false); 
     2233        if(util.fileex.FileExists(lLocalPath)) 
     2234        { 
     2235            return util.pathex.AbbreviateFileName(lLocalPath); 
     2236        } 
     2237 
     2238        // Examine each known import root to see if the file lives there. 
     2239        foreach(char[] lNextRoot; vImportRoots) 
     2240        { 
     2241            lPossiblePath = ( lNextRoot ~ lTestFileName ); 
     2242            if(util.fileex.FileExists(lPossiblePath)) 
     2243            { 
    20822244                return util.pathex.AbbreviateFileName(lPossiblePath); 
    20832245            } 
    20842246        } 
    20852247 
    2086         // If not found in scan list, drop through to standard scan. 
    2087     } 
    2088  
    2089     // Look for file in current folder first. 
    2090     lLocalPath = util.pathex.CanonicalPath(pFileName, false); 
    2091     if(util.fileex.FileExists(lLocalPath)) 
    2092     { 
    2093         return util.pathex.AbbreviateFileName(lLocalPath); 
    2094     } 
    2095  
    2096     // Examine each known import root to see if the file lives there. 
    2097     foreach(char[] lNextRoot; vImportRoots) 
    2098     { 
    2099         lPossiblePath = ( lNextRoot ~ pFileName ); 
    2100         if(util.fileex.FileExists(lPossiblePath)) 
    2101         { 
    2102             return util.pathex.AbbreviateFileName(lPossiblePath); 
    2103         } 
    2104     } 
    2105  
     2248    } 
    21062249    return util.pathex.AbbreviateFileName(lLocalPath); 
    21072250} 
    21082251 
    21092252 
    2110 // Function to locate where Complier is installed from the PATH symbol 
     2253// Function to locate where an executable is installed from the PATH symbol 
     2254// This returns the path to the file if the file exists otherwise null. 
    21112255// ------------------------------------------- 
    21122256char[] FindFileInPathList(char[] pSymName, char[] pFileName) 
     
    22382382    ExamineArgs( vCombinedArgs ); 
    22392383 
     2384    source.mCollectUses = vCollectUses; 
     2385 
    22402386    // Grab the external macro definitions unless otherwise told not to. 
    22412387    source.mMacroInput = vMacroInput; 
     
    22822428        char[][] lPotentialPaths; 
    22832429 
    2284  
    22852430        lPotentialPaths ~= "." ~ std.path.sep; 
    22862431        lPotentialPaths ~= util.str.GetEnv(vHomePathId); 
     
    23002445        foreach( char[] p; lPotentialPaths) 
    23012446        { 
    2302             if (util.str.ends(p, std.path.sep) is False) 
    2303                 p ~= std.path.sep; 
    2304             if (util.fileex.FileExists(p ~ vConfigFile) == true) 
    2305             { 
    2306                 vConfigPath = p.dup; 
    2307                 util.str.SetEnv("@P", std.path.getDirName(vConfigPath)); 
    2308                 break; 
    2309             } 
    2310         } 
    2311     } 
    2312  
     2447            if (p.length > 0) 
     2448            { 
     2449                if (util.str.ends(p, std.path.sep) is False) 
     2450                    p ~= std.path.sep; 
     2451                if (util.fileex.FileExists(p ~ vConfigFile) == true) 
     2452                { 
     2453                    vConfigPath = p.dup; 
     2454                    util.str.SetEnv("@P", std.path.getDirName(vConfigPath)); 
     2455                    break; 
     2456                } 
     2457            } 
     2458        } 
     2459    } 
     2460 
     2461    if (vExeExtention.length > 0) 
     2462    { 
     2463        if (std.path.getExt(vCompilerExe).length == 0) 
     2464            vCompilerExe ~= "." ~ vExeExtention; 
     2465    } 
    23132466    if (util.fileex.FileExists(vCompilerPath ~ vCompilerExe) == false) 
    23142467    { 
     
    23262479 
    23272480    ReadEnviron(); 
    2328     version(DigitalMars) ReadConfigFile(); 
     2481 
     2482    ReadCompilerConfigFile(); 
    23292483 
    23302484    version(Posix) 
     
    24442598    } 
    24452599 
     2600    if (vCollectUses == True) 
     2601    { 
     2602        char[] lPrevLine; 
     2603        char[] lFile; 
     2604 
     2605        lPrevLine.length = 0; 
     2606        lFile ~= "[USES]\n"; 
     2607        foreach(char[] lLine; Source.Uses.sort) 
     2608        { 
     2609            if (lLine != lPrevLine) 
     2610            { 
     2611                lFile ~= lLine ~ "\n"; 
     2612                lPrevLine = lLine.dup; 
     2613            } 
     2614        } 
     2615 
     2616        lPrevLine.length = 0; 
     2617        lFile ~= "[USEDBY]\n"; 
     2618        foreach(char[] lLine; Source.UsedBy.sort) 
     2619        { 
     2620            if (lLine != lPrevLine) 
     2621            { 
     2622                lFile ~= lLine ~ "\n"; 
     2623                lPrevLine = lLine.dup; 
     2624            } 
     2625        } 
     2626 
     2627        if (vUsesOutput.length == 0) 
     2628            vUsesOutput = util.pathex.GetBaseName(vTargetName) ~ ".use"; 
     2629 
     2630        std.file.write(vUsesOutput, lFile); 
     2631 
     2632    } 
     2633 
     2634 
    24462635    // Run the resulting program if it was requested. 
    24472636    if ((vExecuteProgram == True) && (vTargetExe.length > 0)) 
     
    28423031                } 
    28433032 
     3033                if (util.str.IsLike(pArg, "-uses*"d) == True) 
     3034                { 
     3035 
     3036                    vCollectUses = True; 
     3037                    vBuildArgs ~= pArg; 
     3038                    if (pArg.length > 5) 
     3039                    { 
     3040                        if (pArg[5] == '=' || pArg[5] == ':') 
     3041                            vUsesOutput = pArg[6..$]; 
     3042                        else 
     3043                            vUsesOutput = pArg[5..$]; 
     3044                    } 
     3045                    break; 
     3046                } 
    28443047 
    28453048                if (util.str.IsLike(pArg, "-UMB*"d) == True) 
     
    28643067                    Source.UseModBaseName(vUseModBaseName); 
    28653068                    break; 
     3069                } 
     3070                version(Windows) 
     3071                { 
     3072                if (util.str.IsLike(pArg, "-AutoWinLibs*"d) == True) 
     3073                { 
     3074 
     3075                    vBuildArgs ~= pArg; 
     3076                    if (pArg.length == 12) 
     3077                        vAutoWinLibs = true; 
     3078                    else 
     3079                    { 
     3080                        char lValue; 
     3081                        if (pArg[12] == '=' || pArg[12] == ':') 
     3082                            if (pArg.length > 13) 
     3083                                lValue = pArg[13]; 
     3084                            else 
     3085                                lValue = 'Y'; 
     3086 
     3087                        vAutoWinLibs = 
     3088                             (lValue == 'y' || 
     3089                              lValue == 'Y'); 
     3090                    } 
     3091                    break; 
     3092                } 
    28663093                } 
    28673094                // Special check for Object Write Path 
     
    32763503    static bool[ char[] ] lUsedPaths; 
    32773504 
     3505    version(BuildVerbose) 
     3506    { 
     3507        if (pVerbose == True) 
     3508            writefln("Build Configuration file %s [%s]", pPath, pArg[1..$]); 
     3509    } 
    32783510 
    32793511    lConfigFileName = pPath.dup; 
     
    32923524 
    32933525    if (lConfigFileName~pArg in lUsedPaths) 
     3526    { 
    32943527        return; 
     3528    } 
    32953529    lUsedPaths[lConfigFileName~pArg] = true; 
    32963530 
    3297     version(BuildVerbose) 
    3298     { 
    3299         if ((pVerbose == True)  && util.fileex.FileExists(lConfigFileName)) 
    3300             writefln("Build Configuration file %s [%s]", lConfigFileName, pArg[1..$]); 
    3301     } 
    33023531 
    33033532    lConfigLines = util.fileex.GetTextLines(lConfigFileName, util.fileex.GetOpt.Always); 
     
    33143543        if (lArg.length == 0) 
    33153544            continue; 
    3316  
    33173545        lArg = util.str.ExpandEnvVar(lArg); 
    33183546        if (!lFoundGroup) 
     
    33393567            { 
    33403568                if ((lArg[0] == '[') && (lArg[$-1] == ']')) 
     3569                { 
    33413570                    break; // Don't process any more lines. 
     3571                } 
    33423572 
    33433573                version(BuildVerbose) 
     
    33893619                else if (lArg.begins("LIBCMD=") == True) 
    33903620                { 
    3391                     int lPos; 
    3392  
    3393                     while( (lPos = std.string.find(lArg, "\"")) != -1) 
    3394                     { 
    3395                         lArg = lArg[0..lPos] ~ lArg[lPos+1 .. $]; 
    3396                     } 
    3397                     vLibrarianPath = std.path.getDirName(lArg[7..$]) ~ std.path.sep; 
    3398                     vLibrarianPath = util.pathex.CanonicalPath(vLibrarianPath); 
    3399  
    3400                     vLibrarian = std.path.getBaseName(lArg[7..$]); 
    3401                     version(BuildVerbose) 
    3402                     { 
    3403                         if(vVerbose == True) 
    3404                         { 
    3405                             writefln(" librarian path %s",vLibrarianPath); 
    3406                             writefln(" librarian is %s",vLibrarian); 
    3407                         } 
    3408                     } 
     3621                    SetFileLocation(lArg[7..$], vLibrarianPath, vLibrarian, "librarian"); 
     3622                } 
     3623                else if (lArg.begins("COMPCMD=") == True) 
     3624                { 
     3625                    SetFileLocation(lArg[8..$], vCompilerPath, vCompilerExe, "compiler"); 
     3626                } 
     3627                else if (lArg.begins("LINKCMD=") == True) 
     3628                { 
     3629                    SetFileLocation(lArg[8..$], vLinkerPath, vLinkerExe, "linker"); 
    34093630                } 
    34103631                else if (lArg.begins("LINKSWITCH=") == True) 
     
    35103731        case "HomePathId"      : { vHomePathId       = lValue.dup; break; } 
    35113732        case "EtcPath"         : { vEtcPath          = lValue.dup; break; } 
     3733        case "UDResTypes"      : { vUDResTypes       ~= std.string.split(lValue, ","); break; } 
    35123734        default: 
    35133735            writefln("Internal String Set '%s' ignored ... unknown name.", pCommand); 
  • trunk/Source/build_bn.d

    r44 r47  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 1965
     4long auto_build_number = 2061
  • trunk/Source/default.rdf

    r21 r47  
    1414out=obj 
    1515tool=dmc -c {OPT} -o{@OUT} {@IN} 
     16 
  • trunk/Source/docsrc/User_Manual.d

    r45 r47  
    5151    $(TOC_SUB switches,switch_help,-?) 
    5252    $(TOC_SUB switches,switch_allobj,-allobj) 
     53    $(TOC_SUB switches,switch_autowinlibs,-AutoWinLibs) 
    5354    $(TOC_SUB switches,switch_CFPATH,-CFPATH) 
    5455    $(TOC_SUB switches,switch_cleanup,-clean) 
     
    8283    $(TOC_SUB switches,switch_T,-T$(ANG name)) 
    8384    $(TOC_SUB switches,switch_test, -test) 
     85    $(TOC_SUB switches,switch_uses, -uses) 
    8486    $(TOC_SUB switches,switch_UMB, -UMB) 
    8587    $(TOC_SUB switches,switch_v,-v (lowercase)) 
  • trunk/Source/docsrc/change_log.d

    r45 r47  
    55A list of changes and fixes that have been made. 
    66) 
     7 
     8$(SUBSECTION_H ,v3.01 -- 09/June/2006 ) 
     9$(LIST 
     10    $(ITEM ** $(B FIX: Ticket #18) The tool now ignores duplicate source 
     11    file names supplied to it from anywhere.) 
     12    $(ITEM ** $(B FIX: Ticket #19) The tool now only passes object files, 
     13    library files, DigitalMars .def files, and resource files to the linker.) 
     14    $(ITEM ** $(B FIX: Ticket #20) The 'Rules' system can now handle creation 
     15    of D source files.) 
     16    $(ITEM ** $(B FIX: Ticket #22) A few spelling errors corrected in the 
     17    documentation.) 
     18    $(ITEM ** $(B FIX: Ticket #23) When using a response file for the 
     19    DigitalMars linker, the tool now makes provision for Resource Files.) 
     20    $(ITEM ** $(B FIX: Ticket #24) The tool now recognises .di files as 
     21    source files for the purposes of determining dependancies, but does 
     22    not allow them to be presented on the DMD compiler's command line.) 
     23    $(ITEM ** $(B FIX: Ticket #25) The tool now scans the PATH environment 
     24    symbol rather than assuming that supplie executable file names that 
     25    do not have a path are in the current directory.) 
     26    $(ITEM ** $(B FIX: Ticket #26) The LINKCMD configuration item is now 
     27    corrected parsed.) 
     28    $(ITEM ** $(B ENH:) The 'Rules' functionality now allows some new special 
     29    tokens that represent the Basename and Path of the input and output files.) 
     30    $(ITEM ** $(B ENH:) The 'Rules' functionality now ensures that the 
     31    output file's path exists prior to running the Rule's tool application.) 
     32    $(ITEM ** $(B ENH:) The LINKCMD is now able to be used in the Build 
     33    configuration file.) 
     34    $(ITEM ** $(B ENH:) A new switch "-uses" will cause the tool to 
     35    create a cross-reference file that details what modules use what, 
     36    and what modules are used by other modules.) 
     37) 
     38 
     39 
    740$(SUBSECTION_H ,v3.00 -- 05/June/2006 ) 
    841$(LIST 
  • trunk/Source/docsrc/configuration_file.d

    r44 r47  
    3333$(CODE 
    3434   LIBCMD=D:\Applications\dm\bin\lib.exe 
     35) 
     36 
     37$(B LINKCMD) $(BR) 
     38This specifies the location and program name for the linker application 
     39you want to invoke when creating executables. 
     40$(CODE 
     41   LINKCMD=ld 
    3542) 
    3643 
  • trunk/Source/docsrc/rules.d

    r41 r47  
    2828The $(I tool) line can contain special tokens. These are keywords enclosed 
    2929in braces. At compile time, the tokens are replaced by replacement text 
    30 taken from the pragma(build) statement. There are two predefined tokens 
    31 that can be used. $(B {@IN}) is replaced by the name of the input file, 
    32 and $(B {@OUT}) is replaced by the name of the output file. 
    33  
     30taken from the pragma(build) statement. 
     31$(TABLE 
     32$(THEAD 
     33$(ROW $(THCELL Token) $(THCELL Usage)) 
     34
     35$(ROW $(CELL @IN) $(CELL the name of the input file)) 
     36$(ROW $(CELL @OUT) $(CELL the name of the output file)) 
     37$(ROW $(CELL @IBASE) $(CELL the basename* of the input file.)) 
     38$(ROW $(CELL @OBASE) $(CELL the basename* of the output file.)) 
     39$(ROW $(CELL @IPATH) $(CELL the path of the input file.)) 
     40$(ROW $(CELL @OPATH) $(CELL the path of the output file.)) 
     41
     42$(NOTE *This is everything up to but not including the final '.' character in the name.) 
     43$(I Build) ensures that the outfile's path will exist before the tool 
     44application is run. 
    3445$(CODE 
    3546----- Windows Resource Compiler -------- 
  • trunk/Source/docsrc/style.css

    r44 r47  
    1717} 
    1818 
     19td.thcell 
     20{ 
     21    vertical-align: top; 
     22    border: 1px #FFD0D0 solid; 
     23    background: #00CCFF; 
     24    color: #000088; 
     25    font-size: larger; 
     26    text-align: center; 
     27} 
     28 
     29td.cell 
     30{ 
     31    vertical-align: top; 
     32    border: 1px #FFD0D0 solid; 
     33} 
    1934 
    2035h1.topic 
     
    277292} 
    278293 
     294span.noteid 
     295{ 
     296    font-weight: bold; 
     297    font-style: italic; 
     298    font-size: smaller; 
     299} 
     300 
     301span.notebody 
     302{ 
     303    font-weight: normal; 
     304    font-style: italic; 
     305    font-size: smaller; 
     306} 
  • trunk/Source/docsrc/switches.d

    r45 r47  
    411411In the example above, the executable built would be called 
    412412(in Windows) 'test_editor.exe'. 
     413) 
     414 
     415 
     416$(SECTIONDEF_H switch_autowinlibs,switch: -AutoWinLibs(=$(ANG Yes/No)), 
     417   Give Windows libraries to linker) 
     418$(INDENT 
     419By default, when creating a Windows GUI application, $(I Build) will 
     420supply a list of commonly used windows libraries to the linker. However, 
     421if for some reason you do not want this to happen, you can use this switch 
     422to disable that. $(BL) 
     423$(B Note:) that this switch is not valid for Posix editions of $(I Build). 
    413424) 
    414425 
     
    432443) 
    433444 
    434 $(SECTIONDEF_H switch_UMB,switch: -UBM=$(ANG Yes/No), 
     445$(SECTIONDEF_H switch_uses,switch: -uses$(SQR =outputname), 
     446    Create the Uses/Used-By cross reference file.) 
     447$(INDENT 
     448This causes $(I Build) to create a file that details the modules that 
     449are used by a module and the modules that uses a module. 
     450$(BL) 
     451You can optionally specify a name for the cross reference file. If you 
     452don't then the name of the cross reference file takes the Target file's 
     453base name and adds the extention ".use". 
     454$(BL) 
     455The file is in two sections. The first, headed by the line $(QUOTE $(SQR USES)) 
     456lists each file that has been analyzed. Each line has the file name followed 
     457by $(QUOTE <>) followed by the path of a module that the file uses. 
     458The second, headed by the line $(QUOTE $(SQR USEDBY)) 
     459lists each module that has been used. Each line has the module followed 
     460by $(QUOTE <>) followed by the name of the file that uses it. 
     461$(BL) 
     462Each section is sorted in ascending order. 
     463 
     464$(EXAMPLE The layout of the cross reference file, 
     465build tres -uses=xref.txt 
     466type xref.txt 
     467$(CODE 
     468[USES] 
     469bar.d <> y:\dmd\src\phobos\std\stdio.d 
     470foo.d <> bar.d 
     471tres.d <> foo.d 
     472tres.d <> tres_bn.d 
     473tres.d <> y:\dmd\src\phobos\std\stdio.d 
     474[USEDBY] 
     475bar.d <> foo.d 
     476foo.d <> tres.d 
     477tres_bn.d <> tres.d 
     478y:\dmd\src\phobos\std\stdio.d <> bar.d 
     479y:\dmd\src\phobos\std\stdio.d <> tres.d 
     480
     481
     482
     483 
     484$(SECTIONDEF_H switch_UMB,switch: -UMB=$(ANG Yes/No), 
    435485    Determines where the linker expects the object files.) 
    436486$(INDENT 
  • trunk/Source/docsrc/user_manual.ddoc

    r44 r47  
    5050DASHES          =---- 
    5151TABROW          =<div class="tabrow1">$1</div><div class="tabrow2">$+</div> 
     52TABLE           = <table class="table">$0</table> 
     53THEAD           = <thead class="thead">$0</thead> 
     54ROW             = <tr class="row">$0</tr> 
     55THCELL          = <td class="thcell">$0&nbsp;</td> 
     56CELL            = <td class="cell">$0&nbsp;</td> 
     57NOTE            = <p class="note"><span class="noteid">NOTE:</span><span class="notebody"> $0</span></p> 
  • trunk/Source/source.d

    r44 r47  
    3939module source; 
    4040private import source_bn;    // Build number for this module 
    41 version(build) pragma(include, "build"); 
     41//version(build) pragma(include, "build"); 
    4242version(unix)  version = Unix; 
    4343version(Unix)  version = Posix; 
     
    8989    bool[char[]] vActiveDebugs; 
    9090    long         vDebugLevel = 0; 
     91 
    9192 
    9293    class SourceException : Error 
     
    117118    version(BuildVerbose) Bool mVerboseMode; 
    118119    Bool mMacroInput; 
     120    Bool mCollectUses; 
    119121 
    120122} 
     
    136138    debug(1) 
    137139    { 
    138     writefln("util.str build #%d", auto_build_number); 
     140    writefln("source.d build #%d", source_bn.auto_build_number); 
    139141    } 
    140142} 
     
    155157            char[][] smScanOrder; 
    156158            bool smUseModBaseName; 
     159            bool[char[]] smUses; 
     160            bool[char[]] smUsedBy; 
    157161        } 
    158162        public 
    159163        { 
     164            enum EMode 
     165            { 
     166                New,            // Must be a new source file 
     167                Update          // Must update an existing record 
     168            } 
    160169            int FileCount() { return smSourceIndex.length; } 
    161170            int opApply(int delegate(inout int lCnt, inout Source) dg) 
     
    194203            bool UseModBaseName() { return smUseModBaseName; } 
    195204            void UseModBaseName(bool pNewValue) { smUseModBaseName = pNewValue; } 
     205            char[][] Uses() { return smUses.keys; } 
     206            char[][] UsedBy() { return smUsedBy.keys; } 
    196207 
    197208        } 
     
    248259    char[] LocalArgs () { return mLocalArgs.dup; } 
    249260 
     261    // HasBeenScanned (read only) 
     262    bool HasBeenScanned () { return mHasBeenSearched; } 
     263 
    250264// -------------------------------------------------------------------- 
    251265    static void Finalize() 
     
    259273        } 
    260274    } 
    261  
    262275// -------------------------------------------------------------------- 
    263     this(char[] pFileName
     276    this(char[] pFileName, EMode pMode = Source.EMode.New
    264277// -------------------------------------------------------------------- 
    265278    { 
     279        if (pFileName in Source.smSourceIndex) 
     280        { 
     281 
     282            if (pMode == Source.EMode.Update) 
     283            { 
     284                Source.smSourceIndex[pFileName].create(""); 
     285            } 
     286            else 
     287            { 
     288                mIgnore = true; 
     289                mHasBeenSearched = true; 
     290                mNoLink = true; 
     291            } 
     292 
     293        } 
     294        else 
     295        { 
     296            create(pFileName); 
     297        } 
     298    } 
     299 
     300// -------------------------------------------------------------------- 
     301    void create(char[] pFileName) 
     302// -------------------------------------------------------------------- 
     303    { 
    266304        char[] lObjectName; 
     305        EMode lMode; 
    267306 
    268307        mReferencedImports.length = 0; 
    269308        mHasBeenSearched = false; 
    270309        mIgnore = false; 
    271         mFileName = pFileName; 
     310        if (pFileName.length > 0) 
     311        { 
     312            mFileName = pFileName; 
     313            // Store this instantiation in the list of known files. 
     314            smSourceIndex[pFileName] = this; 
     315            lMode = EMode.New; 
     316        } 
     317        else 
     318        { 
     319            pFileName = mFileName; 
     320            lMode = EMode.Update; 
     321        } 
     322 
    272323        if (std.path.getExt(pFileName) != "ddoc") 
    273324        { 
    274             mNoLink = false
     325            mNoLink = (std.path.getExt(pFileName) == "di")
    275326            mModuleName = FileToModulename(pFileName); 
    276327            lObjectName = addExt(pFileName,ObjExt); 
     
    314365        mObjectTime   = util.fdt.GetFileTime(mObjectName); 
    315366        UpdateDependantTime(mObjectTime); 
    316  
    317367        version(BuildVerbose) 
    318368        { 
     
    327377        } 
    328378 
    329         // Store this instantiation in the list of known files. 
    330         smSourceIndex[pFileName] = this; 
    331  
    332         search(); 
     379        search(lMode); 
    333380    } 
    334381 
     
    345392 
    346393// -------------------------------------------------------------------- 
    347     void search(
     394    void search(EMode pMode = Source.EMode.New
    348395// -------------------------------------------------------------------- 
    349396    { 
     
    360407        } 
    361408 
     409        if (util.fileex.FileExists(mFileName) == false) 
     410        { 
     411            return; 
     412        } 
     413 
    362414        version(BuildVerbose) 
    363415        { 
     
    366418        } 
    367419 
    368         smScanOrder.length = smScanOrder.length + 1; 
    369         smScanOrder[$-1] = mFileName; 
     420        if (pMode == Source.EMode.New) 
     421        { 
     422            smScanOrder.length = smScanOrder.length + 1; 
     423            smScanOrder[$-1] = mFileName; 
     424        } 
    370425 
    371426        if (std.path.getExt(mFileName) != "ddoc") 
     
    406461            foreach(char[] lNextFile; mReferencedImports) 
    407462            { 
    408                 if(lNextFile in smSourceIndex) { 
     463                if (mCollectUses) 
     464                { 
     465                    smUses[mFileName ~ " <> " ~ lNextFile] = true; 
     466                    smUsedBy[lNextFile ~ " <> " ~ mFileName] = true; 
     467                } 
     468                if(lNextFile in smSourceIndex) 
     469                { 
    409470                    // Known file so just grab its mod time 
    410471                    lCurFileTime = smSourceIndex[lNextFile].DependantsTime; 
    411                 } else { 
     472                } 
     473                else 
     474                { 
    412475                    // Ignore specified modules as we assume they are in the lib. 
    413476                    lCanUse = true; 
    414                     if (!(ModulesToIgnore is null)) { 
     477                    if (!(ModulesToIgnore is null)) 
     478                    { 
    415479                        foreach(char[] lNextModule; ModulesToIgnore() ){ 
    416480                            int lFindPos; 
     
    493557                    if (lCanUse){ 
    494558                        // Not known yet, so add it and grab its mod time 
    495                         lNextFile = GetFullPathnameScan(lNextFile, ~0); 
    496                         lCurFileTime = (new Source(lNextFile)).DependantsTime; 
    497                     } 
     559                        char[] lUseName = GetFullPathnameScan(lNextFile, ~0); 
     560                        lCurFileTime = (new Source(lUseName, pMode)).DependantsTime; 
     561                    } 
     562 
    498563 
    499564                } 
     
    576641        if (! (lFileName in smSourceIndex) ) 
    577642        { 
     643            if (mCollectUses) 
     644            { 
     645                smUses[mFileName ~ " <> " ~ lFileName] = true; 
     646                smUsedBy[lFileName ~ " <> " ~ mFileName] = true; 
     647            } 
    578648            lBNSource = new Source(lFileName); 
    579649            lBNSource.search(); 
  • trunk/Source/source_bn.d

    r44 r47  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 1817
     4long auto_build_number = 1911
  • trunk/Source/util/booltype.d

    r44 r47  
    3333 
    3434    // --------------------------------- 
     35    // This overloads the '~' operator. 
    3536    int opCmp(Bool pOther) { 
    3637        // False sorts before True. 
  • trunk/Source/util/fdt_bn.d

    r44 r47  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 1583
     4long auto_build_number = 1675
  • trunk/Source/util/fileex.d

    r44 r47  
    316316{ 
    317317    if (pFileName in lExistingFiles) 
     318    { 
    318319        return true; 
     320    } 
    319321    try { 
    320322    if(std.file.isfile(pFileName) && std.file.exists(pFileName)) 
     
    323325        return true; 
    324326    } 
    325     } catch {}; 
     327    } catch { }; 
    326328    return false; 
    327329} 
  • trunk/Source/util/fileex_bn.d

    r44 r47  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 1652
     4long auto_build_number = 1744
  • trunk/Source/util/linetoken_bn.d

    r44 r47  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 1779
     4long auto_build_number = 1890
  • trunk/Source/util/pathex.d

    r44 r47  
    133133 
    134134// ---------------------------------------------- 
    135 char[] CanonicalPath(char[] pPath, bool pFinal = true) 
     135Bool IsAbsolutePath(char[] pPath) 
     136// ---------------------------------------------- 
     137
     138    version(Windows) 
     139    { 
     140        // Strip off an drive prefix first. 
     141        if (pPath.length > 1 && pPath[1] == ':') 
     142            pPath = pPath[2..$]; 
     143    } 
     144 
     145    return util.str.begins(pPath, std.path.sep); 
     146
     147 
     148// ---------------------------------------------- 
     149char[] CanonicalPath(char[] pPath, bool pDirInput = true) 
    136150// ---------------------------------------------- 
    137151{ 
     
    147161    lPath = pPath.dup; 
    148162 
    149     version(Windows){ 
     163    version(Windows) 
     164    { 
    150165        if ( (lPath.length > 1) && (lPath[1] == ':' ) ) 
    151166        { 
     
    177192    } 
    178193 
    179     if (pFinal && (lPath[$-std.path.sep.length .. $] != std.path.sep) ){ 
     194    if (pDirInput && (lPath[$-std.path.sep.length .. $] != std.path.sep) ){ 
    180195        lPath ~= std.path.sep; 
    181196    } 
     
    404419    char[] lBaseName; 
    405420 
    406     lBaseName = pPathFileName.dup; 
     421    lBaseName = pPathFileName; //.dup; 
    407422    for(int i = lBaseName.length-1; i >= 0; i--) 
    408423    { 
  • trunk/Source/util/pathex_bn.d

    r44 r47  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 1658
     4long auto_build_number = 1750
  • trunk/Source/util/str_bn.d

    r44 r47  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 1909
     4long auto_build_number = 2020