Changeset 47
- Timestamp:
- 06/09/06 03:08:27 (6 years ago)
- Files:
-
- 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 (added)
- trunk/Docs/User_Manual.html (modified) (3 diffs)
- trunk/Docs/autobuild.html (modified) (1 diff)
- trunk/Docs/change_log.html (modified) (2 diffs)
- trunk/Docs/command_line.html (modified) (1 diff)
- trunk/Docs/configuration_file.html (modified) (2 diffs)
- trunk/Docs/dlls.html (modified) (1 diff)
- trunk/Docs/introduction.html (modified) (1 diff)
- trunk/Docs/macros.html (modified) (3 diffs)
- trunk/Docs/pragmas.html (modified) (1 diff)
- trunk/Docs/profile_file.html (modified) (1 diff)
- trunk/Docs/response_file.html (modified) (1 diff)
- trunk/Docs/rules.html (modified) (2 diffs)
- trunk/Docs/style.css (modified) (2 diffs)
- trunk/Docs/switches.html (modified) (3 diffs)
- trunk/Docs/todo.html (modified) (1 diff)
- trunk/Source/build.d (modified) (38 diffs)
- trunk/Source/build_bn.d (modified) (1 diff)
- trunk/Source/default.rdf (modified) (1 diff)
- trunk/Source/docsrc/User_Manual.d (modified) (2 diffs)
- trunk/Source/docsrc/change_log.d (modified) (1 diff)
- trunk/Source/docsrc/configuration_file.d (modified) (1 diff)
- trunk/Source/docsrc/rules.d (modified) (1 diff)
- trunk/Source/docsrc/style.css (modified) (2 diffs)
- trunk/Source/docsrc/switches.d (modified) (2 diffs)
- trunk/Source/docsrc/user_manual.ddoc (modified) (1 diff)
- trunk/Source/source.d (modified) (16 diffs)
- trunk/Source/source_bn.d (modified) (1 diff)
- trunk/Source/util/booltype.d (modified) (1 diff)
- trunk/Source/util/fdt_bn.d (modified) (1 diff)
- trunk/Source/util/fileex.d (modified) (2 diffs)
- trunk/Source/util/fileex_bn.d (modified) (1 diff)
- trunk/Source/util/linetoken_bn.d (modified) (1 diff)
- trunk/Source/util/pathex.d (modified) (4 diffs)
- trunk/Source/util/pathex_bn.d (modified) (1 diff)
- trunk/Source/util/str_bn.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Docs/User_Manual.html
r45 r47 60 60 <ul><li><a href="switches.html#switch_help"><span class="subtoc">-?</span></a></li></ul> 61 61 <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> 62 63 <ul><li><a href="switches.html#switch_CFPATH"><span class="subtoc">-CFPATH</span></a></li></ul> 63 64 <ul><li><a href="switches.html#switch_cleanup"><span class="subtoc">-clean</span></a></li></ul> … … 91 92 <ul><li><a href="switches.html#switch_T"><span class="subtoc">-T<name></span></a></li></ul> 92 93 <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> 93 95 <ul><li><a href="switches.html#switch_UMB"><span class="subtoc">-UMB</span></a></li></ul> 94 96 <ul><li><a href="switches.html#switch_v"><span class="subtoc">-v (lowercase)</span></a></li></ul> … … 137 139 138 140 139 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 2006141 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 140 142 </span></body> 141 143 </html> trunk/Docs/autobuild.html
r45 r47 66 66 67 67 68 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 200668 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 69 69 </span></body> 70 70 </html> trunk/Docs/change_log.html
r45 r47 16 16 <p>A list of changes and fixes that have been made. 17 17 </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 18 50 <a name=""><h3 class="subsection">v3.00 -- 05/June/2006 </h3></a> 19 51 <ul><span class="list"> <li><span class="item">** <b>FIX:</b> <i>Build</i> was using the wrong object file during … … 565 597 </span></ul> 566 598 567 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 2006599 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 568 600 </span></body> 569 601 </html> trunk/Docs/command_line.html
r45 r47 128 128 129 129 130 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 2006130 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 131 131 </span></body> 132 132 </html> trunk/Docs/configuration_file.html
r45 r47 41 41 you want to invoke when creating libraries. 42 42 <pre class="code"> LIBCMD=D:\Applications\dm\bin\lib.exe 43 </pre> 44 45 <b>LINKCMD</b> <br> 46 This specifies the location and program name for the linker application 47 you want to invoke when creating executables. 48 <pre class="code"> LINKCMD=ld 43 49 </pre> 44 50 … … 371 377 372 378 373 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 2006379 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 374 380 </span></body> 375 381 </html> trunk/Docs/dlls.html
r45 r47 36 36 37 37 38 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 200638 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 39 39 </span></body> 40 40 </html> trunk/Docs/introduction.html
r45 r47 28 28 </p> 29 29 30 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 200630 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 31 31 </span></body> 32 32 </html> trunk/Docs/macros.html
r45 r47 98 98 <p><hr/> There are some special tokens that can be in the 99 99 replacement text. 100 <table ><tr class="macrorow"><td class="macrocell"> \n </td> <td class="macrocell"> New Line </td> <td class="macrocell"> An end-of-line marker replaces this token. </td> </tr>100 <table class="table"><tr class="macrorow"><td class="macrocell"> \n </td> <td class="macrocell"> New Line </td> <td class="macrocell"> An end-of-line marker replaces this token. </td> </tr> 101 101 <tr class="macrorow"><td class="macrocell"> \t </td> <td class="macrocell"> Tab </td> <td class="macrocell"> A tabulator character (ASCII 09) replaces this token. </td> </tr> 102 102 <tr class="macrorow"><td class="macrocell"> \s </td> <td class="macrocell"> Conditional Space </td> <td class="macrocell"> If the previous output character … … 116 116 </ul> 117 117 where <type> 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> 119 119 </thead> 120 120 <tr class="macrorow"><td class="macrocell"> <b>open</b> </td> <td class="macrocell"> Begins a pattern or replacement text </td> <td class="macrocell"> open=< </td> <td class="macrocell"> " </td></tr> … … 151 151 </p> 152 152 153 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 2006153 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 154 154 </span></body> 155 155 </html> trunk/Docs/pragmas.html
r45 r47 203 203 </p> 204 204 205 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 2006205 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 206 206 </span></body> 207 207 </html> trunk/Docs/profile_file.html
r45 r47 100 100 101 101 102 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 2006102 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 103 103 </span></body> 104 104 </html> trunk/Docs/response_file.html
r45 r47 50 50 51 51 52 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 200652 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 53 53 </span></body> 54 54 </html> trunk/Docs/rules.html
r45 r47 38 38 The <i>tool</i> line can contain special tokens. These are keywords enclosed 39 39 in 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 40 taken from the pragma(build) statement. 41 <table class="table"><thead class="thead"><tr class="row"><td class="thcell">Token </td> <td class="thcell">Usage </td></tr> 42 </thead> 43 <tr class="row"><td class="cell">@IN </td> <td class="cell">the name of the input file </td></tr> 44 <tr class="row"><td class="cell">@OUT </td> <td class="cell">the name of the output file </td></tr> 45 <tr class="row"><td class="cell">@IBASE </td> <td class="cell">the basename* of the input file. </td></tr> 46 <tr class="row"><td class="cell">@OBASE </td> <td class="cell">the basename* of the output file. </td></tr> 47 <tr class="row"><td class="cell">@IPATH </td> <td class="cell">the path of the input file. </td></tr> 48 <tr class="row"><td class="cell">@OPATH </td> <td class="cell">the path of the output file. </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 52 application is run. 44 53 <pre class="code">----- Windows Resource Compiler -------- 45 54 This uses pragma( <b>build</b>, <sourcefile>.rc); … … 62 71 63 72 64 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 200673 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 65 74 </span></body> 66 75 </html> trunk/Docs/style.css
r44 r47 17 17 } 18 18 19 td.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 29 td.cell 30 { 31 vertical-align: top; 32 border: 1px #FFD0D0 solid; 33 } 19 34 20 35 h1.topic … … 277 292 } 278 293 294 span.noteid 295 { 296 font-weight: bold; 297 font-style: italic; 298 font-size: smaller; 299 } 300 301 span.notebody 302 { 303 font-weight: normal; 304 font-style: italic; 305 font-size: smaller; 306 } trunk/Docs/switches.html
r45 r47 370 370 </ul> 371 371 372 373 <a name="switch_autowinlibs"><h2 class="section">switch: -AutoWinLibs(=<Yes/No>)<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 376 supply a list of commonly used windows libraries to the linker. However, 377 if for some reason you do not want this to happen, you can use this switch 378 to disable that. <br/> <br/> 379 <b>Note:</b> that this switch is not valid for Posix editions of <i>Build</i>. 380 </ul> 381 372 382 <a name="switch_modules"><h2 class="section">switch: -modules(=<name>)<span class="secdef"> 373 383 Create a Module List File</span></h2></a> … … 387 397 </ul> 388 398 389 <a name="switch_UMB"><h2 class="section">switch: -UBM=<Yes/No><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 402 are used by a module and the modules that uses a module. 403 <br/> <br/> 404 You can optionally specify a name for the cross reference file. If you 405 don't then the name of the cross reference file takes the Target file's 406 base name and adds the extention ".use". 407 <br/> <br/> 408 The file is in two sections. The first, headed by the line <span class="quote">"[USES]"</span> 409 lists each file that has been analyzed. Each line has the file name followed 410 by <span class="quote">"<>"</span> followed by the path of a module that the file uses. 411 The second, headed by the line <span class="quote">"[USEDBY]"</span> 412 lists each module that has been used. Each line has the module followed 413 by <span class="quote">"<>"</span> followed by the name of the file that uses it. 414 <br/> <br/> 415 Each 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 418 type xref.txt 419 <pre class="code">[USES] 420 bar.d <> y:\dmd\src\phobos\std\stdio.d 421 foo.d <> bar.d 422 tres.d <> foo.d 423 tres.d <> tres_bn.d 424 tres.d <> y:\dmd\src\phobos\std\stdio.d 425 [USEDBY] 426 bar.d <> foo.d 427 foo.d <> tres.d 428 tres_bn.d <> tres.d 429 y:\dmd\src\phobos\std\stdio.d <> bar.d 430 y:\dmd\src\phobos\std\stdio.d <> tres.d 431 </pre> 432 </pre></p> 433 </ul> 434 435 <a name="switch_UMB"><h2 class="section">switch: -UMB=<Yes/No><span class="secdef"> 390 436 Determines where the linker expects the object files.</span></h2></a> 391 437 <ul class="indent">For <b>DMD</b> environments, <i>Build</i> expects that object files will be created … … 414 460 </ul> 415 461 416 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 2006462 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 417 463 </span></body> 418 464 </html> trunk/Docs/todo.html
r45 r47 39 39 40 40 41 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 15:21:49 200641 <br /><hr/><span class="footnote">Generated by Ddoc, Fri Jun 9 16:40:49 2006 42 42 </span></body> 43 43 </html> trunk/Source/build.d
r44 r47 6 6 Authors: Derek Parnell, Melbourne 7 7 Initial Creation: January 2005 8 Version: 3.0 08 Version: 3.01 9 9 Date: August 2005 10 10 License: … … 40 40 version(Windows) { 41 41 // OptLink Definition File 42 pragma (build_def, "VERSION 3.0 0");42 pragma (build_def, "VERSION 3.01"); 43 43 } 44 44 } … … 114 114 } 115 115 char[] vSrcExtention=`d`; 116 char[] vSrcDInterfaceExt = `di`; 116 117 char[] vMacroExtention=`mac`; 117 118 char[] vDdocExtention=`ddoc`; … … 242 243 version(BuildVerbose) Bool vVerbose; 243 244 Bool vMacroInput; 245 Bool vCollectUses; 244 246 Bool vNames; 245 247 Bool vAllObjects; … … 250 252 Bool vConsoleApp; 251 253 254 char[] vUsesOutput; 252 255 char[] vSymbolOutName; 253 256 char[] vRunParms; … … 261 264 char[] vAppPath; 262 265 char[] vAppName; 263 char[] vAppVersion = "3.0 0";266 char[] vAppVersion = "3.01"; 264 267 char[] vTargetName; // Output name from first file name. 265 268 char[] vPragmaTargetName; // Output name from pragma. … … 277 280 } 278 281 ExternRef[] vExternals; 282 bool[char[]] vResourceFileTypes; 283 char[][] vUDResTypes; 279 284 280 285 … … 283 288 char[] vWinVer = ""; 284 289 ubyte vWinVerNum; 290 bool vAutoWinLibs = true; 285 291 } 286 292 … … 304 310 version(BuildVerbose) vVerbose = False; 305 311 vMacroInput = True; 312 vCollectUses = False; 306 313 vNames = False; 307 314 vAllObjects = False; … … 433 440 writefln(" the object file to be created or residing in the current"); 434 441 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 } 435 449 writefln(" [...] All other options, objectfiles and libraries are"); 436 450 writefln(" passed to the compiler"); … … 451 465 //------------------------------------------------------- 452 466 { 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 453 484 if (util.fileex.FileExists(pExeName) == false) 454 485 { … … 693 724 { 694 725 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 ; 697 741 foreach(char[] lOpt; pRef.ToolOpts) 698 742 { … … 702 746 lCommand = util.str.Expand(r.Tool,lKeyValues); 703 747 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 704 773 // Run Compiler to compile the source files that need it. 705 lResult = RunCommand(l Command);774 lResult = RunCommand(lExe, lArgs); 706 775 if (lResult != 0) 707 776 return lResult; 708 777 } 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 } 710 786 711 787 } … … 783 859 } 784 860 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 785 870 // I'm linking if I'm not building a library, and a 'main' was 786 871 // found, and I was not explicitly told not to link. … … 909 994 } 910 995 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 920 996 if (Source.FileCount == 0) 921 997 { … … 934 1010 } 935 1011 } 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 { 988 1098 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 } 1009 1102 } 1010 1103 … … 1030 1123 else 1031 1124 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 } 1047 1143 } 1048 1144 else if (Source.WasMainDLL) { … … 1141 1237 Bool IsMapping = False; 1142 1238 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 1143 1252 // Build the command line for the linker. 1144 1253 lCommandLine = ""; … … 1222 1331 { 1223 1332 int lCnt; 1333 1224 1334 foreach(char[] lFile; lFilesToLink) 1225 1335 { … … 1228 1338 lExt = std.path.getExt(lFile); 1229 1339 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) 1232 1342 { 1233 1343 lCommandLine ~= lFile; … … 1239 1349 if (lCnt > 0) 1240 1350 lCommandLine[$-1] = '\n'; 1351 else 1352 lCommandLine ~= "\n"; 1241 1353 } 1242 1354 … … 1878 1990 1879 1991 // ------------------------------------------- 1880 void ReadCo nfigFile()1992 void ReadCompilerConfigFile() 1881 1993 // ------------------------------------------- 1882 1994 { … … 1967 2079 // Examine LINKCMD 1968 2080 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"); 1987 2084 continue; 1988 2085 } … … 1990 2087 lPos = std.string.find(lLine, "LIBCMD="); 1991 2088 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 2103 void 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 } 2016 2144 } 2017 2145 } … … 2073 2201 char[] lPossiblePath; 2074 2202 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 { 2082 2244 return util.pathex.AbbreviateFileName(lPossiblePath); 2083 2245 } 2084 2246 } 2085 2247 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 } 2106 2249 return util.pathex.AbbreviateFileName(lLocalPath); 2107 2250 } 2108 2251 2109 2252 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. 2111 2255 // ------------------------------------------- 2112 2256 char[] FindFileInPathList(char[] pSymName, char[] pFileName) … … 2238 2382 ExamineArgs( vCombinedArgs ); 2239 2383 2384 source.mCollectUses = vCollectUses; 2385 2240 2386 // Grab the external macro definitions unless otherwise told not to. 2241 2387 source.mMacroInput = vMacroInput; … … 2282 2428 char[][] lPotentialPaths; 2283 2429 2284 2285 2430 lPotentialPaths ~= "." ~ std.path.sep; 2286 2431 lPotentialPaths ~= util.str.GetEnv(vHomePathId); … … 2300 2445 foreach( char[] p; lPotentialPaths) 2301 2446 { 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 } 2313 2466 if (util.fileex.FileExists(vCompilerPath ~ vCompilerExe) == false) 2314 2467 { … … 2326 2479 2327 2480 ReadEnviron(); 2328 version(DigitalMars) ReadConfigFile(); 2481 2482 ReadCompilerConfigFile(); 2329 2483 2330 2484 version(Posix) … … 2444 2598 } 2445 2599 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 2446 2635 // Run the resulting program if it was requested. 2447 2636 if ((vExecuteProgram == True) && (vTargetExe.length > 0)) … … 2842 3031 } 2843 3032 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 } 2844 3047 2845 3048 if (util.str.IsLike(pArg, "-UMB*"d) == True) … … 2864 3067 Source.UseModBaseName(vUseModBaseName); 2865 3068 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 } 2866 3093 } 2867 3094 // Special check for Object Write Path … … 3276 3503 static bool[ char[] ] lUsedPaths; 3277 3504 3505 version(BuildVerbose) 3506 { 3507 if (pVerbose == True) 3508 writefln("Build Configuration file %s [%s]", pPath, pArg[1..$]); 3509 } 3278 3510 3279 3511 lConfigFileName = pPath.dup; … … 3292 3524 3293 3525 if (lConfigFileName~pArg in lUsedPaths) 3526 { 3294 3527 return; 3528 } 3295 3529 lUsedPaths[lConfigFileName~pArg] = true; 3296 3530 3297 version(BuildVerbose)3298 {3299 if ((pVerbose == True) && util.fileex.FileExists(lConfigFileName))3300 writefln("Build Configuration file %s [%s]", lConfigFileName, pArg[1..$]);3301 }3302 3531 3303 3532 lConfigLines = util.fileex.GetTextLines(lConfigFileName, util.fileex.GetOpt.Always); … … 3314 3543 if (lArg.length == 0) 3315 3544 continue; 3316 3317 3545 lArg = util.str.ExpandEnvVar(lArg); 3318 3546 if (!lFoundGroup) … … 3339 3567 { 3340 3568 if ((lArg[0] == '[') && (lArg[$-1] == ']')) 3569 { 3341 3570 break; // Don't process any more lines. 3571 } 3342 3572 3343 3573 version(BuildVerbose) … … 3389 3619 else if (lArg.begins("LIBCMD=") == True) 3390 3620 { 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"); 3409 3630 } 3410 3631 else if (lArg.begins("LINKSWITCH=") == True) … … 3510 3731 case "HomePathId" : { vHomePathId = lValue.dup; break; } 3511 3732 case "EtcPath" : { vEtcPath = lValue.dup; break; } 3733 case "UDResTypes" : { vUDResTypes ~= std.string.split(lValue, ","); break; } 3512 3734 default: 3513 3735 writefln("Internal String Set '%s' ignored ... unknown name.", pCommand); trunk/Source/build_bn.d
r44 r47 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 1965;4 long auto_build_number = 2061; trunk/Source/default.rdf
r21 r47 14 14 out=obj 15 15 tool=dmc -c {OPT} -o{@OUT} {@IN} 16 trunk/Source/docsrc/User_Manual.d
r45 r47 51 51 $(TOC_SUB switches,switch_help,-?) 52 52 $(TOC_SUB switches,switch_allobj,-allobj) 53 $(TOC_SUB switches,switch_autowinlibs,-AutoWinLibs) 53 54 $(TOC_SUB switches,switch_CFPATH,-CFPATH) 54 55 $(TOC_SUB switches,switch_cleanup,-clean) … … 82 83 $(TOC_SUB switches,switch_T,-T$(ANG name)) 83 84 $(TOC_SUB switches,switch_test, -test) 85 $(TOC_SUB switches,switch_uses, -uses) 84 86 $(TOC_SUB switches,switch_UMB, -UMB) 85 87 $(TOC_SUB switches,switch_v,-v (lowercase)) trunk/Source/docsrc/change_log.d
r45 r47 5 5 A list of changes and fixes that have been made. 6 6 ) 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 7 40 $(SUBSECTION_H ,v3.00 -- 05/June/2006 ) 8 41 $(LIST trunk/Source/docsrc/configuration_file.d
r44 r47 33 33 $(CODE 34 34 LIBCMD=D:\Applications\dm\bin\lib.exe 35 ) 36 37 $(B LINKCMD) $(BR) 38 This specifies the location and program name for the linker application 39 you want to invoke when creating executables. 40 $(CODE 41 LINKCMD=ld 35 42 ) 36 43 trunk/Source/docsrc/rules.d
r41 r47 28 28 The $(I tool) line can contain special tokens. These are keywords enclosed 29 29 in 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 30 taken 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 44 application is run. 34 45 $(CODE 35 46 ----- Windows Resource Compiler -------- trunk/Source/docsrc/style.css
r44 r47 17 17 } 18 18 19 td.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 29 td.cell 30 { 31 vertical-align: top; 32 border: 1px #FFD0D0 solid; 33 } 19 34 20 35 h1.topic … … 277 292 } 278 293 294 span.noteid 295 { 296 font-weight: bold; 297 font-style: italic; 298 font-size: smaller; 299 } 300 301 span.notebody 302 { 303 font-weight: normal; 304 font-style: italic; 305 font-size: smaller; 306 } trunk/Source/docsrc/switches.d
r45 r47 411 411 In the example above, the executable built would be called 412 412 (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 419 By default, when creating a Windows GUI application, $(I Build) will 420 supply a list of commonly used windows libraries to the linker. However, 421 if for some reason you do not want this to happen, you can use this switch 422 to disable that. $(BL) 423 $(B Note:) that this switch is not valid for Posix editions of $(I Build). 413 424 ) 414 425 … … 432 443 ) 433 444 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 448 This causes $(I Build) to create a file that details the modules that 449 are used by a module and the modules that uses a module. 450 $(BL) 451 You can optionally specify a name for the cross reference file. If you 452 don't then the name of the cross reference file takes the Target file's 453 base name and adds the extention ".use". 454 $(BL) 455 The file is in two sections. The first, headed by the line $(QUOTE $(SQR USES)) 456 lists each file that has been analyzed. Each line has the file name followed 457 by $(QUOTE <>) followed by the path of a module that the file uses. 458 The second, headed by the line $(QUOTE $(SQR USEDBY)) 459 lists each module that has been used. Each line has the module followed 460 by $(QUOTE <>) followed by the name of the file that uses it. 461 $(BL) 462 Each section is sorted in ascending order. 463 464 $(EXAMPLE The layout of the cross reference file, 465 build tres -uses=xref.txt 466 type xref.txt 467 $(CODE 468 [USES] 469 bar.d <> y:\dmd\src\phobos\std\stdio.d 470 foo.d <> bar.d 471 tres.d <> foo.d 472 tres.d <> tres_bn.d 473 tres.d <> y:\dmd\src\phobos\std\stdio.d 474 [USEDBY] 475 bar.d <> foo.d 476 foo.d <> tres.d 477 tres_bn.d <> tres.d 478 y:\dmd\src\phobos\std\stdio.d <> bar.d 479 y:\dmd\src\phobos\std\stdio.d <> tres.d 480 ) 481 ) 482 ) 483 484 $(SECTIONDEF_H switch_UMB,switch: -UMB=$(ANG Yes/No), 435 485 Determines where the linker expects the object files.) 436 486 $(INDENT trunk/Source/docsrc/user_manual.ddoc
r44 r47 50 50 DASHES =---- 51 51 TABROW =<div class="tabrow1">$1</div><div class="tabrow2">$+</div> 52 TABLE = <table class="table">$0</table> 53 THEAD = <thead class="thead">$0</thead> 54 ROW = <tr class="row">$0</tr> 55 THCELL = <td class="thcell">$0 </td> 56 CELL = <td class="cell">$0 </td> 57 NOTE = <p class="note"><span class="noteid">NOTE:</span><span class="notebody"> $0</span></p> trunk/Source/source.d
r44 r47 39 39 module source; 40 40 private import source_bn; // Build number for this module 41 version(build) pragma(include, "build");41 //version(build) pragma(include, "build"); 42 42 version(unix) version = Unix; 43 43 version(Unix) version = Posix; … … 89 89 bool[char[]] vActiveDebugs; 90 90 long vDebugLevel = 0; 91 91 92 92 93 class SourceException : Error … … 117 118 version(BuildVerbose) Bool mVerboseMode; 118 119 Bool mMacroInput; 120 Bool mCollectUses; 119 121 120 122 } … … 136 138 debug(1) 137 139 { 138 writefln(" util.str build #%d",auto_build_number);140 writefln("source.d build #%d", source_bn.auto_build_number); 139 141 } 140 142 } … … 155 157 char[][] smScanOrder; 156 158 bool smUseModBaseName; 159 bool[char[]] smUses; 160 bool[char[]] smUsedBy; 157 161 } 158 162 public 159 163 { 164 enum EMode 165 { 166 New, // Must be a new source file 167 Update // Must update an existing record 168 } 160 169 int FileCount() { return smSourceIndex.length; } 161 170 int opApply(int delegate(inout int lCnt, inout Source) dg) … … 194 203 bool UseModBaseName() { return smUseModBaseName; } 195 204 void UseModBaseName(bool pNewValue) { smUseModBaseName = pNewValue; } 205 char[][] Uses() { return smUses.keys; } 206 char[][] UsedBy() { return smUsedBy.keys; } 196 207 197 208 } … … 248 259 char[] LocalArgs () { return mLocalArgs.dup; } 249 260 261 // HasBeenScanned (read only) 262 bool HasBeenScanned () { return mHasBeenSearched; } 263 250 264 // -------------------------------------------------------------------- 251 265 static void Finalize() … … 259 273 } 260 274 } 261 262 275 // -------------------------------------------------------------------- 263 this(char[] pFileName )276 this(char[] pFileName, EMode pMode = Source.EMode.New) 264 277 // -------------------------------------------------------------------- 265 278 { 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 { 266 304 char[] lObjectName; 305 EMode lMode; 267 306 268 307 mReferencedImports.length = 0; 269 308 mHasBeenSearched = false; 270 309 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 272 323 if (std.path.getExt(pFileName) != "ddoc") 273 324 { 274 mNoLink = false;325 mNoLink = (std.path.getExt(pFileName) == "di"); 275 326 mModuleName = FileToModulename(pFileName); 276 327 lObjectName = addExt(pFileName,ObjExt); … … 314 365 mObjectTime = util.fdt.GetFileTime(mObjectName); 315 366 UpdateDependantTime(mObjectTime); 316 317 367 version(BuildVerbose) 318 368 { … … 327 377 } 328 378 329 // Store this instantiation in the list of known files. 330 smSourceIndex[pFileName] = this; 331 332 search(); 379 search(lMode); 333 380 } 334 381 … … 345 392 346 393 // -------------------------------------------------------------------- 347 void search( )394 void search(EMode pMode = Source.EMode.New) 348 395 // -------------------------------------------------------------------- 349 396 { … … 360 407 } 361 408 409 if (util.fileex.FileExists(mFileName) == false) 410 { 411 return; 412 } 413 362 414 version(BuildVerbose) 363 415 { … … 366 418 } 367 419 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 } 370 425 371 426 if (std.path.getExt(mFileName) != "ddoc") … … 406 461 foreach(char[] lNextFile; mReferencedImports) 407 462 { 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 { 409 470 // Known file so just grab its mod time 410 471 lCurFileTime = smSourceIndex[lNextFile].DependantsTime; 411 } else { 472 } 473 else 474 { 412 475 // Ignore specified modules as we assume they are in the lib. 413 476 lCanUse = true; 414 if (!(ModulesToIgnore is null)) { 477 if (!(ModulesToIgnore is null)) 478 { 415 479 foreach(char[] lNextModule; ModulesToIgnore() ){ 416 480 int lFindPos; … … 493 557 if (lCanUse){ 494 558 // 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 498 563 499 564 } … … 576 641 if (! (lFileName in smSourceIndex) ) 577 642 { 643 if (mCollectUses) 644 { 645 smUses[mFileName ~ " <> " ~ lFileName] = true; 646 smUsedBy[lFileName ~ " <> " ~ mFileName] = true; 647 } 578 648 lBNSource = new Source(lFileName); 579 649 lBNSource.search(); trunk/Source/source_bn.d
r44 r47 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 1 817;4 long auto_build_number = 1911; trunk/Source/util/booltype.d
r44 r47 33 33 34 34 // --------------------------------- 35 // This overloads the '~' operator. 35 36 int opCmp(Bool pOther) { 36 37 // False sorts before True. trunk/Source/util/fdt_bn.d
r44 r47 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 1 583;4 long auto_build_number = 1675; trunk/Source/util/fileex.d
r44 r47 316 316 { 317 317 if (pFileName in lExistingFiles) 318 { 318 319 return true; 320 } 319 321 try { 320 322 if(std.file.isfile(pFileName) && std.file.exists(pFileName)) … … 323 325 return true; 324 326 } 325 } catch { };327 } catch { }; 326 328 return false; 327 329 } trunk/Source/util/fileex_bn.d
r44 r47 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 1 652;4 long auto_build_number = 1744; trunk/Source/util/linetoken_bn.d
r44 r47 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 1 779;4 long auto_build_number = 1890; trunk/Source/util/pathex.d
r44 r47 133 133 134 134 // ---------------------------------------------- 135 char[] CanonicalPath(char[] pPath, bool pFinal = true) 135 Bool 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 // ---------------------------------------------- 149 char[] CanonicalPath(char[] pPath, bool pDirInput = true) 136 150 // ---------------------------------------------- 137 151 { … … 147 161 lPath = pPath.dup; 148 162 149 version(Windows){ 163 version(Windows) 164 { 150 165 if ( (lPath.length > 1) && (lPath[1] == ':' ) ) 151 166 { … … 177 192 } 178 193 179 if (p Final&& (lPath[$-std.path.sep.length .. $] != std.path.sep) ){194 if (pDirInput && (lPath[$-std.path.sep.length .. $] != std.path.sep) ){ 180 195 lPath ~= std.path.sep; 181 196 } … … 404 419 char[] lBaseName; 405 420 406 lBaseName = pPathFileName .dup;421 lBaseName = pPathFileName; //.dup; 407 422 for(int i = lBaseName.length-1; i >= 0; i--) 408 423 { trunk/Source/util/pathex_bn.d
r44 r47 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 1 658;4 long auto_build_number = 1750; trunk/Source/util/str_bn.d
r44 r47 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 1909;4 long auto_build_number = 2020;
