Changeset 44
- Timestamp:
- 06/06/06 00:14:41 (6 years ago)
- Files:
-
- downloads/build-3.00.doc.zip (added)
- downloads/build-3.00.src.zip (added)
- downloads/build_win_3.00.dbg.exe (added)
- downloads/build_win_3.00.exe (added)
- trunk/Docs/User_Manual.html (modified) (7 diffs)
- trunk/Docs/autobuild.html (modified) (2 diffs)
- trunk/Docs/change_log.html (modified) (3 diffs)
- trunk/Docs/command_line.html (modified) (6 diffs)
- trunk/Docs/configuration_file.html (modified) (5 diffs)
- trunk/Docs/dlls.html (modified) (2 diffs)
- trunk/Docs/introduction.html (modified) (3 diffs)
- trunk/Docs/macros.html (added)
- trunk/Docs/none.css (added)
- trunk/Docs/pragmas.html (modified) (2 diffs)
- trunk/Docs/profile_file.html (added)
- trunk/Docs/response_file.html (modified) (2 diffs)
- trunk/Docs/rules.html (modified) (3 diffs)
- trunk/Docs/style.css (modified) (1 diff)
- trunk/Docs/switches.html (modified) (4 diffs)
- trunk/Docs/todo.html (modified) (2 diffs)
- trunk/Source/build.d (modified) (107 diffs)
- trunk/Source/build_bn.d (modified) (1 diff)
- trunk/Source/docsrc/User_Manual.d (modified) (5 diffs)
- trunk/Source/docsrc/change_log.d (modified) (1 diff)
- trunk/Source/docsrc/command_line.d (modified) (4 diffs)
- trunk/Source/docsrc/configuration_file.d (modified) (4 diffs)
- trunk/Source/docsrc/introduction.d (modified) (1 diff)
- trunk/Source/docsrc/macros.d (added)
- trunk/Source/docsrc/none.css (added)
- trunk/Source/docsrc/profile_file.d (added)
- trunk/Source/docsrc/style.css (modified) (1 diff)
- trunk/Source/docsrc/switches.d (modified) (4 diffs)
- trunk/Source/docsrc/um.d (modified) (1 diff)
- trunk/Source/docsrc/user_manual.ddoc (modified) (4 diffs)
- trunk/Source/example_build.cfg (modified) (2 diffs)
- trunk/Source/example_build.mdf (added)
- trunk/Source/source.d (modified) (22 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) (1 diff)
- trunk/Source/util/fileex_bn.d (modified) (1 diff)
- trunk/Source/util/linetoken_bn.d (modified) (1 diff)
- trunk/Source/util/macro.d (modified) (6 diffs)
- trunk/Source/util/pathex.d (modified) (4 diffs)
- trunk/Source/util/pathex_bn.d (modified) (1 diff)
- trunk/Source/util/str.d (modified) (7 diffs)
- trunk/Source/util/str_bn.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Docs/User_Manual.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from User_Manual.d --> 7 11 … … 49 53 <li><a href="rules.html">Rule Definition File</a></li> 50 54 51 <li><a href="commandline.html">Command Line</a></li> 55 <li><a href="macros.html">Macros</a></li> 56 57 <li><a href="command_line.html">Command Line</a></li> 52 58 53 59 <li><a href="switches.html">Switches</a></li> … … 70 76 <ul><li><a href="switches.html#switch_link"><span class="subtoc">-link</span></a></li></ul> 71 77 <ul><li><a href="switches.html#switch_M"><span class="subtoc">-M<name></span></a></li></ul> 78 <ul><li><a href="switches.html#switch_MDF"><span class="subtoc">-MDF<file></span></a></li></ul> 72 79 <ul><li><a href="switches.html#switch_names"><span class="subtoc">-names</span></a></li></ul> 73 80 <ul><li><a href="switches.html#switch_noautoimport"><span class="subtoc">-noautoimport</span></a></li></ul> … … 83 90 <ul><li><a href="switches.html#switch_T"><span class="subtoc">-T<name></span></a></li></ul> 84 91 <ul><li><a href="switches.html#switch_test"><span class="subtoc">-test</span></a></li></ul> 92 <ul><li><a href="switches.html#switch_UMB"><span class="subtoc">-UMB</span></a></li></ul> 85 93 <ul><li><a href="switches.html#switch_v"><span class="subtoc">-v (lowercase)</span></a></li></ul> 86 94 <ul><li><a href="switches.html#switch_V"><span class="subtoc">-V (uppercase)</span></a></li></ul> … … 89 97 <li><a href="response_file.html">Response File</a></li> 90 98 <li><a href="configuration_file.html">Configuration File</a></li> 99 <li><a href="profile_file.html">Profile File</a></li> 91 100 <li><a href="todo.html">Things Still To Do</a></li> 92 101 <li><a href="dlls.html">DLL Libraries</a></li> … … 98 107 <b>Authors:</b><br>Derek Parnell, Melbourne<br><br> 99 108 <b>Initial Creation:</b><br>January 2005<br><br> 100 <b>Version:</b><br> 2.09<br><br>109 <b>Version:</b><br> 3.0<br><br> 101 110 <b>Date:</b><br> August 2005<br><br> 102 111 <a name="license"></a> … … 127 136 128 137 129 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:342006130 </span></body>138 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 139 </span></body> 131 140 </html> trunk/Docs/autobuild.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from autobuild.d --> 7 11 … … 62 66 63 67 64 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:34200665 </span></body>68 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 69 </span></body> 66 70 </html> trunk/Docs/change_log.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from change_log.d --> 7 11 … … 12 16 <p>A list of changes and fixes that have been made. 13 17 </p> 18 <a name=""><h3 class="subsection">v3.00 -- 05/June/2006 </h3></a> 19 <ul><span class="list"> <li><span class="item">** <b>FIX:</b> <i>Build</i> was using the wrong object file during 20 linkages if a target object file did not exist but one with the same name 21 existed in any of the Import paths. 22 </span></li> 23 <li><span class="item">** <b>FIX:</b> With the <i>-R=No</i> switch, when using the Digital 24 Mars linker, <i>Build</i> was not formatting the command line correctly. 25 </span></li> 26 <li><span class="item">** <b>FIX: Ticket #10 </b> The tool now recognises the 27 <a href="pragmas.html#pragma_link">pragma linked</a> object files when 28 building a library. 29 </span></li> 30 <li><span class="item">** <b>FIX: Ticket #9 </b> Now, if the output file created by the 31 rule ends with the library extention, it is presented to the linker 32 as a library rather than an object file. 33 </span></li> 34 <li><span class="item">** <b>FIX: </b> <i>thanks to gmiller:</i> Added booltype.d to 35 Makefile files. 36 </span></li> 37 <li><span class="item">** <b>FIX: Ticket #15 </b> GDC places object files in the 38 directory from which it is called so the tool no longer assumes the 39 same directory as the corresponding source file. 40 </span></li> 41 <li><span class="item">** <b>FIX: Ticket #17 </b> Hopefully its a more posix-friendly 42 tool now. Most of the hard-coded switches and options that are 43 environment related are now user-configurable via the <a href="configuration_file.html"> 44 Configuration File</a> functionality. 45 </span></li> 46 <li><span class="item">** <b>FIX: </b> <i>thanks to gmiller:</i> Corrected the imports 47 in <i>util.fileex.d</i> 48 </span></li> 49 <li><span class="item">** <b>FIX: </b> <i>thanks to gmiller:</i> Module and package exclusion 50 was not working if your current directory was in a directory tree that 51 contained the module/package you were excluding. For example if your 52 current directory was C:\dmd\src\phobos it would not exclude any of the 53 'std' modules.</span></li> 54 55 <li><span class="item">** <b>ENH: </b> Any file name on the command line with an extention 56 of <i>".brf" </i> will be used as a <a href="response_file.html">Build Response File</a> 57 </span></li> 58 59 <li><span class="item">** <b>ENH: </b> If there is nothing on the command line and the 60 file 'build.brf' exists in the current directory, then it will be 61 used as the <a href="response_file.html">Build Response File</a> for this run. 62 </span></li> 63 64 <li><span class="item">** <b>ENH: </b> Will now look for the compiler's configuration file 65 in the following areas... 66 <ul><span class="list"> <li><span class="item">If defined, the directory defined by the <i>ConfigPath</i> 67 configuration item in <i>Build's</i> configuration file. And in this 68 case it doesn't look anywhere in any of the areas listed below.</span></li> 69 <li><span class="item">The current directory.</span></li> 70 <li><span class="item">The directory named in the <i>HOME</i> environment symbol.</span></li> 71 <li><span class="item">For Windows environments only, the directory named in 72 the combination of the <i>HOMEDRIVE</i> and <i>HOMEPATH</i> environment symbols.</span></li> 73 <li><span class="item">The same directory in which the compiler resides.</span></li> 74 <li><span class="item">The directory defined by the <i>EtcPath</i> configuration item 75 in <i>Build's</i> configuration file.</span></li> 76 </span></ul> 77 </span></li> 78 79 <li><span class="item">** <b>ENH: </b> It is now possible to add environment specific items 80 to the build.cfg file. To do so, add the items to the appropriate item group... 81 <ul class="indent"> <pre class="cite"> [Windows] 82 # items that only apply when building in Windows. 83 84 [Posix] 85 # items that only apply when building in Posix (unix). 86 87 [DigitalMars] 88 # items that only apply when building with DigitalMars tools. 89 90 [GNU] 91 # items that only apply when building with GNU tools. 92 93 [Windows:DigitalMars] 94 # items that only apply when building with DigitalMars tools in Windows. 95 96 [Windows:GNU] 97 # items that only apply when building with GNU tools in Windows. 98 99 [Posix:DigitalMars] 100 # items that only apply when building with DigitalMars tools in Posix. 101 102 [Posix:GNU] 103 # items that only apply when building with GNU tools in Posix. 104 </pre> 105 </ul> 106 </span></li> 107 108 <li><span class="item">** <b>CHG: </b> When building the <i>Build</i> application itself, 109 you must now add <b>-version=BuildVerbose</b> to the command line if 110 you want an edition of <i>Build</i> that supports the <b>-V</b> (verbose) switch. As 111 shipped, the pre-built editions of <i>Build</i> do not support 112 the <b>-V</b> switch. 113 </span></li> 114 </span></ul> 115 14 116 <a name=""><h3 class="subsection">v2.10 -- 06/Apr/2006 </h3></a> 15 117 <ul><span class="list"> <li><span class="item">** <b>FIX: </b> The default Build Response File invoked when just … … 450 552 </span></ul> 451 553 452 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:342006453 </span></body>554 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 555 </span></body> 454 556 </html> trunk/Docs/command_line.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from command_line.d --> 7 11 … … 17 21 18 22 You can however specify the files and switches in any order you like. 19 23 <br/> <br/> 20 24 Normally you would only supply a single file name to <i>Build</i>, that being 21 25 the source file of the top-level file in the application. Typically 22 26 the one that has the 'main()' or 'WinMain()' function, though this is 23 27 not strictly necessary. 24 28 <br/> <br/> 29 The files supplied on the command line can be a mixture of source files, 30 macro files, object files, resource files, resource source files, libraries, 31 and any other type of file needed to build an application or library. 32 <br/> <br/> 25 33 If you run the utility without any files and without any switches, it 26 34 display a <i>help</i> screen with some details about the switches. That looks … … 66 74 <b>-si</b> Search the Import Path(s) for files specified on 67 75 the command line. 76 <b>-MDF<path></b> Overrides the default Macro Definition File 68 77 <b>-RDF<path></b> Overrides the default Rule Definition File 69 78 <b>-gui[:x.y]</b> Forces a GUI application to be created. The optional … … 82 91 the target name istaken from the first or only name 83 92 of the command line. 84 <b>-R <y|n></b> Indicates whether to use a response file or command line93 <b>-R=<Yes/No></b> Indicates whether to use a response file or command line 85 94 arguments with the compiler tools. 86 <b>-R y</b> will cause a response to be used.87 <b>-R n</b> will cause command line arguments to be used.95 <b>-R=Yes</b> will cause a response to be used. 96 <b>-R=No</b> will cause command line arguments to be used. 88 97 <b>-R</b> will reverse the current usage. 89 98 Note that the default for Windows <i>DigitalMars</i> is to use a response file … … 107 116 This will override any pragma() 108 117 statements in the source code. 118 <b>-UMB=<Yes/No></b> If <b>Yes</b> this forces the utility to expect 119 the object file to be created or residing in the current 120 directory. 109 121 <b>[...]</b> All other options, objectfiles and libraries are 110 122 passed to the compiler … … 115 127 116 128 117 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:342006118 </span></body>129 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 130 </span></body> 119 131 </html> trunk/Docs/configuration_file.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <body><h1></h1><!-- Generated by Ddoc from configuration_file.d --> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title>User Manual for BUILD</title> 9 </head> 10 <body><h1>User Manual for BUILD</h1><!-- Generated by Ddoc from configuration_file.d --> 7 11 8 12 … … 46 50 </pre> 47 51 52 <b>INIT:</b> <br> 53 This specifies an internal string value. The format is actually 54 <i>INIT:<b>stringname</b></i> where <i>stringname</i> identifies the specific 55 internal string to set. 56 <pre class="code"> INIT:MapSwitch = -M 57 </pre> 58 <ul class="indent"><p>The identifiers for the settable strings are detailed below.</p> 59 <div class="tabrow1">ExeExtention</div><div class="tabrow2">The file extention for executable files. <span class="eg">Example: "exe"</span></div> 60 <div class="tabrow1">LibExtention</div><div class="tabrow2">The file extention for library files.<span class="eg">Example: "lib"</span></div> 61 <div class="tabrow1">ObjExtention</div><div class="tabrow2">The file extention for object files.<span class="eg">Example: "obj"</span></div> 62 <div class="tabrow1">ShrLibExtention</div><div class="tabrow2">The file extention for shared libraries files.<span class="eg">Example: "dll"</span></div> 63 <div class="tabrow1">SrcExtention </div><div class="tabrow2">The file extention for D source files.<span class="eg">Example: "d"</span></div> 64 <div class="tabrow1">MacroExtention </div><div class="tabrow2"> The file extention for macro files.<span class="eg">Example: "mac"</span></div> 65 <div class="tabrow1">DdocExtention </div><div class="tabrow2">The file extention for D Documentation files.<span class="eg">Example: "ddoc"</span></div> 66 <div class="tabrow1">CompilerExe </div><div class="tabrow2">The file name of the compiler.<span class="eg">Example: "dmd.exe"</span></div> 67 <div class="tabrow1">CompileOnly </div><div class="tabrow2">The switch that is passed to the compiler to tell 68 it not to link, just compile the files instead.<span class="eg">Example: "-c"</span></div> 69 <div class="tabrow1">LinkerExe </div><div class="tabrow2">The file name of the linker.<span class="eg">Example: "link.exe"</span></div> 70 <div class="tabrow1">ConfigFile </div><div class="tabrow2">The name of the compiler's configuration file. <span class="eg">Example: "sc.ini"</span></div> 71 <div class="tabrow1">CompilerPath </div><div class="tabrow2">If the compiler is not in the standard search PATH, 72 this specifies the location of the compiler. <span class="eg">Example: "F:\dmd\bin"</span></div> 73 <div class="tabrow1">ConfigPath </div><div class="tabrow2">This will specify where to look for the compiler's 74 configuration file. It overrrides the default 75 places to look for it. <span class="eg">Example: "D:\configarea"</span></div> 76 <div class="tabrow1">LinkerPath </div><div class="tabrow2">If not overriden by any LINKCMD= 77 option found in the compiler's configuration file, 78 this specifies the location of the linker. 79 <span class="eg">Example: "F:\dm\bin"</span> 80 <br>If this empty and there is no LINKCMD= found, 81 the linker is assumed to be in the same place as the 82 compiler. 83 </div> 84 <div class="tabrow1">LinkerDefs </div><div class="tabrow2">The default set of switches for the linker. These are 85 applied to every link run. <span class="eg">Example: "/noi /map"</span></div> 86 <div class="tabrow1">LibPaths </div><div class="tabrow2">The default set of paths used by the linker to 87 scan for library files. <span class="eg">Example: "C:\mylibs;c:\dfl"</span></div> 88 <div class="tabrow1">ConfigSep </div><div class="tabrow2">The delimiter used to separate paths in the 89 <i>LibPaths</i> list. <span class="eg">Example: ";"</span></div> 90 <div class="tabrow1">Librarian </div><div class="tabrow2">The name of the librarian tool. <span class="eg">Example: "lib.exe "</span></div> 91 <div class="tabrow1">LibrarianOpts </div><div class="tabrow2">The default switches that are always passed to 92 the librarian tool. <span class="eg">Example: "-c -p256"</span></div> 93 <div class="tabrow1">VersionSwitch </div><div class="tabrow2">The switch that sets a <i>version</i> symbol for the 94 compiler. <span class="eg">Example: "-version"</span></div> 95 <div class="tabrow1">DebugSwitch </div><div class="tabrow2">The switch that sets a <i>debug</i> symbol for the 96 compiler. <span class="eg">Example: "-debug"</span></div> 97 <div class="tabrow1">CompilerDefs </div><div class="tabrow2">The default switches that are always passed to 98 the compiler. <span class="eg">Example: "-op"</span> 99 <br> Note that in the DigitalMars environment if 100 you don't specify any CompilerDefs, "-op" is 101 assumed.</div> 102 <div class="tabrow1">OutFileSwitch </div><div class="tabrow2">The switch tells <i>Build</i> 103 where to create the executable file. <span class="eg">Example: "-of"</span></div> 104 <div class="tabrow1">ImportPath </div><div class="tabrow2">This is the switch for the compiler to tell it where 105 to search for imported modules. <span class="eg">Example: "-I"</span></div> 106 <div class="tabrow1">LinkLibSwitch </div><div class="tabrow2">This is the switch for the linker to tell it 107 a library to use. <span class="eg">Example: "-l"</span></div> 108 <div class="tabrow1">LibPathSwitch </div><div class="tabrow2">This is the switch for the linker to tell it 109 where to search for the libraries. <span class="eg">Example: "-L"</span></div> 110 <div class="tabrow1">MapSwitch </div><div class="tabrow2">This is the switch for the linker to tell it 111 to create a map file. Note that the DigitalMars 112 linker does not have a switch for this function. 113 <span class="eg">Example: "-M"</span></div> 114 <div class="tabrow1">SymInfoSwitch </div><div class="tabrow2">This is the switch for the linker to tell it 115 to insert symbolic debugging information into 116 the executable.<span class="eg">Example: "/co"</span></div> 117 <div class="tabrow1">BuildImportPath</div><div class="tabrow2">This is the switch for <i>Build</i> to tell it 118 a path to scan for imported modules. <span class="eg">Example: "-I"</span></div> 119 <div class="tabrow1">ImportPathDelim</div><div class="tabrow2">This is the switch for <i>Build</i> to tell it 120 which character is used to delimit paths on 121 a BuildImportPath list. <span class="eg">Example: ";"</span></div> 122 <div class="tabrow1">OutputPath </div><div class="tabrow2">This is the switch for <i>Build</i> to tell it 123 the path to use for all temporary output files. <span class="eg">Example: "-od"</span></div> 124 <div class="tabrow1">RunSwitch </div><div class="tabrow2">This is the switch for <i>Build</i> to tell it 125 to run the application once it successfully 126 compiles. <span class="eg">Example: "-exec"</span></div> 127 <div class="tabrow1">LibrarianPath </div><div class="tabrow2">This is the default path where build will run 128 the librarian tool from. It will be overridden 129 by a 'LIBCMD=' in the configuration file or 130 on the commandline. <span class="eg">Example: "c:\tools\"</span></div> 131 <div class="tabrow1">ResponseExt </div><div class="tabrow2">This is the file extention that Build will use 132 for its response files. <span class="eg">Example: "brf"</span></div> 133 <div class="tabrow1">DefResponseFile</div><div class="tabrow2">This is the name of <i>Build's</i> default 134 response file. <span class="eg">Example: "build.brf"</span></div> 135 <div class="tabrow1">RDFName </div><div class="tabrow2">This is the name of <i>Build's</i> default 136 Rules Definition File. <span class="eg">Example: "default.rdf"</span></div> 137 <div class="tabrow1">DefMacroDefFile</div><div class="tabrow2">This is the name of <i>Build's</i> default 138 Macro Definition File. <span class="eg">Example: "build.mdf"</span></div> 139 <div class="tabrow1">LinkerStdOut </div><div class="tabrow2">This is the commandline option given to the linker 140 when the <i>Build</i> commandline has the <i>"-silent"</i> 141 switch. <span class="eg">Example: ">nul"</span></div> 142 <div class="tabrow1">IgnoredModules </div><div class="tabrow2">This is a comma delimited list of modules or packages 143 to ignore. <i>Build</i> will not scan these modules and 144 packages for dependancies. <span class="eg">Example: "std,dfl,dui"</span> 145 If none is specified by this configuration item then 146 'phobos' is assumed.</div> 147 <div class="tabrow1">AssumedLibs </div><div class="tabrow2">This is a comma delimited list of libraries that 148 are passed to the linker. <span class="eg">Example: "dfl,mt"</span> <br/> <br/> 149 If the application being compiled has a WinMain 150 function or is otherwise identified as a Windows 151 application then the following are automatically 152 passed to the linker. <br> 153 <ul><span class="list"> <li><span class="item">gdi32.lib</span></li> 154 <li><span class="item">advapi32.lib</span></li> 155 <li><span class="item">COMCTL32.LIB</span></li> 156 <li><span class="item">comdlg32.lib</span></li> 157 <li><span class="item">CTL3D32.LIB</span></li> 158 <li><span class="item">kernel32.lib</span></li> 159 <li><span class="item">ODBC32.LIB</span></li> 160 <li><span class="item">ole32.lib</span></li> 161 <li><span class="item">OLEAUT32.LIB</span></li> 162 <li><span class="item">shell32.lib</span></li> 163 <li><span class="item">user32.lib</span></li> 164 <li><span class="item">uuid.lib</span></li> 165 <li><span class="item">winmm.lib</span></li> 166 <li><span class="item">winspool.lib</span></li> 167 <li><span class="item">wsock32.lib</span></li> 168 </span></ul> 169 <br/> <br/> 170 If the application is being compiled in a Unix 171 environment then the following are automatically 172 passed to the linker. <br> 173 <ul><span class="list"> <li><span class="item">c</span></li> 174 <li><span class="item">phobos</span></li> 175 <li><span class="item">m</span></li> 176 </span></ul> 177 </div> 178 <div class="tabrow1">PathId </div><div class="tabrow2">The name of the environment symbol used by <i>Build</i> 179 when scanning for executables. <span class="eg">Example: "PATH"</span></div> 180 <div class="tabrow1">HomePathId </div><div class="tabrow2">The name of the environment symbol used by <i>Build</i> 181 when scanning for configuration file. <span class="eg">Example: "HOME"</span></div> 182 <div class="tabrow1">EtcPath </div><div class="tabrow2">The name of an alternative path used by <i>Build</i> 183 when scanning for configuration file. <span class="eg">Example: "c:\etc\"</span></div> 184 <div class="tabrow1">GenDebugInfo </div><div class="tabrow2">The switch that tells <i>Build</i> and the compiler 185 to insert debugging information into the object 186 files. <span class="eg">Example: "-g"</span></div> 187 <div class="tabrow1">ModOutPrefix </div><div class="tabrow2">If the <i>Build</i> switch <i><span class="quote">"-modules"</span></i> was 188 used, this defines the string which <i>Build</i> will 189 begin the Modules List output file with. 190 <span class="eg">Example: "MODULES = \n"</span></div> 191 <div class="tabrow1">ModOutSuffix </div><div class="tabrow2">If the <i>Build</i> switch <i><span class="quote">"-modules"</span></i> was 192 used, this defines the string which <i>Build</i> will 193 end the Modules List output file with. 194 <span class="eg">Example: ""</span></div> 195 <div class="tabrow1">ModOutBody </div><div class="tabrow2">If the <i>Build</i> switch <i><span class="quote">"-modules"</span></i> was 196 used, this defines the string which <i>Build</i> will 197 use as a template for each module being listed. 198 <span class="eg">Example: " $(MODULE {mod})"</span> <br/> <br/> 199 Note that {mod} will be replaced with the module's 200 name and {src} will be replaced with the source 201 file's name.</div> 202 <div class="tabrow1">ModOutDelim </div><div class="tabrow2">If the <i>Build</i> switch <i><span class="quote">"-modules"</span></i> was 203 used, this defines the string which <i>Build</i> will 204 insert in between each listed module. 205 <span class="eg">Example: "\n"</span></div> 206 <div class="tabrow1">ModOutFile </div><div class="tabrow2">If the <i>Build</i> switch <i><span class="quote">"-modules"</span></i> was 207 used, this defines the output file's suffix. This 208 is only used if the <i><span class="quote">"-modules"</span></i> switch 209 did not specify an exact file name to use. In which 210 case the Target name is used as a prefix and this 211 string as the suffix. 212 <span class="eg">Example: "_modules.ddoc "</span></div> 213 214 </ul> 215 216 <p><span class="example"><i>Example:</i> </span><pre class="code">INIT:MacroExtention = bmc 217 INIT:LinkerPath = /u2/qwerty/ 218 INIT:AssumedLibs = c,kde,mgui 219 </pre></p> 220 221 <b>Default Values for Configuration Items</b> 222 <table class="conftab"> <thead class="confthead"> <td class="confthcell"><i>INIT:</i> item</td><td class="confthcell">DigitalMars-Windows</td><td class="confthcell">GDC-Windows</td><td class="confthcell">DigitalMars-Unix</td><td class="confthcell">GDC-Unix</td> 223 </thead> 224 <tr class="confrow"><td class="confcell"><strong>ExeExtention</strong> </td><td class="confcell">exe </td><td class="confcell">exe </td><td class="confcell"> </td><td class="confcell"> </td></tr> 225 <tr class="confrow"><td class="confcell"><strong>LibExtention</strong> </td><td class="confcell">lib </td><td class="confcell">lib </td><td class="confcell">a </td><td class="confcell">a </td></tr> 226 <tr class="confrow"><td class="confcell"><strong>ObjExtention</strong> </td><td class="confcell">obj </td><td class="confcell">obj </td><td class="confcell">o </td><td class="confcell">o </td></tr> 227 <tr class="confrow"><td class="confcell"><strong>ShrLibExtention</strong> </td><td class="confcell">dll </td><td class="confcell">dll </td><td class="confcell">s </td><td class="confcell">s </td></tr> 228 <tr class="confrow"><td class="confcell"><strong>SrcExtention</strong> </td><td class="confcell">d </td><td class="confcell">d </td><td class="confcell">d </td><td class="confcell">d </td></tr> 229 <tr class="confrow"><td class="confcell"><strong>MacroExtention</strong> </td><td class="confcell">mac </td><td class="confcell">mac </td><td class="confcell">mac </td><td class="confcell">mac </td></tr> 230 <tr class="confrow"><td class="confcell"><strong>DdocExtention</strong> </td><td class="confcell">ddoc </td><td class="confcell">ddoc </td><td class="confcell">ddoc </td><td class="confcell">ddoc </td></tr> 231 <tr class="confrow"><td class="confcell"><strong>CompilerExe</strong> </td><td class="confcell">dmd.exe </td><td class="confcell">gdc.exe </td><td class="confcell">dmd </td><td class="confcell">gdc </td></tr> 232 <tr class="confrow"><td class="confcell"><strong>CompileOnly</strong> </td><td class="confcell">-c </td><td class="confcell">-c </td><td class="confcell">-c </td><td class="confcell">-c </td></tr> 233 <tr class="confrow"><td class="confcell"><strong>LinkerExe</strong> </td><td class="confcell">link.exe </td><td class="confcell">gdc.exe </td><td class="confcell">gcc </td><td class="confcell">gdmd </td></tr> 234 <tr class="confrow"><td class="confcell"><strong>ConfigFile</strong> </td><td class="confcell">sc.ini </td><td class="confcell"> </td><td class="confcell">dmd.conf </td><td class="confcell"> </td></tr> 235 <tr class="confrow"><td class="confcell"><strong>ConfigPath</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 236 <tr class="confrow"><td class="confcell"><strong>CompilerPath</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 237 <tr class="confrow"><td class="confcell"><strong>LinkerPath</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 238 <tr class="confrow"><td class="confcell"><strong>LinkerDefs</strong> </td><td class="confcell">/noi/map </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 239 <tr class="confrow"><td class="confcell"><strong>LibPaths</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 240 <tr class="confrow"><td class="confcell"><strong>ConfigSep</strong> </td><td class="confcell">; </td><td class="confcell">; </td><td class="confcell">: </td><td class="confcell">: </td></tr> 241 <tr class="confrow"><td class="confcell"><strong>Librarian</strong> </td><td class="confcell">lib.exe </td><td class="confcell">ar.exe </td><td class="confcell">ar </td><td class="confcell">ar </td></tr> 242 <tr class="confrow"><td class="confcell"><strong>LibrarianOpts</strong> </td><td class="confcell">-c -p256 </td><td class="confcell">-c </td><td class="confcell">-r </td><td class="confcell">-r </td></tr> 243 <tr class="confrow"><td class="confcell"><strong>VersionSwitch</strong> </td><td class="confcell">-version </td><td class="confcell">-fversion </td><td class="confcell">-version </td><td class="confcell">-fversion </td></tr> 244 <tr class="confrow"><td class="confcell"><strong>DebugSwitch</strong> </td><td class="confcell">-debug </td><td class="confcell">-fdebug </td><td class="confcell">-debug </td><td class="confcell">-fdebug </td></tr> 245 <tr class="confrow"><td class="confcell"><strong>OutFileSwitch</strong> </td><td class="confcell">-of </td><td class="confcell"><span class="quote">"-o "</span> </td><td class="confcell">-of </td><td class="confcell"><span class="quote">"-o "</span> </td></tr> 246 <tr class="confrow"><td class="confcell"><strong>ImportPath</strong> </td><td class="confcell">-I </td><td class="confcell"><span class="quote">"-I "</span> </td><td class="confcell">-I </td><td class="confcell"><span class="quote">"-I "</span> </td></tr> 247 <tr class="confrow"><td class="confcell"><strong>LinkLibSwitch</strong> </td><td class="confcell">-l </td><td class="confcell">-l </td><td class="confcell">-l </td><td class="confcell">-l-L </td></tr> 248 <tr class="confrow"><td class="confcell"><strong>LibPathSwitch</strong> </td><td class="confcell">-L </td><td class="confcell">-L </td><td class="confcell">-L </td><td class="confcell">-L </td></tr> 249 <tr class="confrow"><td class="confcell"><strong>MapSwitch</strong> </td><td class="confcell">-M </td><td class="confcell">-M </td><td class="confcell">-M </td><td class="confcell">-M </td></tr> 250 <tr class="confrow"><td class="confcell"><strong>SymInfoSwitch</strong> </td><td class="confcell">/co </td><td class="confcell">/co </td><td class="confcell">/co </td><td class="confcell">/co </td></tr> 251 <tr class="confrow"><td class="confcell"><strong>BuildImportPath</strong> </td><td class="confcell">-I </td><td class="confcell">-I </td><td class="confcell">-I </td><td class="confcell">-I </td></tr> 252 <tr class="confrow"><td class="confcell"><strong>ImportPathDelim</strong> </td><td class="confcell">; </td><td class="confcell">; </td><td class="confcell">; </td><td class="confcell">; </td></tr> 253 <tr class="confrow"><td class="confcell"><strong>OutputPath</strong> </td><td class="confcell">-od </td><td class="confcell">-od </td><td class="confcell">-od </td><td class="confcell">-od </td></tr> 254 <tr class="confrow"><td class="confcell"><strong>RunSwitch</strong> </td><td class="confcell">-exec </td><td class="confcell">-exec </td><td class="confcell">-exec </td><td class="confcell">-exec </td></tr> 255 <tr class="confrow"><td class="confcell"><strong>LibrarianPath</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 256 <tr class="confrow"><td class="confcell"><strong>ResponseExt</strong> </td><td class="confcell">brf </td><td class="confcell">brf </td><td class="confcell">brf </td><td class="confcell">brf </td></tr> 257 <tr class="confrow"><td class="confcell"><strong>DefResponseFile</strong> </td><td class="confcell">build.brf </td><td class="confcell">build.brf </td><td class="confcell">build.brf </td><td class="confcell">build.brf </td></tr> 258 <tr class="confrow"><td class="confcell"><strong>RDFName</strong> </td><td class="confcell">default.rdf </td><td class="confcell">default.rdf </td><td class="confcell">default.rdf </td><td class="confcell">default.rdf </td></tr> 259 <tr class="confrow"><td class="confcell"><strong>DefMacroDefFile</strong> </td><td class="confcell">build.mdf </td><td class="confcell">build.mdf </td><td class="confcell">build.mdf </td><td class="confcell">build.mdf </td></tr> 260 <tr class="confrow"><td class="confcell"><strong>LinkerStdOut</strong> </td><td class="confcell">>nul </td><td class="confcell">>nul </td><td class="confcell">>/dev/null </td><td class="confcell">>/dev/null </td></tr> 261 <tr class="confrow"><td class="confcell"><strong>IgnoredModules</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 262 <tr class="confrow"><td class="confcell"><strong>AssumedLibs</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 263 <tr class="confrow"><td class="confcell"><strong>PathId</strong> </td><td class="confcell">PATH </td><td class="confcell">PATH </td><td class="confcell">PATH </td><td class="confcell">PATH </td></tr> 264 <tr class="confrow"><td class="confcell"><strong>ModOutPrefix</strong> </td><td class="confcell"><span class="quote">"MODULES = \n"</span> </td><td class="confcell"><span class="quote">"MODULES = \n"</span> </td><td class="confcell"><span class="quote">"MODULES = \n"</span> </td><td class="confcell"><span class="quote">"MODULES = \n"</span> </td></tr> 265 <tr class="confrow"><td class="confcell"><strong>ModOutSuffix</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 266 <tr class="confrow"><td class="confcell"><strong>ModOutBody</strong> </td><td class="confcell"><span class="quote">" $(MODULE {mod})\n"</span> </td><td class="confcell"><span class="quote">" $(MODULE {mod})\n"</span> </td><td class="confcell"><span class="quote">" $(MODULE {mod})\n"</span> </td><td class="confcell"><span class="quote">" $(MODULE {mod})\n"</span> </td></tr> 267 <tr class="confrow"><td class="confcell"><strong>ModOutDelim</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell"> </td></tr> 268 <tr class="confrow"><td class="confcell"><strong>ModOutFile</strong> </td><td class="confcell">_modules.ddoc </td><td class="confcell">_modules.ddoc </td><td class="confcell">_modules.ddoc </td><td class="confcell">_modules.ddoc </td></tr> 269 <tr class="confrow"><td class="confcell"><strong>GenDebugInfo</strong> </td><td class="confcell">-g </td><td class="confcell">-g </td><td class="confcell">-g </td><td class="confcell">-g </td></tr> 270 <tr class="confrow"><td class="confcell"><strong>CompilerDefs</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell">-version=Posix </td><td class="confcell">-fversion=Posix </td></tr> 271 <tr class="confrow"><td class="confcell"><strong>HomePathId</strong> </td><td class="confcell">HOME </td><td class="confcell">HOME </td><td class="confcell">HOME </td><td class="confcell">HOME </td></tr> 272 <tr class="confrow"><td class="confcell"><strong>EtcPath</strong> </td><td class="confcell"> </td><td class="confcell"> </td><td class="confcell">/etc/ </td><td class="confcell">/etc/ </td></tr> 273 </table> 274 48 275 <b>Environment Symbol Substitution</b> <br> 49 276 Before each configuration file option line is processed, it is first checked … … 51 278 the value of that symbol. References take the form <b>%<SYMNAME>%</b> 52 279 <br> 53 There are two special symbols: <b>@D</b> is replaced by the compiler's 54 path, and <b>@P</b> is replaced by the compiler's configuration file's path. 280 There are three special symbols: <b>@D</b> is replaced by the compiler's 281 path, <b>@P</b> is replaced by the compiler's configuration file's path, 282 and <b>%%</b> is replaced by a single <b>%</b> character and can be used 283 to avoid an unwanted environment symbol substitution. 55 284 56 285 <p><span class="example"><i>Example:</i> Assuming you had set BUILDOPTS=-w -g</span><pre class="code">CMDLINE=%BUILDOPTS% # Allow switches to be passed via enviroment symbol. … … 82 311 the command line. To apply the 'debug' group in the above example, you 83 312 place on the command line <b>+dbg</b> 313 <br/> <br/> 314 There are few optional predefined group names that are used when building 315 for specific environments. 316 <ul class="indent"> <pre class="cite"> [Windows] 317 # items that only apply when building in Windows. 318 319 [Posix] 320 # items that only apply when building in Posix (unix). 321 322 [DigitalMars] 323 # items that only apply when building with DigitalMars tools. 324 325 [GNU] 326 # items that only apply when building with GNU tools. 327 328 [Windows:DigitalMars] 329 # items that only apply when building with DigitalMars tools in Windows. 330 331 [Windows:GNU] 332 # items that only apply when building with GNU tools in Windows. 333 334 [Posix:DigitalMars] 335 # items that only apply when building with DigitalMars tools in Posix. 336 337 [Posix:GNU] 338 # items that only apply when building with GNU tools in Posix. 339 </pre> 340 </ul> 341 These groups are automatically used when building in the appropriate 342 enviroments and do not explicitly have to be mentioned on the command line. 84 343 <br/> <br/> 85 344 <b>Comments</b> <br> … … 112 371 113 372 114 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:342006115 </span></body>373 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 374 </span></body> 116 375 </html> trunk/Docs/dlls.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from dlls.d --> 7 11 … … 32 36 33 37 34 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:34200635 </span></body>38 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 39 </span></body> 36 40 </html> trunk/Docs/introduction.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from introduction.d --> 7 11 … … 11 15 <a name="introduction"><h1 class="topic">Topic: Introduction</h1></a> 12 16 <p>This is a utility to build an application using the D programming language. 13 It does this by examining the source file supplied on the command line 14 to work out its dependant files, and then determines which need to be 15 compiled and which need to be linked to create the executable. 17 It does this by examining the files supplied on the command line 18 to work out what are the dependant files, and then determines which 19 source files need to be compiled, which macro files need to be transformed, 20 which resource files need to be generated, and which object files and 21 libraries need to be linked to create the executable. 16 22 17 23 Alternatively, it can be used to create a Library file rather than an … … 22 28 </p> 23 29 24 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:34200625 </span></body>30 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 31 </span></body> 26 32 </html> trunk/Docs/pragmas.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from pragmas.d --> 7 11 … … 199 203 </p> 200 204 201 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:342006202 </span></body>205 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 206 </span></body> 203 207 </html> trunk/Docs/response_file.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from response_file.d --> 7 11 … … 46 50 47 51 48 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:34200649 </span></body>52 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 53 </span></body> 50 54 </html> trunk/Docs/rules.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from rules.d --> 7 11 … … 16 20 output file. 17 21 18 The default Rule Definition File is called <span class="quote"> "default.rdf"</span>. It is found by22 The default Rule Definition File is called <span class="quote">"default.rdf"</span>. It is found by 19 23 first looking in the directory where the utility is installed, and if 20 24 it is not found there, the directories in the PATH environment symbol … … 58 62 59 63 60 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:34200661 </span></body>64 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 65 </span></body> 62 66 </html> trunk/Docs/style.css
r41 r44 209 209 font-size: smaller; 210 210 } 211 212 div.tabrow1 213 { 214 font-size: larger; 215 font-weight: bold; 216 background: #FFFFF0; 217 color: blue; 218 padding: 3px; 219 margin-right: 5%; 220 border: 1px solid; 221 } 222 223 div.tabrow2 224 { 225 font-size: normal; 226 background: #AAFFFF; 227 color: black; 228 padding-left: 2px; 229 padding-bottom: 2px; 230 margin-left: 5%; 231 margin-right: 5%; 232 border-left: 1px solid; 233 border-right: 1px solid; 234 border-bottom: 1px solid; 235 } 236 237 span.eg 238 { 239 color: gray; 240 padding-left: 10px; 241 padding-bottom: 2px; 242 font-style: italic; 243 font-size: smaller; 244 font-family: serif; 245 } 246 247 thead.confthead 248 { 249 font-weight: bold; 250 text-align: center; 251 font-family: sans-serif; 252 background: #80FFFF; 253 } 254 255 td.confcell 256 { 257 font-family: monospace; 258 padding-left: 0.5em; 259 } 260 261 td.confthcell 262 { 263 color: navy; 264 } 265 266 thead.macrothead 267 { 268 font-weight: bold; 269 text-align: center; 270 font-family: sans-serif; 271 background: #80FFFF; 272 } 273 274 td.macrothcell 275 { 276 color: navy; 277 } 278 trunk/Docs/switches.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from switches.d --> 7 11 … … 187 191 default is to use command line arguments. 188 192 <br/> <br/> 189 This switch has three formats: <br >193 This switch has three formats: <br/> <br/> 190 194 <ul><span class="list"> <li><span class="item">-Ry to use a response file </span></li> 191 195 <li><span class="item">-Rn to use command line arguments </span></li> … … 246 250 247 251 <a name="switch_RDF"><h2 class="section">switch: -RDF<file><span class="secdef"> 248 Defines a file to override the default <a href="rules ">Rule Definition File</a>.</span></h2></a>252 Defines a file to override the default <a href="rules.html">Rule Definition File</a>.</span></h2></a> 249 253 <ul class="indent">The default file is called <b>default.rdf</b>. But if you need to provide 250 254 an alternate file, you can use this switch. 251 255 252 256 <p><span class="example"><i>Example:</i> </span><pre class="code">-RDFmyrules.xyz 257 </pre></p> 258 </ul> 259 260 <a name="switch_MDF"><h2 class="section">switch: -MDF<file><span class="secdef"> 261 Defines a file to override the default <a href="macros.html">Macro Definition File</a>.</span></h2></a> 262 <ul class="indent">The default file is called <b>build.mdf</b>. But if you need to provide 263 an alternate file, you can use this switch. 264 265 <p><span class="example"><i>Example:</i> </span><pre class="code">-MDFmymacros.xyz 253 266 </pre></p> 254 267 </ul> … … 358 371 359 372 360 <br /><hr/><span class="footnote">Generated by Ddoc, Thu Apr 6 13:09:34 2006 361 </span></body> 373 <a name="switch_UMB"><h2 class="section">switch: -UBM=<Yes/No><span class="secdef"> 374 Determines where the linker expects the object files.</span></h2></a> 375 <ul class="indent">For <b>DMD</b> environments, <i>Build</i> expects that object files will be created 376 in the same directory as the source file, or in the directory 377 specified in any <a href="#switch_od">-od</a> switch. However, this switch 378 can tell <i>Build</i> to expect them in the current directory. 379 <br/> <br/> 380 For <b>GDC</b> environments, <i>Build</i> expects that object files will be created 381 in the current directory. However this switch can tell <i>Build</i> to expect 382 then to be in same directory as the source file, or in the directory 383 specified in any <a href="#switch_od">-od</a> switch. 384 <br/> <br/> 385 The forms <b>-UMB, -UMB=Yes, -UMB:Yes, -UMB=Y, -UMB:Y, -UMB=, -UMB:</b> all 386 mean the same; that the object files are expected in the current directory. 387 Any other form of the switch (eg. <b>-UMB=No</b> ) will make the utility 388 expect the object files to be in the same directory as the source files. 389 <br/> <br/> 390 Unless you have some special need to do this, the -UMB switch is not 391 really required. 392 <br/> <br/> 393 <p><span class="example"><i>Example:</i> </span><pre class="code">build editor -UMB=Yes 394 </pre></p> 395 In the example above, the utility will expect object files to be created 396 in the current directory. 397 398 </ul> 399 400 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 401 </span></body> 362 402 </html> trunk/Docs/todo.html
r41 r44 1 <html> 1 <?xml version="1.0" encoding="utf-8"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html> 2 4 <head> 3 5 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 4 <link rel="stylesheet" type="text/css" href="style.css"> 5 <title></title></head> 6 <link rel="stylesheet" type="text/css" href="style.css" title="standard"> 7 <link rel="alternate stylesheet" type="text/css" href="none.css" title="none"> 8 <title></title> 9 </head> 6 10 <body><h1></h1><!-- Generated by Ddoc from todo.d --> 7 11 … … 35 39 36 40 37 <br /><hr/><span class="footnote">Generated by Ddoc, T hu Apr 6 13:09:34200638 </span></body>41 <br /><hr/><span class="footnote">Generated by Ddoc, Tue Jun 6 10:31:40 2006 42 </span></body> 39 43 </html> trunk/Source/build.d
r41 r44 6 6 Authors: Derek Parnell, Melbourne 7 7 Initial Creation: January 2005 8 Version: 2.108 Version: 3.00 9 9 Date: August 2005 10 10 License: … … 34 34 version(linux) version = Posix; 35 35 version(darwin) version = Posix; 36 version(DigitalMars) version(Windows) version = UseResponseFile; 36 37 37 38 version(build) … … 39 40 version(Windows) { 40 41 // OptLink Definition File 41 pragma (build_def, "VERSION 2.10");42 pragma (build_def, "VERSION 3.00"); 42 43 } 43 44 } … … 56 57 57 58 import std.c.stdio; 59 58 60 import std.file; 59 61 import std.outbuffer; … … 63 65 import std.string; 64 66 65 version(Windows) { 67 version(Windows) 68 { 66 69 import std.c.windows.windows; 67 70 } 68 else version(linux) { 71 72 version(linux) 73 { 69 74 import std.c.linux.linux; 70 75 } 71 else version(darwin) { 76 77 version(darwin) 78 { 72 79 import std.c.darwin.darwin; 73 80 } … … 76 83 extern (C) 77 84 { 78 char* getenv (char *);79 int putenv (char *);80 85 int system (char *); 81 86 } 82 87 88 class BuildException : Error 89 { 90 this(char[] pMsg) 91 { 92 super (vAppName ~ ":" ~ pMsg); 93 } 94 } 83 95 84 96 // --------- enums ---------------- 85 97 enum LibOpt {Implicit, Build, DontBuild} 86 98 87 // --------- constants ---------------- 88 const { 89 version(Windows) { 90 char[] kExeExtention=`exe`; 91 char[] kLibExtention=`lib`; 92 char[] kObjExtention=`obj`; 93 char[] kShrLibExtention=`dll`; 94 } 95 96 version(Posix) { 97 char[] kExeExtention=``; 98 char[] kLibExtention=`a`; 99 char[] kObjExtention=`o`; 100 char[] kShrLibExtention=`s`; 101 } 102 char[] kSrcExtention=`d`; 103 char[] kMacroExtention=`mac`; 104 char[] kDdocExtention=`ddoc`; 105 106 } 99 // --------- internal strings ---------------- 100 version(Windows) { 101 char[] vExeExtention=`exe`; 102 char[] vLibExtention=`lib`; 103 char[] vObjExtention=`obj`; 104 char[] vShrLibExtention=`dll`; 105 char[] vLinkerStdOut = ">nul"; 106 } 107 108 version(Posix) { 109 char[] vExeExtention=``; 110 char[] vLibExtention=`a`; 111 char[] vObjExtention=`o`; 112 char[] vShrLibExtention=`s`; 113 char[] vLinkerStdOut = ">/dev/null"; 114 } 115 char[] vSrcExtention=`d`; 116 char[] vMacroExtention=`mac`; 117 char[] vDdocExtention=`ddoc`; 107 118 108 119 // ---------- Module scoped globals ----------- … … 110 121 version(Windows) { 111 122 char[] vCompilerExe=`dmd.exe`; 112 char[] vCompileOnly Switch = `-c`;123 char[] vCompileOnly = `-c`; 113 124 char[] vLinkerExe=`link.exe`; 114 125 char[] vConfigFile=`sc.ini`; 115 126 char[] vCompilerPath=``; 116 127 char[] vLinkerPath=``; 117 char[] vLinkerDef Switches=`/noi/map`;128 char[] vLinkerDefs=`/noi/map`; 118 129 char[] vConfigPath=``; 119 130 char[] vLibPaths = ``; 120 131 char[] vConfigSep = ";"; 121 char[] vLibrarian = `lib `;132 char[] vLibrarian = `lib.exe`; 122 133 char[] vLibrarianOpts = `-c -p256`; 134 char[] vHomePathId = "HOME"; 135 char[] vEtcPath = ""; 123 136 } 124 137 125 138 version(Posix) { 126 139 char[] vCompilerExe=`dmd`; 127 char[] vCompileOnly Switch= `-c`;128 char[] vLinkerExe=` ld`;140 char[] vCompileOnly= `-c`; 141 char[] vLinkerExe=`gcc`; 129 142 char[] vConfigFile=`dmd.conf`; 130 143 char[] vCompilerPath=``; 131 144 char[] vLinkerPath=``; 132 char[] vLinkerDef Switches=`/noi/map`;145 char[] vLinkerDefs=``; 133 146 char[] vConfigPath=`/etc/`; 134 147 char[] vLibPaths = ``; … … 136 149 char[] vLibrarian = `ar`; 137 150 char[] vLibrarianOpts = `-r`; 138 } 139 140 char[] vVersionSwitch = "-version="; 151 char[] vHomePathId = "HOME"; 152 char[] vEtcPath = "/etc/"; 153 } 154 155 char[] vVersionSwitch = "-version"; 141 156 char[] vDebugSwitch = "-debug"; 142 char[] vKeepPathSwitch = "-op";157 char[][] vCompilerDefs; 143 158 char[] vOutFileSwitch = "-of"; 144 char[] vImportPathSwitch = "-I"; 145 char[] vNoLinkSwitch = "-c"; 159 char[] vImportPath = "-I"; 160 bool vUseModBaseName = false; 161 char[] vLinkLibSwitch = "-l"; 162 char[] vSymInfoSwitch = "/co"; 146 163 } 147 164 … … 149 166 version(Windows) { 150 167 char[] vCompilerExe=`gdc.exe`; 151 char[] vCompileOnly Switch= `-c`;168 char[] vCompileOnly= `-c`; 152 169 char[] vLinkerExe=`gdc.exe`; 153 170 char[] vConfigFile=null; 154 171 char[] vCompilerPath=``; 155 172 char[] vLinkerPath=``; 156 char[] vLinkerDef Switches=``;173 char[] vLinkerDefs=``; 157 174 char[] vConfigPath=null; 158 175 char[] vLibPaths = ``; 159 176 char[] vConfigSep = ";"; 160 char[] vLibrarian = ` lib`;177 char[] vLibrarian = `ar.exe`; 161 178 char[] vLibrarianOpts = `-c`; 179 char[] vLinkLibSwitch = "-l"; 180 char[] vHomePathId = "HOME"; 181 char[] vEtcPath = ""; 162 182 } 163 183 164 184 version(Posix) { 165 185 char[] vCompilerExe=`gdc`; 166 char[] vCompileOnly Switch= `-c`;167 char[] vLinkerExe=` ld`;186 char[] vCompileOnly= `-c`; 187 char[] vLinkerExe=`gdmd`; 168 188 char[] vConfigFile=null; 169 char[] vCompilerPath=` /opt/gdc/bin`;189 char[] vCompilerPath=``; 170 190 char[] vLinkerPath=``; 171 char[] vLinkerDef Switches=``;191 char[] vLinkerDefs=``; 172 192 char[] vConfigPath=null; 173 193 char[] vLibPaths = ``; … … 175 195 char[] vLibrarian = `ar`; 176 196 char[] vLibrarianOpts = `-r`; 177 } 178 char[] vVersionSwitch = "-fversion="; 197 char[] vLinkLibSwitch = "-l-L"; 198 char[] vHomePathId = "HOME"; 199 char[] vEtcPath = "/etc/"; 200 } 201 char[] vVersionSwitch = "-fversion"; 179 202 char[] vDebugSwitch = "-fdebug"; 180 203 char[] vOutFileSwitch = "-o "; 181 char[] vKeepPathSwitch = ""; 182 char[] vImportPathSwitch = "-I "; 183 char[] vNoLinkSwitch = "-c"; 184 } 185 186 char[] vBuildImportPathSwitch = "-I"; 187 char[] vTemporaryPathSwitch = "-od"; 204 char[][] vCompilerDefs; 205 char[] vImportPath = "-I "; 206 char[] vSymInfoSwitch = "/co"; 207 /* GDC places object files in the directory from which it is called */ 208 bool vUseModBaseName = true; 209 } 210 211 char[] vOverrideConfigPath = ""; 212 char[] vBuildImportPath = "-I"; 213 char[] vImportPathDelim = ";"; 214 char[] vOutputPath = "-od"; 188 215 char[] vRunSwitch = "-exec"; 189 216 char[] vLibrarianPath = ""; 190 217 char[]* vDelayedValue = null; 191 218 char[] vTemporaryPath = ""; 219 char[] vLibPathSwitch = "-L"; 220 char[] vMapSwitch = "-M"; 221 char[] vGenDebugInfo = "-g"; 222 char[] vResponseExt = "brf"; 223 char[] vDefResponseFile = "build.brf"; 224 char[] vDefMacroDefFile = "build.mdf"; 225 char[] vUtilsConfigFile = "build.cfg"; 226 char[] vRDFName = "default.rdf"; 227 char[] vPathId = "PATH"; // Used to locate the environment symbol 228 229 char[] vModOutPrefix = "MODULES = \n"; 230 char[] vModOutSuffix = ""; 231 char[] vModOutBody = " $(MODULE {mod})\n"; 232 char[] vModOutDelim = ""; 233 char[] vModOutFile = "_modules.ddoc"; 192 234 193 235 Bool vTestRun; … … 196 238 Bool vForceCompile; 197 239 Bool vSilent; 240 Bool vSymbols; 198 241 Bool vCleanup; 199 Bool vVerbose;242 version(BuildVerbose) Bool vVerbose; 200 243 Bool vMacroInput; 201 244 Bool vNames; … … 206 249 Bool vUseResponseFile; 207 250 Bool vConsoleApp; 251 252 char[] vSymbolOutName; 208 253 char[] vRunParms; 209 254 char[] vTargetExe; … … 213 258 char[][] vBuildDef; 214 259 char[][] vDefaultLibs; 215 char[][] vDefaultCompArgs;216 260 LibOpt vLibraryAction = LibOpt.Implicit; 217 261 char[] vAppPath; 218 262 char[] vAppName; 219 char[] vAppVersion = " 2.10";263 char[] vAppVersion = "3.00"; 220 264 char[] vTargetName; // Output name from first file name. 221 265 char[] vPragmaTargetName; // Output name from pragma. … … 227 271 char[][] vCompilerArgs; // Arguments passed to compiler 228 272 char[][] vSourceScanList; // The list of places to find source files. 229 char[] vRDFName = "default.rdf";230 bool[char[]] vNestedDelim;231 273 struct ExternRef 232 274 { … … 236 278 ExternRef[] vExternals; 237 279 238 Substitute[] vSubstitutions;239 240 241 const static char[] kPathId = "PATH"; // Used to locate the environment symbol242 280 243 281 version(Windows) … … 254 292 //------------------------------------------------------- 255 293 { 256 source.ActivateVersion("build"); //todo 257 258 vDefaultCompArgs ~= vKeepPathSwitch; // Keep object files in same folder as source. 259 vModulesToIgnore ~= "phobos"; // Assume phobos will be ignored. 294 // Force the 'build' version to be active. 295 source.ActivateVersion("build"); 296 260 297 vSourceScanList ~= "." ~ std.path.sep; 261 298 vNoLink = False; … … 265 302 vSilent = False; 266 303 vCleanup = False; 267 v Verbose = False;304 version(BuildVerbose) vVerbose = False; 268 305 vMacroInput = True; 269 306 vNames = False; … … 273 310 vExecuteProgram = False; 274 311 vUseResponseFile = False; 312 vSymbols = False; 275 313 vConsoleApp = True; 276 314 277 version(Posix){ 278 vDefaultCompArgs ~= vVersionSwitch ~ "Posix"; // Until such time as this is standard in dmd. 315 version(Posix) 316 { 317 vCompilerDefs ~= vVersionSwitch ~ "=Posix"; // Until such time as this is standard in dmd. 279 318 } 280 319 … … 284 323 } 285 324 286 version(DigitalMars) { 287 version(Windows) { 288 vUseResponseFile = True; 289 } 290 else 291 { 292 vUseResponseFile = False; 293 } 294 } else 295 { 296 vUseResponseFile = False; 297 } 298 299 vNestedDelim["("] = true; 300 vNestedDelim["<"] = true; 301 vNestedDelim["{"] = true; 302 vNestedDelim["["] = true; 303 } 304 305 static ~this() 306 { 307 // Clean up any resources held by the source files. 308 Source.Finalize(); 325 vUseResponseFile = False; 326 version(UseResponseFile) vUseResponseFile = True; 327 328 util.str.SetEnv("@P", std.path.getDirName(vConfigPath)); 329 util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 330 331 Source.UseModBaseName(vUseModBaseName); 309 332 } 310 333 … … 370 393 writefln(" -LIBPATH=<pathlist> Used to add a semi-colon delimited list"); 371 394 writefln(" of search paths for library files."); 395 writefln(" -MDF<path> Overrides the default Macro Definition File"); 372 396 writefln(" -test Does everything as normal except it displays the commands"); 373 397 writefln(" instead of running them."); 374 398 writefln(" -RDF<path> Overrides the default Rule Definition File"); 375 writefln(" -R <y|n>Indicates whether to use a response file or command line");399 writefln(" -R=<Yes|No> Indicates whether to use a response file or command line"); 376 400 writefln(" arguments with the compiler tools."); 377 writefln(" -R ywill cause a response to be used.");378 writefln(" -R nwill cause command line arguments to be used.");401 writefln(" -R=Yes will cause a response to be used."); 402 writefln(" -R=No will cause command line arguments to be used."); 379 403 writefln(" -R will reverse the current usage."); 380 404 writefln(" -PP<path> Add a path to the Source Search List"); 381 405 382 version(DigitalMars) { 383 version(Windows) { 384 writefln(" ** The default is to use a response file"); } 385 else { 386 writefln(" ** The default is to use command line arguments"); } 387 } 388 else { 389 writefln(" ** The default is to use command line arguments"); } 406 version(UseResponseFile) 407 writefln(" ** The default is to use a response file"); 408 else 409 writefln(" ** The default is to use command line arguments"); 390 410 391 411 writefln(" -exec<param> If the link is successful, this will cause the"); … … 410 430 writefln(" -info Displays the version and path of the Build application."); 411 431 writefln(" -nodef Prevents a Module Definition File from being created."); 432 writefln(" -UMB=<Yes/No> If 'Yes' this forces the utility to expect"); 433 writefln(" the object file to be created or residing in the current"); 434 writefln(" directory."); 412 435 writefln(" [...] All other options, objectfiles and libraries are"); 413 436 writefln(" passed to the compiler"); … … 425 448 426 449 //------------------------------------------------------- 450 int RunCommand(char[] pExeName, char[] pCommand) 451 //------------------------------------------------------- 452 { 453 if (util.fileex.FileExists(pExeName) == false) 454 { 455 throw new BuildException(std.string.format("Cannot find application '%s' to run", pExeName)); 456 } 457 return RunCommand(pExeName ~ " " ~ pCommand); 458 } 459 460 //------------------------------------------------------- 427 461 int RunCommand(char[] pCommand) 428 462 //------------------------------------------------------- … … 439 473 440 474 441 if(vVerbose == True) { 442 writefln("Running '%s'",pCommand); 475 version(BuildVerbose) 476 { 477 if(vVerbose == True) 478 writefln("Running '%s'",pCommand); 443 479 } 444 480 … … 447 483 version(Windows) lTrueRC = lRC; 448 484 449 if(vVerbose == True) { 450 if (lTrueRC == 0){ 451 writefln("Successful"); 452 } else { 453 writefln("Failed. Return code: %04x",lRC); 485 version(BuildVerbose) 486 { 487 if(vVerbose == True) { 488 if (lTrueRC == 0){ 489 writefln("Successful"); 490 } else { 491 writefln("Failed. Return code: %04x",lRC); 492 } 454 493 } 455 494 } 456 495 return lTrueRC; 457 496 } 458 }459 460 //-------------------------------------------------------461 char[] GetEnv(char[] pSymbol)462 //-------------------------------------------------------463 {464 return std.string.toString(getenv(pSymbol));465 497 } 466 498 … … 474 506 FileDateTime lModsTime = new FileDateTime(); 475 507 476 foreach(int i, char[] lFileName; Source.ScanOrder)508 foreach(int i, Source lSource; Source) 477 509 { 478 510 // Get the next Source object to examine. 479 lSource = Source.SourceIndex[lFileName];480 511 if (lSource.Ignore) 481 512 continue; … … 484 515 lSource.search(); 485 516 486 if(vVerbose == True) { 487 writefln("source file[%d] %s", i, 488 util.pathex.AbbreviateFileName(lFileName)); 489 } 490 else if(vNames == True) { 491 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 517 version(BuildVerbose) 518 { 519 if(vVerbose == True) { 520 writefln("source file[%d] %s", i, 521 util.pathex.AbbreviateFileName(lSource.FileName)); 522 } 523 else if(vNames == True) { 524 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lSource.FileName)); 525 } 526 } else { 527 if(vNames == True) { 528 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lSource.FileName)); 529 } 492 530 } 493 531 494 532 if (lSource.DependantsTime > lModsTime) 495 533 { 496 if(vVerbose == True) { 497 writefln("Newer time: from %s to %s", 498 lModsTime.toString(), 499 lSource.DependantsTime.toString() 500 ); 534 version(BuildVerbose) 535 { 536 if(vVerbose == True) 537 writefln("Newer time: from %s to %s", 538 lModsTime.toString(), 539 lSource.DependantsTime.toString() 540 ); 501 541 } 502 542 … … 510 550 FileDateTime lLinkTime = GetFileTime(lFileName); 511 551 512 if(vVerbose == True) { 513 writefln("link file[%d] %s %s", i, 514 util.pathex.AbbreviateFileName(lFileName), lLinkTime.toString()); 515 } 516 else if(vNames == True) { 517 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 518 } 519 552 version(BuildVerbose) 553 { 554 if(vVerbose == True) { 555 writefln("link file[%d] %s %s", i, 556 util.pathex.AbbreviateFileName(lFileName), lLinkTime.toString()); 557 } 558 else if(vNames == True) { 559 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 560 } 561 } else { 562 if(vNames == True) { 563 writefln(" [ %s ]", util.pathex.AbbreviateFileName(lFileName)); 564 } 565 } 520 566 if (lLinkTime > lModsTime) 521 567 { 522 if(vVerbose == True) { 523 writefln("Newer time: from %s to %s", 524 lModsTime.toString(), 525 lLinkTime.toString() 526 ); 568 version(BuildVerbose) 569 { 570 if(vVerbose == True) 571 writefln("Newer time: from %s to %s", 572 lModsTime.toString(), 573 lLinkTime.toString() 574 ); 527 575 } 528 576 … … 554 602 555 603 lRuleDefnFile = util.pathex.LocateFile(vRDFName, 556 getDirName(vAppPath) ~ std.path.pathsep ~ GetEnv(kPathId)); 557 if (vVerbose == True) 558 writefln("Rule Definitions from %s", lRuleDefnFile); 604 getDirName(vAppPath) ~ std.path.pathsep ~ util.str.GetEnv(vPathId)); 605 version(BuildVerbose) 606 { 607 if (vVerbose == True) 608 writefln("Rule Definitions from %s", lRuleDefnFile); 609 } 610 559 611 GetTextLines( lRuleDefnFile, lRuleText ); 560 612 foreach(char[] lLine; lRuleText) … … 577 629 } 578 630 579 if (vVerbose == True)631 version(BuildVerbose) if (vVerbose == True) 580 632 { 581 633 foreach(Rule r; lRules) … … 626 678 lInFile = util.pathex.LocateFile(lInFile, vImportRoots); 627 679 if (! util.fileex.FileExists( lInFile ) ) 628 throw new Exception(680 throw new BuildException( 629 681 std.string.format("External file '%s' not found", lInFile)); 630 682 … … 685 737 char[] lDefName; 686 738 char[] lOutText; 687 char[] lCompilerOpts;739 char[] lCompilerOpts; 688 740 char[] lSourcesToCompile; 689 741 char[] lCommand; … … 699 751 foreach( char[] lFile; vCmdLineSourceFiles) 700 752 { 701 new Source(GetFullPathname(lFile, vSourceScanList)); 753 lFile = GetFullPathname(lFile, vSourceScanList); 754 if (std.path.getExt(lFile) == vMacroExtention) 755 { 756 version(BuildVerbose) 757 { 758 if (vVerbose == True) 759 writefln("Macro file '%s' being processed.", lFile); 760 } 761 762 char[] lAltFile = std.path.addExt( lFile, vSrcExtention); // Make it a D source file. 763 if (util.macro.ConvertFile(lFile, "build", lAltFile)) 764 lFile = lAltFile; 765 else 766 { 767 version(BuildVerbose) 768 { 769 if ((vSilent != True) || (vVerbose == True)) 770 writefln("Macro file '%s' failed to generate output", lFile); 771 } else { 772 if (vSilent != True) 773 writefln("Macro file '%s' failed to generate output", lFile); 774 } 775 lFile.length = 0; 776 } 777 } 778 779 if (lFile.length > 0) 780 { 781 new Source(lFile); 782 } 702 783 } 703 784 … … 727 808 // default target name. 728 809 if (vPragmaTargetName.length != 0) 810 { 729 811 vTargetName = vPragmaTargetName; 812 version(BuildVerbose) 813 { 814 if(vVerbose == True) 815 writefln("Pragma target override is '%s'", std.path.getName(vTargetName)); 816 } 817 818 } 730 819 731 820 // If a target name was supplied on the command line, use that … … 733 822 if (vCommandTargetName.length != 0) 734 823 { 735 char[] lBaseName; 736 737 lBaseName = vTargetName.dup; 738 for(int i = lBaseName.length-1; i >= 0; i--) 739 { 740 if (lBaseName[i] == '.') 741 { 742 lBaseName.length = i; 743 break; 744 } 745 } 746 vTargetName = Expand(vCommandTargetName, "Target=" ~ lBaseName); 824 vTargetName = util.str.Expand(vCommandTargetName, "Target=" ~ 825 util.pathex.GetBaseName(vTargetName)); 826 version(BuildVerbose) 827 { 828 if(vVerbose == True) 829 writefln("Cmdline target override is '%s'", vTargetName); 830 } 747 831 } 748 832 … … 753 837 if (vLibraryAction == LibOpt.Build) 754 838 // Target is a library. 755 lTargetName = ReplaceExtention(vTargetName, kLibExtention);839 lTargetName = ReplaceExtention(vTargetName, vLibExtention); 756 840 757 841 else if (vNoLink == False) 758 {842 { 759 843 if (Source.WasMainFound) 760 844 if (Source.WasMainDLL) 761 845 // Target is a shared library. 762 lTargetName = ReplaceExtention(vTargetName, kShrLibExtention);846 lTargetName = ReplaceExtention(vTargetName, vShrLibExtention); 763 847 else 764 848 { 765 849 // Target is an executable 766 lTargetName = ReplaceExtention(vTargetName, kExeExtention);850 lTargetName = ReplaceExtention(vTargetName, vExeExtention); 767 851 vTargetExe = lTargetName; 768 852 } … … 772 856 // so assume they know what they are doing and also assume an 773 857 // executable is required. 774 lTargetName = ReplaceExtention(vTargetName, kExeExtention);858 lTargetName = ReplaceExtention(vTargetName, vExeExtention); 775 859 vTargetExe = lTargetName; 776 860 } 777 }861 } 778 862 else 779 863 // Not linking and not archiving, so no target is required. … … 787 871 788 872 // Show user if required to. 789 if((vVerbose == True) || (vNames == True) ) { 790 writefln("\nBuilding target '%s'", lTargetName); 873 version(BuildVerbose) 874 { 875 if((vVerbose == True) || (vNames == True) ) 876 writefln("\nBuilding target '%s'", lTargetName); 791 877 } 792 878 … … 799 885 // rebuild the target. 800 886 lTargetTime = util.fdt.GetFileTime (lTargetName); 801 if(vVerbose == True) { 802 writefln("Time %s for %s (target)", lTargetTime.toString(), lTargetName); 803 writefln("Time %s (most recent)", lMostRecentTime.toString()); 804 } 887 version(BuildVerbose) 888 { 889 if(vVerbose == True) { 890 writefln("Time %s for %s (target)", lTargetTime.toString(), lTargetName); 891 writefln("Time %s (most recent)", lMostRecentTime.toString()); 892 } 893 } 894 805 895 if(lTargetTime < lMostRecentTime) { 806 896 lBuildRequired = True; 807 897 } 808 898 } 809 else if((vVerbose == True) || (vNames == True) ) { 810 writefln("\nCompiling only. No target will be built."); 811 } 899 else 900 { 901 version(BuildVerbose) 902 { 903 if((vVerbose == True) || (vNames == True) ) 904 writefln("\nCompiling only. No target will be built."); 905 } else { 906 if(vNames == True) 907 writefln("\nCompiling only. No target will be built."); 908 } 909 } 812 910 813 911 // Run any external tools referenced in the source files. … … 820 918 } 821 919 822 if (Source. SourceIndex.length== 0)920 if (Source.FileCount == 0) 823 921 { 824 922 /* It is possible to only have object and library … … 832 930 { 833 931 // Only include OBJECT files. 834 if (util.str.ends(lFileName , kObjExtention) == True)932 if (util.str.ends(lFileName , vObjExtention) == True) 835 933 lFilesToLink ~= lFileName; 836 934 } 837 935 } 838 else foreach (int i, char[] lFileName; Source.ScanOrder)936 else foreach(int i, Source lCurrentSource; Source) 839 937 { 840 938 // Check each source to see if we need to recompile it. 841 Source lCurrentSource;842 939 Bool lNeedsCompiling; 843 940 char[] lShortFileName; … … 846 943 lNeedsCompiling = vForceCompile; 847 944 848 lCurrentSource = Source.SourceIndex[lFileName];849 945 if (lCurrentSource.Ignore) 850 946 continue; 851 947 852 lShortFileName = util.pathex.AbbreviateFileName(l FileName);948 lShortFileName = util.pathex.AbbreviateFileName(lCurrentSource.FileName); 853 949 lFileType = std.path.getExt(lShortFileName); 854 if (lFileType != kSrcExtention && lFileType != kDdocExtention)950 if (lFileType != vSrcExtention && lFileType != vDdocExtention) 855 951 continue; 856 952 857 953 // Only source files are examined from here on. 858 if (lCurrentSource.NoLink || lFileType == kDdocExtention)954 if (lCurrentSource.NoLink || lFileType == vDdocExtention) 859 955 { 860 956 lNonLinkingSources ~= lCurrentSource; … … 863 959 if(lCurrentSource.FilesTime > lCurrentSource.ObjectsTime) 864 960 { 865 if (vVerbose == True) 866 writefln("%s newer than its object file", lShortFileName); 961 version(BuildVerbose) 962 { 963 if (vVerbose == True) 964 writefln("%s newer than its object file", lShortFileName); 965 } 966 867 967 lNeedsCompiling = True; 868 968 869 969 } else if(lCurrentSource.DependantsTime > lCurrentSource.ObjectsTime) { 870 if (vVerbose == True) 871 writefln("%s has newer dependants than its object file.", 970 version(BuildVerbose) 971 { 972 if (vVerbose == True) 973 writefln("%s has newer dependants than its object file.", 872 974 lShortFileName); 975 } 873 976 874 977 lNeedsCompiling = True; … … 885 988 lFilesToLink ~= util.pathex.AbbreviateFileName(lCurrentSource.ObjectName); 886 989 887 if (vTestRun == False) 888 { 889 if (lCurrentSource.IncrementBuildNumber()) 890 { 891 if (vVerbose == True) 892 writefln("New build number %d for %s", 893 lCurrentSource.BuildNumber, 894 lCurrentSource.ModuleName); 895 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 } 896 1001 } 897 1002 } … … 926 1031 AddBuildDef("SUBSYSTEM WINDOWS"); 927 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"; 928 1047 } 929 1048 else if (Source.WasMainDLL) { … … 954 1073 } 955 1074 956 version(Posix) 957 { 958 vDefaultLibs ~= "c"; 959 } 960 // Add any library or external obj files required. 961 if (lLinking == True) 962 { 963 lLibraryFiles.length = 0; 964 965 foreach (char[] lFileName; vLinkFiles.keys) 966 { 967 char[] lCmdItem; 968 969 if (lFileName.length > 0) 970 { 971 lCmdItem = lFileName; 972 if ( util.str.ends(lCmdItem, "." ~ kLibExtention) == True) 973 { 974 // Cut off extention. 975 lCmdItem.length = lCmdItem.length - kLibExtention.length - 1; 976 // lPrefix = "-L-l"; // Needed for linker to find the library. 977 lLibraryFiles ~= lCmdItem; 978 } 979 else 980 { 981 lFilesToLink ~= lCmdItem; 982 } 1075 // Add any library and any external object files required. 1076 lLibraryFiles.length = 0; 1077 foreach (char[] lFileName; vLinkFiles.keys) 1078 { 1079 char[] lCmdItem; 1080 1081 if (lFileName.length > 0) 1082 { 1083 lCmdItem = lFileName; 1084 if ( util.str.ends(lCmdItem, "." ~ vLibExtention) == True) 1085 { 1086 // Cut off extention. 1087 lCmdItem.length = lCmdItem.length - vLibExtention.length - 1; 1088 lLibraryFiles ~= lCmdItem; 1089 } 1090 else 1091 { 1092 lFilesToLink ~= lCmdItem; 983 1093 } 984 1094 } … … 990 1100 if (lSourcesToCompile.length > 0) 991 1101 { 992 // Ok, I have some compiling to do!1102 // Ok, I have some compiling to do! 993 1103 char[] lCommandLine; 994 1104 … … 996 1106 997 1107 if (vUseResponseFile == True) 998 {1108 { 999 1109 lDResponseFileName = ReplaceExtention(lTargetName, "rsp"); 1000 1110 if (vTemporaryPath.length != 0) … … 1004 1114 lDResponseFileName = util.pathex.AbbreviateFileName(lDResponseFileName); 1005 1115 util.fileex.CreateTextFile(lDResponseFileName,lCommandLine); 1006 lCommand = vCompile rPath ~ vCompilerExe ~ vCompileOnlySwitch~ " @" ~ lDResponseFileName;1116 lCommand = vCompileOnly ~ " @" ~ lDResponseFileName; 1007 1117 } 1008 1118 else 1009 1119 { // using commandline; may run into limits 1010 1120 lCommandLine=std.string.replace(lCommandLine, "\n", " "); 1011 lCommand = vCompilerPath ~ vCompilerExe ~ vCompileOnlySwitch ~ " " ~ lCommandLine; 1012 } 1013 1014 if (vVerbose == True) { 1015 writefln("Compiling with ..........\n%s\n", lCommandLine); 1121 lCommand = vCompileOnly ~ " " ~ lCommandLine; 1122 } 1123 1124 version(BuildVerbose) 1125 { 1126 if (vVerbose == True) 1127 writefln("Compiling with ..........\n%s\n", lCommandLine); 1016 1128 } 1017 1129 1018 1130 // Run Compiler to compile the source files that need it. 1019 lRunResult = RunCommand( lCommand);1131 lRunResult = RunCommand(vCompilerPath ~ vCompilerExe, lCommand); 1020 1132 if (lRunResult != 0) 1021 1133 vExecuteProgram = False; 1022 1134 } 1023 1135 1024 // LINK phase ...1025 if ( (lRunResult == 0) && (lFilesToLink.length > 0) && (lLinking == True))1136 // LINK phase ... 1137 if ( (lRunResult == 0) && (lFilesToLink.length > 0) && (lLinking == True)) 1026 1138 { 1027 1139 char[] lCommandLine; … … 1031 1143 // Build the command line for the linker. 1032 1144 lCommandLine = ""; 1033 version(Windows) 1034 { 1035 // Transfer linker switches from Compiler switches. 1036 foreach (char[] lCompileArg; vCompilerArgs) 1037 { 1038 if (util.str.begins(lCompileArg, "-L") == True) 1039 { 1040 lLinkerSwitches ~= lCompileArg[2..$]; 1041 } 1042 } 1043 foreach( char[] lSwitch; std.string.split(vLinkerDefSwitches ~ lLinkerSwitches, "/")) 1044 { 1045 if (lSwitch == "nomap") 1046 { 1047 IsMapping = False; 1048 } 1049 else if (lSwitch == "map") 1050 { 1051 IsMapping = True; 1052 } 1053 } 1054 1055 // (1) Gather the object file names 1056 foreach(char[] lFile; lFilesToLink) 1057 { 1058 lCommandLine ~= lFile ~ "+"; 1059 } 1060 if (lCommandLine.length > 0) 1061 lCommandLine[$-1] = '\n'; 1062 1063 // (2) Set the output file name 1064 lCommandLine ~= util.str.enquote(util.pathex.AbbreviateFileName(lTargetName)) ~ "\n"; 1065 1066 // (3) Set the map name 1067 if (IsMapping == True) 1068 lCommandLine ~= ReplaceExtention(lTargetName, "map"); 1069 1070 lCommandLine ~= "\n"; 1071 1072 // (4) Gather the libraries names. 1073 // Include the default libraries first. 1074 lLibraryFiles = vDefaultLibs ~ lLibraryFiles; 1075 if (lLibraryFiles.length > 0) 1076 { 1077 foreach( char[] lLib; lLibraryFiles) 1078 { 1079 lCommandLine ~= util.str.enquote(lLib) ~"+"; 1080 } 1081 lCommandLine[$-1] = '\n'; 1082 } 1083 else 1084 lCommandLine ~= "\n"; 1085 1086 // Include the explictly named libraries. 1087 if (vLibPaths.length > 1) 1088 { 1089 if (vLibPaths[0..1] == vConfigSep) 1090 vLibPaths = vLibPaths[1..$]; 1091 1092 // Include the paths to the libraries. 1093 if (vVerbose == True) 1094 writefln("Setting LIB=%s", vLibPaths); 1095 putenv("LIB=" ~ vLibPaths[1..$]); 1096 } 1097 1098 // (5) Set the 'def' file name 1099 if (lDefName.length > 0) 1100 lCommandLine ~= util.str.enquote(lDefName) ~ "\n"; 1101 else 1102 lCommandLine ~= "\n"; 1103 1104 // (6) Gather the resource file names 1105 1106 // (7) Gather then switches 1107 lCommandLine ~= vLinkerDefSwitches; 1108 lCommandLine ~= lLinkerSwitches; 1109 lCommandLine ~= "\n"; 1110 } 1111 1112 version(Posix) 1113 { 1114 // Transfer linker switches from Compiler switches. 1115 foreach (char[] lCompileArg; vCompilerArgs) 1116 { 1117 if (util.str.begins(lCompileArg, "-L") == True) 1118 { 1119 lLinkerSwitches ~= lCompileArg[2..$]; 1120 } 1121 } 1122 foreach( char[] lSwitch; std.string.split(vLinkerDefSwitches ~ lLinkerSwitches, "/")) 1123 { 1124 if (lSwitch == "nomap") 1125 { 1126 IsMapping = False; 1127 } 1128 else if (lSwitch == "map") 1129 { 1130 IsMapping = True; 1131 } 1132 } 1133 1134 // (1) Gather the object file names 1135 foreach(char[] lFile; lFilesToLink) 1136 { 1137 lCommandLine ~= lFile ~ "\n"; 1138 } 1139 1140 // (2) Set the output file name 1141 lCommandLine ~= "-o " ~ util.str.enquote(util.pathex.AbbreviateFileName(lTargetName)) ~ "\n"; 1142 1143 // (3) Set the map name 1144 if (IsMapping == True) 1145 lCommandLine ~= "-M\n"; 1146 1147 // (4) Gather the libraries names. 1148 // Include the default libraries first. 1149 foreach( char[] lLib; vDefaultLibs ~ lLibraryFiles) 1150 { 1151 lCommandLine ~= "-l" ~ util.str.enquote(lLib) ~ "\n"; 1152 } 1153 1154 if (vLibPaths.length > 1) 1155 { 1156 if (vLibPaths[0..1] == vConfigSep) 1157 vLibPaths = vLibPaths[1..$]; 1158 1159 // Include the paths to the libraries. 1160 if (vVerbose == True) 1161 writefln("Setting LIB=%s", vLibPaths); 1162 char[][] lLibPaths; 1163 lLibPaths = std.string.split(vLibPaths, vConfigSep); 1164 foreach(char[] lLib; lLibPaths) 1165 { 1166 if (lLib.length > 0) 1167 lCommandLine ~= "-L" ~ util.str.enquote(lLib) ~ "\n"; 1168 } 1169 } 1170 1171 // (4) Gather then switches 1172 lCommandLine ~= vLinkerDefSwitches; 1173 lCommandLine ~= lLinkerSwitches; 1174 lCommandLine ~= "\n"; 1175 } 1145 version(Windows) 1146 { 1147 // Transfer linker switches from Compiler switches. 1148 foreach (char[] lCompileArg; vCompilerArgs) 1149 { 1150 if (util.str.begins(lCompileArg, "-L") == True) 1151 { 1152 lLinkerSwitches ~= lCompileArg[2..$]; 1153 } 1154 } 1155 foreach( char[] lSwitch; std.string.split(vLinkerDefs ~ lLinkerSwitches, "/")) 1156 { 1157 if (lSwitch == "nomap") 1158 { 1159 IsMapping = False; 1160 } 1161 else if (lSwitch == "map") 1162 { 1163 IsMapping = True; 1164 } 1165 } 1166 1167 // (1) Gather the object file names 1168 foreach(char[] lFile; lFilesToLink) 1169 { 1170 // Only include OBJECT files. 1171 if (std.path.getExt(lFile) == vObjExtention) 1172 lCommandLine ~= lFile ~ "+"; 1173 } 1174 if (lCommandLine.length > 0) 1175 lCommandLine[$-1] = '\n'; 1176 1177 // (2) Set the output file name 1178 lCommandLine ~= util.str.enquote(util.pathex.AbbreviateFileName(lTargetName)) ~ "\n"; 1179 1180 // (3) Set the map name 1181 if (IsMapping == True) 1182 lCommandLine ~= ReplaceExtention(lTargetName, "map"); 1183 1184 lCommandLine ~= "\n"; 1185 1186 // (4) Gather the libraries names. 1187 // Include the default libraries first. 1188 lLibraryFiles = vDefaultLibs ~ lLibraryFiles; 1189 if (lLibraryFiles.length > 0) 1190 { 1191 foreach( char[] lLib; lLibraryFiles) 1192 { 1193 lCommandLine ~= util.str.enquote(lLib) ~"+"; 1194 } 1195 lCommandLine[$-1] = '\n'; 1196 } 1197 else 1198 lCommandLine ~= "\n"; 1199 1200 // Include the explictly named libraries. 1201 if (vLibPaths.length > 1) 1202 { 1203 if (vLibPaths[0..1] == vConfigSep) 1204 vLibPaths = vLibPaths[1..$]; 1205 1206 // Include the paths to the libraries. 1207 version(BuildVerbose) 1208 { 1209 if (vVerbose == True) 1210 writefln("Setting LIB=%s", vLibPaths); 1211 } 1212 util.str.SetEnv("LIB",vLibPaths[1..$]); 1213 } 1214 1215 // (5) Set the 'def' file name 1216 if (lDefName.length > 0) 1217 lCommandLine ~= util.str.enquote(lDefName) ~ "\n"; 1218 else 1219 lCommandLine ~= "\n"; 1220 1221 // (6) Gather the resource file names 1222 { 1223 int lCnt; 1224 foreach(char[] lFile; lFilesToLink) 1225 { 1226 char[] lExt; 1227 1228 lExt = std.path.getExt(lFile); 1229 lCnt = 0; 1230 // Only include non OBJECT and non LIBRARY files. 1231 if (lExt != vObjExtention && lExt != vLibExtention) 1232 { 1233 lCommandLine ~= lFile; 1234 lCnt++; 1235 } 1236 if (lCnt > 0) 1237 lCommandLine ~= "+"; 1238 } 1239 if (lCnt > 0) 1240 lCommandLine[$-1] = '\n'; 1241 } 1242 1243 // (7) Gather then switches 1244 lCommandLine ~= vLinkerDefs; 1245 lCommandLine ~= lLinkerSwitches; 1246 lCommandLine ~= "\n"; 1247 } 1248 1249 version(Posix) 1250 { 1251 // Transfer linker switches from Compiler switches. 1252 foreach (char[] lCompileArg; vCompilerArgs) 1253 { 1254 if (util.str.begins(lCompileArg, "-L") == True) 1255 { 1256 lLinkerSwitches ~= lCompileArg[2..$]; 1257 } 1258 } 1259 foreach( char[] lSwitch; std.string.split(vLinkerDefs ~ lLinkerSwitches, "/")) 1260 { 1261 if (lSwitch == "nomap") 1262 { 1263 IsMapping = False; 1264 } 1265 else if (lSwitch == "map") 1266 { 1267 IsMapping = True; 1268 } 1269 } 1270 1271 // (1) Gather the object and resource file names 1272 foreach(char[] lFile; lFilesToLink) 1273 { 1274 lCommandLine ~= lFile ~ "\n"; 1275 } 1276 1277 // (2) Set the output file name 1278 lCommandLine ~= vOutFileSwitch ~ util.str.enquote(util.pathex.AbbreviateFileName(lTargetName)) ~ "\n"; 1279 1280 // (3) Set the map name 1281 if (IsMapping == True) 1282 lCommandLine ~= vMapSwitch ~ "\n"; 1283 1284 // (4) Gather the libraries names. 1285 // Include the default libraries first. 1286 foreach( char[] lLib; vDefaultLibs ~ lLibraryFiles) 1287 { 1288 lCommandLine ~= vLinkLibSwitch ~ util.str.enquote(lLib) ~ "\n"; 1289 } 1290 1291 if (vLibPaths.length > 1) 1292 { 1293 if (vLibPaths[0..1] == vConfigSep) 1294 vLibPaths = vLibPaths[1..$]; 1295 1296 // Include the paths to the libraries. 1297 version(BuildVerbose) 1298 { 1299 if (vVerbose == True) 1300 writefln("Setting LIB=%s", vLibPaths); 1301 } 1302 1303 char[][] lLibPaths; 1304 lLibPaths = std.string.split(vLibPaths, vConfigSep); 1305 foreach(char[] lLib; lLibPaths) 1306 { 1307 if (lLib.length > 0) 1308 lCommandLine ~= vLibPathSwitch ~ util.str.enquote(lLib) ~ "\n"; 1309 } 1310 } 1311 1312 // (5) Gather then switches 1313 lCommandLine ~= vLinkerDefs; 1314 lCommandLine ~= lLinkerSwitches; 1315 lCommandLine ~= "\n"; 1316 } 1176 1317 1177 1318 if (vUseResponseFile == True) 1178 {1319 { 1179 1320 lLinkResponseFileName = ReplaceExtention(lTargetName, "ksp"); 1180 1321 if (vTemporaryPath.length != 0) … … 1184 1325 lLinkResponseFileName = util.pathex.AbbreviateFileName(lLinkResponseFileName); 1185 1326 util.fileex.CreateTextFile(lLinkResponseFileName,lCommandLine); 1186 lCommand = vLinkerPath ~ vLinkerExe ~ "@" ~ lLinkResponseFileName;1327 lCommand = "@" ~ lLinkResponseFileName; 1187 1328 } 1188 1329 else 1189 1330 { // using commandline; may run into limits 1190 lCommandLine=std.string.replace(lCommandLine, "\n", " "); 1191 lCommand = vLinkerPath ~ vLinkerExe ~ " " ~ lCommandLine; 1192 } 1193 1194 if (vVerbose == True) { 1195 writefln("Linking with ..........\n%s\n", lCommandLine); 1331 version(DigitalMars) 1332 { 1333 lCommandLine=std.string.replace(lCommandLine, "\n", ","); 1334 // Locate switches and change delim from a comma to a blank, 1335 // then remove any trailing comma too. 1336 int lPos = std.string.find(lCommandLine, "/"); 1337 if (lPos != -1) 1338 lCommandLine[lPos-1] = ' '; 1339 if (lCommandLine[$-1] == ',') 1340 lCommandLine[$-1] = ' '; 1341 } 1342 version(GNU) 1343 lCommandLine=std.string.replace(lCommandLine, "\n", " "); 1344 lCommand = lCommandLine; 1345 } 1346 1347 version(BuildVerbose) 1348 { 1349 if (vVerbose == True) 1350 writefln("Linking with ..........\n%s\n", lCommandLine); 1196 1351 } 1197 1352 … … 1199 1354 if (vSilent == True) 1200 1355 { 1201 version(Posix) lCommand ~= " >/dev/null"; 1202 version(Windows) lCommand ~= " >nul"; 1203 } 1204 1205 lRunResult = RunCommand(lCommand); 1356 lCommand ~= " " ~ vLinkerStdOut; 1357 } 1358 1359 lRunResult = RunCommand(vLinkerPath ~ vLinkerExe, lCommand); 1206 1360 if (lRunResult != 0) 1207 1361 vExecuteProgram = False; … … 1221 1375 char[] lTargetFileName; 1222 1376 char[] lImpLibPath; 1377 char[] lImpLibArgs; 1223 1378 ulong[] lImpManf; 1224 1379 1225 1380 vExecuteProgram = False; 1226 1381 1227 lImpLibPath = util.pathex.LocateFile("implib.exe", GetEnv(kPathId));1382 lImpLibPath = util.pathex.LocateFile("implib.exe", util.str.GetEnv(vPathId)); 1228 1383 if (util.fileex.FileExists(lImpLibPath)) 1229 1384 { 1230 1385 lImpManf = util.fileex.FindInFile(lImpLibPath, "Borland"); 1231 1386 if (lImpManf.length != 0) 1232 lImpLib Path ~= " -a";1387 lImpLibArgs ~= "-a"; 1233 1388 else 1234 lImpLib Path ~= " /system";1389 lImpLibArgs ~= "/system"; 1235 1390 1236 1391 lTargetFileName = std.path.getBaseName(lTargetName); 1237 lRunResult = RunCommand(lImpLibPath ~ std.path.addExt(lTargetFileName, "lib") 1238 ~ " " ~ std.path.addExt(lTargetFileName, "dll") ); 1392 lRunResult = RunCommand(lImpLibPath, lImpLibArgs ~ 1393 " " ~ std.path.addExt(lTargetFileName, "lib") ~ 1394 " " ~ std.path.addExt(lTargetFileName, "dll") ); 1239 1395 } 1240 1396 } … … 1255 1411 if ((vAllObjects == True) || lFileDir == "" || lFileDir == lTargetDir) 1256 1412 { 1257 if (lFileName.length > 1 + kSrcExtention.length)1258 { 1259 if (lFileName[$- kSrcExtention.length .. $] == kSrcExtention)1260 { 1261 lFileName = lFileName[0..$- kSrcExtention.length] ~ kObjExtention;1413 if (lFileName.length > 1 + vSrcExtention.length) 1414 { 1415 if (lFileName[$-vSrcExtention.length .. $] == vSrcExtention) 1416 { 1417 lFileName = lFileName[0..$-vSrcExtention.length] ~ vObjExtention; 1262 1418 } 1263 1419 } … … 1276 1432 } 1277 1433 util.fileex.CreateTextFile(lLResponseFileName,lOutText); 1278 lCommand = vLibrarianPath ~ vLibrarian ~ "@" ~ lLResponseFileName;1434 lCommand = "@" ~ lLResponseFileName; 1279 1435 } 1280 1436 else 1281 1437 { // using commandline, may run into limits 1282 lCommand = vLibrarianPath ~ vLibrarian ~ " " ~ std.string.replace(lOutText,std.path.linesep," "); 1283 } 1284 1285 if (vVerbose == True) { 1286 writefln("Librarian with ..........\n%s\n", lOutText); 1287 } 1288 1289 lRunResult = RunCommand(lCommand); 1438 lCommand = std.string.replace(lOutText,std.path.linesep," "); 1439 } 1440 1441 version(BuildVerbose) 1442 { 1443 if (vVerbose == True) 1444 writefln("Librarian with ..........\n%s\n", lOutText); 1445 } 1446 1447 lRunResult = RunCommand(vLibrarianPath ~ vLibrarian, lCommand); 1290 1448 } 1291 1449 } … … 1296 1454 char[][] lHitList; 1297 1455 1298 if (vVerbose == True) { 1299 writefln("Cleaning up ..."); 1300 } 1301 foreach(char[] lFileName; Source.ScanOrder) 1302 { 1303 Source lSource; 1304 lSource = Source.SourceIndex[lFileName]; 1456 version(BuildVerbose) 1457 { 1458 if (vVerbose == True) 1459 writefln("Cleaning up ..."); 1460 } 1461 1462 foreach(Source lSource; Source) 1463 { 1305 1464 if (lSource.Ignore) 1306 1465 continue; … … 1329 1488 if (util.fileex.FileExists( lFilename ) ) 1330 1489 { 1331 if (vVerbose == True) { 1332 writefln(" removing %s", lFilename); 1490 version(BuildVerbose) 1491 { 1492 if (vVerbose == True) 1493 writefln(" removing %s", lFilename); 1333 1494 } 1334 1495 std.file.remove(lFilename); … … 1352 1513 { 1353 1514 version(Posix) 1354 v DefaultCompArgs ~= vImportPathSwitch ~ "\"" ~ lRoot ~ "\"";1355 else1356 v DefaultCompArgs ~= vImportPathSwitch ~ lRoot;1357 } 1358 1359 foreach(char[] lArg; v DefaultCompArgs)1515 vCompilerDefs ~= vImportPath ~ "\"" ~ lRoot ~ "\""; 1516 version(Windows) 1517 vCompilerDefs ~= vImportPath ~ lRoot; 1518 } 1519 1520 foreach(char[] lArg; vCompilerDefs) 1360 1521 { 1361 1522 AddCompilerArg( lArg ); … … 1369 1530 { 1370 1531 // Enclose in quotes if no quotes are currently present. 1371 if ( find(lCompileArg, "\"") == -1)1532 if (std.string.find(lCompileArg, "\"") == -1) 1372 1533 // Arguments containing a blank need to be quoted. 1373 if ( find(lCompileArg, " ") != -1)1534 if (std.string.find(lCompileArg, " ") != -1) 1374 1535 { 1375 1536 // Strip off any trailing shell escape lead-in character. … … 1390 1551 if (pLinking == False) 1391 1552 { // No linking allowed. 1392 if (v NoLinkSwitch.length > 0)1393 { 1394 if ( find(vNoLinkSwitch, " ") != -1)1395 lOutText ~= std.string.format(`"%s"`,v NoLinkSwitch);1553 if (vCompileOnly.length > 0) 1554 { 1555 if (std.string.find(vCompileOnly, " ") != -1) 1556 lOutText ~= std.string.format(`"%s"`,vCompileOnly); 1396 1557 else 1397 lOutText ~= v NoLinkSwitch;1558 lOutText ~= vCompileOnly; 1398 1559 // Terminate with a newline char. 1399 1560 lOutText ~= "\n"; 1400 1561 1401 AddCompilerArg( v NoLinkSwitch);1562 AddCompilerArg( vCompileOnly ); 1402 1563 } 1403 1564 } … … 1423 1584 vExternals[$-1].FilePath = pPath; 1424 1585 vExternals[$-1].ToolOpts = pOpts; 1425 if (vVerbose == True) { 1426 writef("Added external file to be built: %s", pPath); 1427 foreach( char[] lOpt; pOpts) 1428 writef(" `%s`", lOpt); 1429 writefln(""); 1586 version(BuildVerbose) 1587 { 1588 if (vVerbose == True) 1589 { 1590 writef("Added external file to be built: %s", pPath); 1591 foreach( char[] lOpt; pOpts) 1592 writef(" `%s`", lOpt); 1593 writefln(""); 1594 } 1430 1595 } 1431 1596 } … … 1451 1616 if (vPragmaTargetName.length == 0) 1452 1617 vPragmaTargetName = pPath; 1453 else if (vPragmaTargetName != pPath) { 1454 if (vVerbose == True) { 1455 writefln("Multiple pragma(target,...) detected. '%s' will be used and '%s' rejected.", 1456 vPragmaTargetName, pPath ); 1618 else 1619 { 1620 version(BuildVerbose) 1621 { 1622 if (vPragmaTargetName != pPath) 1623 { 1624 if (vVerbose == True) 1625 writefln("Multiple pragma(target,...) detected. '%s' will be used and '%s' rejected.", 1626 vPragmaTargetName, pPath ); 1627 } 1457 1628 } 1458 1629 } … … 1501 1672 { 1502 1673 if (pArg[0..3] == `+v+`) 1503 pArg = vVersionSwitch ~ pArg[3..$];1674 pArg = vVersionSwitch ~ "=" ~ pArg[3..$]; 1504 1675 } 1505 1676 … … 1552 1723 { 1553 1724 return vImportRoots; 1554 }1555 1556 // function to replace tokens in the form %<SYM>% with environment data.1557 // -------------------------------------------1558 char[] ExpandEnvVar(char[] pLine)1559 // -------------------------------------------1560 {1561 char[] lLine;1562 char[] lSymName;1563 int lPos;1564 int lEnd;1565 1566 lLine.length = 0;1567 for( lPos = 0; lPos < pLine.length; lPos++ )1568 {1569 if (pLine[lPos] == '%')1570 {1571 lSymName.length = 0;1572 for(lEnd = lPos+1; (lEnd < pLine.length) && (pLine[lEnd] != '%'); lEnd++ )1573 {1574 lSymName ~= pLine[lEnd];1575 }1576 if (lSymName.length > 0)1577 {1578 if (lSymName == "@P")1579 {1580 // Special symbol that refers to the DMD configuration file's directory.1581 lSymName = (vConfigPath ? vConfigPath[0..length-1] : "");1582 }1583 else if (lSymName == "@D")1584 {1585 // Special symbol that refers to the compiler's file's directory.1586 lSymName = (vCompilerPath ? vCompilerPath[0..length-1] : "");1587 }1588 else1589 {1590 lSymName = (GetEnv(std.utf.toUTF8(lSymName)));1591 }1592 lLine ~= lSymName;1593 }1594 lPos = lEnd;1595 }1596 else1597 {1598 lLine ~= pLine[lPos];1599 }1600 }1601 return lLine;1602 1725 } 1603 1726 … … 1672 1795 { 1673 1796 lRootName = AddRoot(lRoot); 1674 /* 1675 version(Posix) 1676 vDefaultCompArgs ~= vImportPathSwitch ~ "\"" ~ lRoot ~ "\""; 1677 else 1678 vDefaultCompArgs ~= vImportPathSwitch ~ lRoot; 1679 */ 1680 if(vVerbose == True) { 1681 if (lRootName.length > 0){ 1682 writefln(" added root from config file %s", lRootName); 1683 } 1797 version(BuildVerbose) 1798 { 1799 if(vVerbose == True && lRootName.length > 0) 1800 writefln(" added root from config file %s", lRootName); 1684 1801 } 1685 1802 } … … 1709 1826 } 1710 1827 1711 if (util.str.IsLike(lSwitch, std.utf.toUTF32(v TemporaryPathSwitch ~ "*")) == True)1828 if (util.str.IsLike(lSwitch, std.utf.toUTF32(vOutputPath ~ "*")) == True) 1712 1829 { 1713 1830 char[] lbRoot; 1714 1831 1715 vTemporaryPath = lSwitch[v TemporaryPathSwitch.length .. $];1832 vTemporaryPath = lSwitch[vOutputPath.length .. $]; 1716 1833 if (vTemporaryPath.length > 0 && vTemporaryPath[$-1..$] != std.path.sep) 1717 1834 vTemporaryPath ~= std.path.sep; … … 1721 1838 lbRoot = AddRoot(vTemporaryPath); 1722 1839 if (lbRoot.length > 0){ 1723 if(vVerbose == True) { 1840 version(BuildVerbose) 1841 { 1842 if(vVerbose == True) 1724 1843 writefln("Added root from config file Object Write Path = %s",lbRoot); 1725 1844 } … … 1745 1864 1746 1865 // Check for a environment flag before config file. 1747 lSymValue = GetEnv("DFLAGS");1866 lSymValue = util.str.GetEnv("DFLAGS"); 1748 1867 if (lSymValue.length > 0 ) 1749 1868 { 1750 if (vVerbose == True) 1751 writefln("Analyzing environment symbol DFLAGS=%s", lSymValue); 1869 version(BuildVerbose) 1870 { 1871 if (vVerbose == True) 1872 writefln("Analyzing environment symbol DFLAGS=%s", lSymValue); 1873 } 1874 1752 1875 Process_DFLAGS( lSymValue ); 1753 1876 } … … 1768 1891 } 1769 1892 1770 lPath = vConfigPath ~ vConfigFile ; 1893 if (vOverrideConfigPath.length > 0) 1894 lPath = vOverrideConfigPath ~ vConfigFile ; 1895 else 1896 lPath = vConfigPath ~ vConfigFile ; 1897 version(BuildVerbose) 1898 { 1899 if (vVerbose == True) 1900 writefln("Reading from config: %s", lPath); 1901 } 1771 1902 util.fileex.GetTextLines(lPath, lTextLines, util.fileex.GetOpt.Exists); 1772 1903 1773 if (vVerbose == True) {1774 writefln("Reading from config: %s", lPath);1775 }1776 1904 1777 1905 foreach(int i, char[] lLine; lTextLines) … … 1781 1909 1782 1910 // Replace any environment symbols with their value. 1783 if (vVerbose == True) { 1784 writefln(" Line %d: %s", i+1, lLine); 1785 } 1786 lLine = ExpandEnvVar(lLine); 1911 version(BuildVerbose) 1912 { 1913 if (vVerbose == True) 1914 writefln(" Line %d: %s", i+1, lLine); 1915 } 1916 1917 lLine = util.str.ExpandEnvVar(lLine); 1787 1918 1788 1919 // Examine DFLAGS 1789 lPos = find(lLine, "DFLAGS=");1920 lPos = std.string.find(lLine, "DFLAGS="); 1790 1921 if(lPos == 0) 1791 1922 { … … 1794 1925 1795 1926 // Examine LIB 1796 lPos = find(lLine, "LIB=");1927 lPos = std.string.find(lLine, "LIB="); 1797 1928 if(lPos == 0) 1798 1929 { … … 1826 1957 } 1827 1958 } 1828 if(vVerbose == True) 1829 { 1830 writefln(" use %s",vLibPaths); 1959 version(BuildVerbose) 1960 { 1961 if(vVerbose == True) 1962 writefln(" use %s",vLibPaths); 1831 1963 } 1832 1964 continue; … … 1834 1966 1835 1967 // Examine LINKCMD 1836 lPos = find(lLine, "LINKCMD=");1968 lPos = std.string.find(lLine, "LINKCMD="); 1837 1969 if(lPos == 0) { 1838 1970 // Strip out any quotes 1839 while( (lPos = find(lLine, "\"")) != -1)1971 while( (lPos = std.string.find(lLine, "\"")) != -1) 1840 1972 { 1841 1973 lLine = lLine[0..lPos] ~ lLine[lPos+1 .. $]; … … 1845 1977 vLinkerPath = util.pathex.CanonicalPath(vLinkerPath); 1846 1978 vLinkerExe = std.path.getBaseName(lLine[7..$]); 1847 if(vVerbose == True) { 1848 writefln(" linker path %s",vLinkerPath); 1849 writefln(" linker is %s",vLinkerExe); 1979 version(BuildVerbose) 1980 { 1981 if(vVerbose == True) 1982 { 1983 writefln(" linker path %s",vLinkerPath); 1984 writefln(" linker is %s",vLinkerExe); 1985 } 1850 1986 } 1851 1987 continue; 1852 1988 } 1853 1989 1854 lPos = find(lLine, "LIBCMD=");1990 lPos = std.string.find(lLine, "LIBCMD="); 1855 1991 if(lPos == 0) { 1856 1992 // Strip out any quotes 1857 while( (lPos = find(lLine, "\"")) != -1)1993 while( (lPos = std.string.find(lLine, "\"")) != -1) 1858 1994 { 1859 1995 lLine = lLine[0..lPos] ~ lLine[lPos+1 .. $]; … … 1863 1999 1864 2000 vLibrarian = std.path.getBaseName(lLine[7..$]); 1865 if(vVerbose == True) { 1866 writefln(" librarian path %s",vLibrarianPath); 1867 writefln(" librarian is %s",vLibrarian); 2001 version(BuildVerbose) 2002 { 2003 if(vVerbose == True) 2004 { 2005 writefln(" librarian path %s",vLibrarianPath); 2006 writefln(" librarian is %s",vLibrarian); 2007 } 1868 2008 } 1869 2009 } … … 1918 2058 1919 2059 // ------------------------------------------------ 1920 Substitute[] GetMacros()1921 {1922 return vSubstitutions;1923 }1924 1925 // ------------------------------------------------1926 2060 char[] GetFullPathnameScan(char[] pFileName, int pScanList) 1927 2061 // ------------------------------------------- … … 1955 2089 // Look for file in current folder first. 1956 2090 lLocalPath = util.pathex.CanonicalPath(pFileName, false); 1957 if(util.fileex.FileExists(lLocalPath)) { 2091 if(util.fileex.FileExists(lLocalPath)) 2092 { 1958 2093 return util.pathex.AbbreviateFileName(lLocalPath); 1959 2094 } 1960 2095 1961 2096 // Examine each known import root to see if the file lives there. 1962 foreach(char[] lNextRoot; vImportRoots) { 2097 foreach(char[] lNextRoot; vImportRoots) 2098 { 1963 2099 lPossiblePath = ( lNextRoot ~ pFileName ); 1964 if(util.fileex.FileExists(lPossiblePath)) { 2100 if(util.fileex.FileExists(lPossiblePath)) 2101 { 1965 2102 return util.pathex.AbbreviateFileName(lPossiblePath); 1966 2103 } … … 1982 2119 // Assume that an environment symbol name was supplied, 1983 2120 // but if that fails, assume its a list of paths. 1984 lRawValue = GetEnv(pSymName);2121 lRawValue = util.str.GetEnv(pSymName); 1985 2122 if (lRawValue.length == 0) 1986 2123 lRawValue = pSymName; … … 2009 2146 return lCompilerPath; 2010 2147 } 2148 2149 // ------------------------------- 2150 void ExamineArgs(char[][] pArgGroup) 2151 // ------------------------------- 2152 { 2153 foreach(char[] lArg; pArgGroup) 2154 { 2155 ProcessCmdLineArg( lArg ); 2156 } 2157 } 2158 2011 2159 2012 2160 // ------------------------------------------- … … 2033 2181 source.GetFullPathnameScan = &GetFullPathnameScan; 2034 2182 source.GetObjWritePath = &GetTemporaryPath; 2035 source.GetMacros = &GetMacros;2036 2183 source.AddCompilerArg = &AddCompilerArg; 2037 2184 2038 2185 // Scan the PATH env symbol to locate the D compiler. 2039 lCompPath = FindFileInPathList( kPathId, vCompilerExe);2186 lCompPath = FindFileInPathList(vPathId, vCompilerExe); 2040 2187 if (lCompPath.length > 0){ 2041 2188 if (lCompPath[length-1] != std.path.sep[0]) 2042 2189 lCompPath ~= std.path.sep; 2043 2190 vCompilerPath = lCompPath.dup; 2044 // Set config path to same as compiler unless it is already set. 2045 if (!(vConfigPath is null) && (vConfigPath.length == 0)) 2046 vConfigPath = lCompPath.dup; 2191 util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 2047 2192 } 2048 2193 … … 2050 2195 { 2051 2196 vCompilerPath = util.pathex.GetInitCurDir; 2197 util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 2052 2198 lSetPath = true; 2053 2199 } … … 2065 2211 } 2066 2212 } 2213 util.str.SetEnv("@S", std.path.getDirName(vAppPath)); 2067 2214 2068 2215 pArgs=pArgs[1..pArgs.length]; 2069 2216 if (pArgs.length == 0) { 2070 // No other arguments so show usage message. 2071 DisplayUsage (); 2072 return 0; 2217 if (util.fileex.FileExists(vDefResponseFile) == false) 2218 { 2219 // No other arguments so show usage message. 2220 DisplayUsage (); 2221 return 0; 2222 } 2223 else 2224 { 2225 pArgs ~= "@" ~ vDefResponseFile; 2226 } 2073 2227 } 2074 2228 2075 2229 2076 2230 GatherArgs( pArgs ); 2077 source.mVerboseMode = vVerbose; 2078 if (vVerbose == True){ 2079 writefln("*** build v%s (build %d)***", vAppVersion, build_bn.auto_build_number); 2080 } 2081 2082 foreach(char[] lArg; vCombinedArgs) { 2083 ProcessCmdLineArg( lArg ); 2084 } 2085 2231 version(BuildVerbose) 2232 { 2233 source.mVerboseMode = vVerbose; 2234 if (vVerbose == True) 2235 writefln("*** build v%s (build %d)***", vAppVersion, build_bn.auto_build_number); 2236 } 2237 2238 ExamineArgs( vCombinedArgs ); 2239 2240 // Grab the external macro definitions unless otherwise told not to. 2086 2241 source.mMacroInput = vMacroInput; 2087 2242 if (vMacroInput == True) 2088 ProcessMacroDefs(vVerbose); 2243 version(BuildVerbose) 2244 { 2245 ProcessMacroDefs(vVerbose); 2246 } else { 2247 ProcessMacroDefs(False); 2248 } 2089 2249 2090 2250 if( (vTargetName.length == 0) && (vCommandTargetName.length == 0) ){ 2091 throw new Exception("No target name supplied."); 2092 } 2093 2094 if ((vVerbose == True) || (vNames == True) ) 2095 writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 2251 throw new BuildException("No target name supplied."); 2252 } 2253 2254 version(BuildVerbose) 2255 { 2256 if ((vVerbose == True) || (vNames == True) ) 2257 writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 2258 } else { 2259 if (vNames == True) 2260 writefln("Current Dir '%s'", util.pathex.GetInitCurDir()); 2261 } 2096 2262 2097 2263 if (lSetPath) 2098 2264 { 2265 version(BuildVerbose) 2266 { 2267 if (vVerbose == True) 2268 writefln("%s not found in PATH symbol, so assuming current directory", 2269 vCompilerExe); 2270 } 2271 } 2272 2273 if (vCompilerPath[length-1] != std.path.sep[0]) 2274 { 2275 vCompilerPath ~= std.path.sep; 2276 util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 2277 } 2278 2279 2280 if (vConfigFile.length > 0) 2281 { 2282 char[][] lPotentialPaths; 2283 2284 2285 lPotentialPaths ~= "." ~ std.path.sep; 2286 lPotentialPaths ~= util.str.GetEnv(vHomePathId); 2287 version(Windows) 2288 { 2289 char[] lTemp; 2290 lTemp = util.str.GetEnv("HOMEDRIVE"); 2291 if (lTemp.length > 0) 2292 { 2293 lPotentialPaths ~= lTemp ~ util.str.GetEnv("HOMEPATH"); 2294 } 2295 } 2296 lPotentialPaths ~= vCompilerPath; 2297 if (vEtcPath.length > 0) 2298 lPotentialPaths ~= vEtcPath; 2299 2300 foreach( char[] p; lPotentialPaths) 2301 { 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 2313 if (util.fileex.FileExists(vCompilerPath ~ vCompilerExe) == false) 2314 { 2315 throw new BuildException(std.string.format("The compiler '%s' was not found.", 2316 vCompilerPath ~ vCompilerExe)); 2317 } 2318 2319 version(BuildVerbose) 2320 { 2099 2321 if (vVerbose == True) 2100 { 2101 writefln("%s not found in PATH symbol, so assuming current directory", 2102 vCompilerExe); 2103 } 2104 } 2105 2106 if (vCompilerPath[length-1] != std.path.sep[0]) 2107 vCompilerPath ~= std.path.sep; 2108 2109 2110 if (vConfigPath.length == 0) 2111 { 2112 vConfigPath = vCompilerPath; 2113 if (vVerbose == True) 2114 { 2115 writefln("No configuration file path, so assuming current directory"); 2116 } 2117 } 2118 if (util.str.ends(vConfigPath, std.path.sep) is False) 2119 vConfigPath ~= std.path.sep; 2120 2121 version(DigitalMars) 2122 { 2123 if (util.fileex.FileExists(vConfigPath ~ vConfigFile) == false) 2124 { 2125 throw new Exception(std.string.format("The configuration file '%s' was not found.", 2126 vConfigPath ~ vConfigFile)); 2127 } 2128 } 2129 2130 if (util.fileex.FileExists(vCompilerPath ~ vCompilerExe) == false) 2131 { 2132 throw new Exception(std.string.format("The compiler '%s' was not found.", 2133 vCompilerPath ~ vCompilerExe)); 2134 } 2135 2136 if (vVerbose == True){ 2137 writefln("Compiler installed in %s",vCompilerPath); 2138 writefln("Configuration File installed in %s",vConfigPath); 2322 writefln("Compiler installed in %s",vCompilerPath); 2139 2323 } 2140 2324 … … 2143 2327 ReadEnviron(); 2144 2328 version(DigitalMars) ReadConfigFile(); 2329 2330 version(Posix) 2331 { 2332 // Unless supplied by the config file, these are the default 2333 // libraries to use for linking. 2334 if (vDefaultLibs.length == 0) 2335 { 2336 vDefaultLibs ~= "c"; 2337 vDefaultLibs ~= "phobos"; 2338 vDefaultLibs ~= "m"; 2339 } 2340 } 2341 2342 // Assume phobos will be ignored unless user has specified another set. 2343 if (vModulesToIgnore.length == 0) 2344 vModulesToIgnore ~= "phobos"; 2145 2345 2146 2346 // Rationalize the ignored modules list. … … 2171 2371 } 2172 2372 } 2173 2174 2373 if ( lAllExist == false) 2175 2374 { 2176 throw new Exception ("Not all supplied files exist."); 2177 } 2178 2375 throw new BuildException ("Not all supplied files exist."); 2376 } 2377 2378 // Process the files 2179 2379 lBuildResult = Build(); 2180 2380 2181 if(vVerbose == True) { 2381 // After processing analysis. 2382 version(BuildVerbose) 2383 { 2384 if(vVerbose == True) 2385 { 2386 writefln(""); 2387 DisplayItems(vBuildArgs, "build args: ..............."); 2388 DisplayItems(vCompilerArgs, "compiler args: ................"); 2389 DisplayItems(vCmdLineSourceFiles, "command line files: ..............."); 2390 DisplayItems(Source.AllFiles, 2391 "source files: ..............."); 2392 DisplayItems(vLinkFiles.keys, "link files: ..............."); 2393 DisplayItems(vExternals, "externally built files: ..............."); 2394 DisplayItems(vImportRoots, "import roots: ................."); 2395 DisplayItems(vModulesToIgnore,"ignored packages: ................."); 2396 DisplayItems(vModulesToNotice,"noticed package: ................."); 2397 } 2398 } 2399 2400 // Output list of modules if it was requested. 2401 if(vSymbols == True) 2402 { 2403 char[] lSymbolData; 2404 int lModuleCount; 2405 char[] lSymbolOutName; 2406 2407 foreach(Source lSource; Source) 2408 { 2409 if (lSource.Ignore) 2410 continue; 2411 if (lSource.NoLink) 2412 continue; 2413 if (lSource.ModuleName.length == 0) 2414 continue; 2415 2416 if (lModuleCount == 0) 2417 { 2418 lSymbolData ~= vModOutPrefix; 2419 } 2420 lModuleCount++; 2421 2422 if (lModuleCount > 1) 2423 { 2424 lSymbolData ~= vModOutDelim; 2425 } 2426 2427 lSymbolData ~= util.str.Expand(vModOutBody, "mod=" ~ lSource.ModuleName 2428 ~ "," ~ "src=" ~ lSource.FileName 2429 ); 2430 } 2431 if (lModuleCount != 0) 2432 { 2433 lSymbolData ~= vModOutSuffix; 2434 } 2435 2436 if (vSymbolOutName.length == 0) 2437 vSymbolOutName = util.pathex.GetBaseName(vTargetName) ~ vModOutFile; 2438 2439 // ensure requested path exists. 2440 util.pathex.MakePath(vSymbolOutName); 2441 2442 // write out the data buffer to disk. 2443 std.file.write(vSymbolOutName, lSymbolData); 2444 } 2445 2446 // Run the resulting program if it was requested. 2447 if ((vExecuteProgram == True) && (vTargetExe.length > 0)) 2448 { 2449 // Put at one blank line out first to separate it 2450 // from compiler console output. 2182 2451 writefln(""); 2183 DisplayItems(vBuildArgs, "build args: ..............."); 2184 DisplayItems(vCompilerArgs, "compiler args: ................"); 2185 DisplayItems(vCmdLineSourceFiles, "command line files: ..............."); 2186 DisplayItems(Source.ScanOrder, 2187 "source files: ..............."); 2188 DisplayItems(vLinkFiles.keys, "link files: ..............."); 2189 DisplayItems(vExternals, "externally built files: ..............."); 2190 DisplayItems(vImportRoots, "import roots: ................."); 2191 DisplayItems(vModulesToIgnore,"ignored packages: ................."); 2192 DisplayItems(vModulesToNotice,"noticed package: ................."); 2193 } 2194 2195 if ((vExecuteProgram == True) && (vTargetExe.length > 0)) 2196 { 2197 RunCommand( vTargetExe ~ " " ~ std.string.strip(vRunParms)); 2452 2453 RunCommand( vTargetExe, std.string.strip(vRunParms)); 2198 2454 } 2199 2455 … … 2209 2465 char[][] lRespLines; 2210 2466 2211 if (pArg.length == 1) 2212 lRespFileName = "build.brf"; 2467 if (pArg.length == 0) 2468 return; 2469 if (pArg == "@") 2470 lRespFileName = vDefResponseFile; 2471 else if (pArg[0] == '@') 2472 lRespFileName = pArg[1..length].dup; 2213 2473 else 2214 lRespFileName = pArg [1..length].dup;2474 lRespFileName = pArg; 2215 2475 2216 2476 if (std.path.getExt(lRespFileName).length == 0) 2217 2477 { 2218 lRespFileName ~= ".brf"; 2219 } 2220 2221 if (pVerbose == True) 2222 writefln("Response file %s", lRespFileName); 2478 lRespFileName ~= "." ~ vResponseExt; 2479 } 2480 2481 version(BuildVerbose) 2482 { 2483 if (pVerbose == True) 2484 writefln("Response file %s", lRespFileName); 2485 } 2223 2486 2224 2487 lRespLines = util.fileex.GetTextLines(lRespFileName, util.fileex.GetOpt.Exists); … … 2234 2497 2235 2498 lArg = std.string.strip(lArg); 2236 if (lArg.length > 1){ 2237 if (pVerbose == True) 2238 writefln("Response file arg: %s", lArg); 2239 GatherOneArg( lArg ); 2499 if (lArg.length > 1) 2500 { 2501 version(BuildVerbose) 2502 { 2503 if (pVerbose == True) 2504 writefln("Response file arg: %s", lArg); 2505 } 2506 GatherOneArg( lArg, vCombinedArgs ); 2240 2507 } 2241 2508 } … … 2244 2511 void ProcessCmdLineArg( char[] pArg ) 2245 2512 { 2246 char[] lNewPath;2247 2513 static char[] lImportSwitch; 2248 2514 2249 if(util.str.begins(pArg, "-version=") == True) { 2515 // Handle a version switch on the command line by 2516 if(util.str.begins(pArg, vVersionSwitch) == True) 2517 { 2250 2518 char[] lVersionString; 2251 2519 2252 lVersionString=pArg [9 .. $]; 2253 source.ActivateVersion(lVersionString); 2254 pArg = vVersionSwitch ~ lVersionString; 2255 } 2256 else if(util.str.begins(pArg, "-fversion=") == True) { 2257 char[] lVersionString; 2258 2259 lVersionString=pArg [10 .. $]; 2260 source.ActivateVersion(lVersionString); 2261 pArg = vVersionSwitch ~ lVersionString; 2262 } 2263 2264 else if(pArg == "-fdebug") { 2520 lVersionString=pArg [vVersionSwitch.length .. $]; 2521 if (lVersionString.length > 0 && lVersionString[0] == '=') 2522 lVersionString = lVersionString[1..$]; 2523 if (lVersionString.length > 0) 2524 { 2525 source.ActivateVersion(lVersionString); 2526 } 2527 } 2528 else if(pArg == vDebugSwitch) 2529 { 2265 2530 source.ActivateDebug("1"); 2266 pArg = vDebugSwitch; 2267 } 2268 else if(pArg == "-debug") { 2269 source.ActivateDebug("1"); 2270 pArg = vDebugSwitch; 2271 } 2272 else if(util.str.begins(pArg, "-fdebug=") == True) { 2531 } 2532 else if(util.str.begins(pArg, vDebugSwitch) == True) 2533 { 2273 2534 char[] lDebugString; 2274 2535 2275 lDebugString=pArg [8 .. $]; 2276 source.ActivateDebug(lDebugString); 2277 pArg = vDebugSwitch ~ "=" ~ lDebugString; 2278 } 2279 else if(util.str.begins(pArg, "-debug=") == True) { 2280 char[] lDebugString; 2281 2282 lDebugString=pArg [7 .. $]; 2283 source.ActivateDebug(lDebugString); 2284 pArg = vDebugSwitch ~ "=" ~ lDebugString; 2536 lDebugString = pArg [vDebugSwitch.length .. $]; 2537 if (lDebugString.length > 0 && lDebugString[0] == '=') 2538 lDebugString = lDebugString[1..$]; 2539 if (lDebugString.length > 0) 2540 { 2541 source.ActivateDebug(lDebugString); 2542 } 2285 2543 } 2286 2544 … … 2403 2661 { 2404 2662 if (pArg[0] == '-') { 2405 if (pArg == "-g")2663 if (pArg == vGenDebugInfo) 2406 2664 { 2407 2665 // Requires symbolic debug info. 2408 vLinkerDef Switches ~= "/co";2666 vLinkerDefs ~= vSymInfoSwitch; 2409 2667 AddCompilerArg(pArg); 2410 2668 break; … … 2427 2685 } 2428 2686 2687 if (util.str.begins(pArg, "-CFG=") == True) 2688 { 2689 char[] lFile; 2690 char[] lSubSection; 2691 char[][] lLocalArgs; 2692 lFile = pArg[5..$]; 2693 lSubSection = ""; 2694 if (auto m = std.regexp.search(lFile, "(.*)\\[(.*)\\]") ) 2695 { 2696 lSubSection = m.match(2); 2697 lFile = m.match(1); 2698 } 2699 version(BuildVerbose) 2700 { 2701 ProcessOneBuildConfig("+" ~ lSubSection, vVerbose, lFile, lLocalArgs); 2702 } else { 2703 ProcessOneBuildConfig("+" ~ lSubSection, False, lFile, lLocalArgs); 2704 } 2705 vBuildArgs ~= pArg; 2706 ExamineArgs(lLocalArgs); 2707 break; 2708 } 2709 2710 // Check if a list of modules has been requested. 2711 if (util.str.IsLike(pArg, "-modules*"d) == True) 2712 { 2713 vSymbols = True; 2714 if (pArg.length > 8) 2715 { 2716 if (pArg[8] == '=' || pArg[8] == ':') 2717 // drop off leading delimiter. 2718 vSymbolOutName = pArg[9..$]; 2719 else 2720 vSymbolOutName = pArg[8..$]; 2721 } 2722 else 2723 { 2724 vSymbolOutName = pArg[8..$]; 2725 } 2726 vBuildArgs ~= pArg; 2727 // Not passed thru. 2728 break; 2729 } 2730 2429 2731 // Test for alternate install locations. 2430 2732 if (util.str.IsLike(pArg, "-DCPATH?*"d) == True) 2431 2733 { 2432 lNewPath = pArg[7..length].dup; 2433 if (vCompilerPath == vConfigPath) 2734 char[] lNewPath = pArg[7..length].dup; 2735 if (util.str.ends(lNewPath, std.path.sep) == False) 2736 lNewPath ~= std.path.sep; 2737 version(BuildVerbose) 2738 { 2739 if (vVerbose == True) 2740 writefln("DCPATH was %s now %s", vCompilerPath, lNewPath); 2741 } 2742 vCompilerPath = lNewPath; 2743 util.str.SetEnv("@D", std.path.getDirName(vCompilerPath)); 2744 vBuildArgs ~= pArg; 2745 break; 2746 2747 } 2748 2749 if (util.str.IsLike(pArg, "-CFPATH?*"d) == True) 2750 { 2751 char[] lNewPath = pArg[7..length].dup; 2752 if (util.str.ends(lNewPath, std.path.sep) == False) 2753 lNewPath ~= std.path.sep; 2754 version(BuildVerbose) 2434 2755 { 2435 2756 if (vVerbose == True) 2436 2757 writefln("CFPATH was %s now %s", vConfigPath, lNewPath); 2437 vConfigPath = lNewPath; 2438 } 2439 if (vVerbose == True) 2440 writefln("DCPATH was %s now %s", vCompilerPath, lNewPath); 2441 vCompilerPath = lNewPath; 2758 } 2759 vOverrideConfigPath = lNewPath; 2442 2760 vBuildArgs ~= pArg; 2761 util.str.SetEnv("@P", std.path.getDirName(vOverrideConfigPath)); 2443 2762 break; 2444 2763 2445 2764 } 2446 2765 2447 if (util.str.IsLike(pArg, "-CFPATH?*"d) == True)2448 {2449 if (vVerbose == True)2450 writefln("CFPATH was %s now %s", vConfigPath, pArg[7..length]);2451 vConfigPath = pArg[7..length].dup;2452 vBuildArgs ~= pArg;2453 break;2454 2455 }2456 2457 2766 if (util.str.IsLike(pArg, "-PP?*"d) == True) 2458 2767 { 2459 char[] lNewPath; 2460 lNewPath = pArg[3..length].dup; 2461 if (vVerbose == True) 2462 writefln("Added %s to Source Scan List", lNewPath); 2768 char[] lNewPath = pArg[3..length].dup; 2769 version(BuildVerbose) 2770 { 2771 if (vVerbose == True) 2772 writefln("Added %s to Source Scan List", lNewPath); 2773 } 2774 2463 2775 vBuildArgs ~= pArg; 2464 2776 if ( util.str.ends(lNewPath, std.path.sep) == False) … … 2471 2783 if (util.str.IsLike(pArg, "-RDF?*"d) == True) 2472 2784 { 2473 if (vVerbose == True) 2474 writefln("RDF was %s now %s", vRDFName, pArg[4..$]); 2785 version(BuildVerbose) 2786 { 2787 if (vVerbose == True) 2788 writefln("RDF was %s now %s", vRDFName, pArg[4..$]); 2789 } 2790 2475 2791 vRDFName = pArg[4..$].dup; 2476 2792 vBuildArgs ~= pArg; … … 2479 2795 } 2480 2796 2481 if (pArg == vBuildImportPathSwitch) 2797 if (util.str.IsLike(pArg, "-MDF?*"d) == True) 2798 { 2799 version(BuildVerbose) 2800 { 2801 if (vVerbose == True) 2802 writefln("MDF was %s now %s", vDefMacroDefFile, pArg[4..$]); 2803 } 2804 2805 vDefMacroDefFile = pArg[4..$].dup; 2806 vBuildArgs ~= pArg; 2807 break; 2808 2809 } 2810 2811 if (pArg == vBuildImportPath) 2482 2812 { 2483 2813 vDelayedValue = &lImportSwitch; … … 2485 2815 break; 2486 2816 } 2487 else if ( util.str.begins(pArg, vBuildImportPath Switch) == True)2817 else if ( util.str.begins(pArg, vBuildImportPath) == True) 2488 2818 { 2489 2819 char [] lRoot; 2490 foreach(char[] lCmdRoot; std.string.split(pArg[vBuildImportPathSwitch.length .. $], ";")) 2820 foreach(char[] lCmdRoot; std.string.split(pArg[vBuildImportPath.length .. $], 2821 vImportPathDelim)) 2491 2822 { 2492 2823 lRoot = AddRoot(lCmdRoot); 2493 if (lRoot.length > 0){ 2494 if(vVerbose == True) { 2824 if (lRoot.length > 0) 2825 { 2826 version(BuildVerbose) 2827 { 2828 if(vVerbose == True) 2495 2829 writefln("Added root from command line = %s",lRoot); 2496 2830 } … … 2509 2843 2510 2844 2845 if (util.str.IsLike(pArg, "-UMB*"d) == True) 2846 { 2847 2848 vBuildArgs ~= pArg; 2849 if (pArg.length == 4) 2850 vUseModBaseName = true; 2851 else 2852 { 2853 char lValue; 2854 if (pArg[4] == '=' || pArg[4] == ':') 2855 if (pArg.length > 5) 2856 lValue = pArg[5]; 2857 else 2858 lValue = 'Y'; 2859 2860 vUseModBaseName = 2861 (lValue == 'y' || 2862 lValue == 'Y'); 2863 } 2864 Source.UseModBaseName(vUseModBaseName); 2865 break; 2866 } 2511 2867 // Special check for Object Write Path 2512 2868 version(DigitalMars) 2513 2869 { 2514 if (util.str.IsLike(pArg, std.utf.toUTF32(v TemporaryPathSwitch ~ "*")) == True)2870 if (util.str.IsLike(pArg, std.utf.toUTF32(vOutputPath ~ "*")) == True) 2515 2871 { 2516 2872 char[] lRoot; 2517 2873 2518 vTemporaryPath = pArg[v TemporaryPathSwitch.length .. $];2874 vTemporaryPath = pArg[vOutputPath.length .. $]; 2519 2875 if (vTemporaryPath.length > 0 && vTemporaryPath[$-1..$] != std.path.sep) 2520 2876 vTemporaryPath ~= std.path.sep; … … 2522 2878 lRoot = AddRoot(vTemporaryPath); 2523 2879 if (lRoot.length > 0){ 2524 if(vVerbose == True) { 2880 version(BuildVerbose) 2881 { 2882 if(vVerbose == True) 2525 2883 writefln("Added root from Object Write Path = %s",lRoot); 2526 2884 } … … 2581 2939 if (util.str.IsLike(pArg, "-R*"d) == True) 2582 2940 { 2583 // Response file usage (eg. -Ry) 2941 char lValue; 2942 // Response file usage (eg. -R=Yes) 2584 2943 if (pArg.length == 2) 2585 2944 vUseResponseFile = ~vUseResponseFile; 2586 2945 2587 else if (pArg[2] == 'y')2588 vUseResponseFile = True;2589 2590 2946 else 2591 vUseResponseFile = False; 2592 2947 { 2948 if (pArg.length == 3) 2949 lValue = pArg[2]; 2950 else 2951 { 2952 if (pArg[2] == '=' || pArg[2] == ':') 2953 lValue = pArg[3]; 2954 else 2955 lValue = pArg[2]; 2956 } 2957 2958 if (lValue == 'y' || lValue == 'Y') 2959 vUseResponseFile = True; 2960 else 2961 vUseResponseFile = False; 2962 } 2593 2963 vBuildArgs ~= pArg; 2594 2964 break; … … 2632 3002 lRoot = AddRoot(lCmdRoot); 2633 3003 if (lRoot.length > 0){ 2634 if(vVerbose == True) { 3004 version(BuildVerbose) 3005 { 3006 if(vVerbose == True) 2635 3007 writefln("Added root from command line = %s",lRoot); 2636 3008 } … … 2653 3025 pArg = std.string.replace(pArg, "/", std.path.sep); 2654 3026 } 2655 switch(std.path.getExt(pArg)) { 2656 case "": 2657 pArg ~= "." ~ kSrcExtention; 3027 3028 auto lArgExt = std.path.getExt(pArg); 3029 if (lArgExt == "") 3030 { 3031 pArg ~= "." ~ vSrcExtention; 2658 3032 vCmdLineSourceFiles ~= pArg; 2659 break;2660 2661 case kSrcExtention:2662 case kMacroExtention:2663 case kDdocExtention:3033 } 3034 else if (lArgExt == vSrcExtention || 3035 lArgExt == vMacroExtention || 3036 lArgExt == vDdocExtention) 3037 { 2664 3038 vCmdLineSourceFiles ~= pArg; 2665 break; 2666 2667 default: 3039 } 3040 else if (lArgExt == vResponseExt) 3041 { 3042 } 3043 else 3044 { 2668 3045 AddLink(GetFullPathname(pArg)); 2669 3046 } 2670 if(vTargetName is null) { 3047 3048 if(vTargetName is null && 3049 ((std.path.getExt(pArg) == vSrcExtention) || 3050 (std.path.getExt(pArg) == vMacroExtention) 3051 ) 3052 ) 3053 { 2671 3054 vTargetName = pArg; 3055 version(BuildVerbose) 3056 { 3057 if(vVerbose == True) 3058 writefln("Default target is '%s'", std.path.getName(vTargetName)); 3059 } 2672 3060 } 2673 3061 } … … 2677 3065 } 2678 3066 2679 void GatherOneArg( char[] pArg)3067 bool GatherOneArg( char[] pArg, inout char[][] pArgGroup ) 2680 3068 { 2681 3069 static bool[char[]] lKnownArgs; 3070 bool lMergeArg = false; 2682 3071 <
