Documentation for Build v2.08
Table of Contents

Command Line

The build utility supplies the source file and optional switches via the command line.


The typical format of the build utility's command line is ...
 build <sourcefile> [ <switches> ] [ <otherfiles> ]
You can however specify the files and switches in any order you like.

Normally you would only supply a single file name to build, that being the source file of the top-level file in the application. Typically the one that has the 'main()' or 'WinMain()' function, though this is not strictly necessary.

If you run the utility without any files and without any switches, it display a help screen with some details about the switches. That looks like this ...

Path and Version : C:\Program Files\build.exe v3.6(339)
Usage: build sourcefile [options objectfiles libraries]
 sourcefile D source file
 -v         Verbose (passed through to D)
 -V         Verbose (NOT passed through)
 -names     Displays the names of the files used to build the target.
 -DCPATH<path> <path> is where the compiler has been installed.
Only needed if the compiler is not in the system's
PATH list. Used if you are testing an alternate
version of the compiler.
 -CFPATH<path> <path> is where the D config file has been installed.
 -full      Causes all source files, except ignored modules,
to be compiled.
 -link      Forces the linker to be called instead of the librarian.
(Only needed if the source files do not contain
 main/WinMain) 
 -nolink    Ensures that the linker is not called.
 (Only needed if main/WinMain is found in the source 
files and you do NOT want an executable created.)
 -lib       Forces the object files to be placed in a library.
 (Only needed if main/WinMain is found in the source 
files AND you want it in a library instead of
an executable.)
 -nolib     Ensures that the object files are not used to form
a library.
 (Only needed if main/WinMain is not found in the source 
files and you do NOT want a library.
 -obj       This is the same as having both -nolink and -nolib
switches on the command line. It is just a shorthand.
 -allobj    Ensures that all object files are added to a
library.
(Normally only those in the same directory are added.)
 -cleanup   Ensures that all object files created during the run
are removed at the end of the run, plus other work files.
 -clean     Same as -cleanup
 -test      Does everything as normal except it displays the commands
instead of running them. Also, the auto-build-numbers are
not incremented.
 -RDF<path>  Overrides the default Rule Definition File
 -gui[:x.y] Forces a GUI application to be created. The optional
:x.y can be used to build an application for a
specific version of Windows. eg. -gui:4.0
(Only needed if WinMain is not found in the source files
or if you wish to override the default Windows version)
 -dll       Forces a DLL library to be created.
(Only needed if DllMain is not found in the source files.
 -LIBOPT<opt> Allows you to pass <opt> to the librarian
 -LIBPATH=<pathlist> Used to add a semi-colon delimited list
of search paths for library files.
 -X<module> Packages and Modules to ignore (eg. -Xmylib)
 -M<module> Packages and Modules to notice (eg. -Mphobos)
 -T<targetname> The name of the target file to create. Normally
the target name istaken from the first or only name
of the command line.
 -R<y|n> Indicates whether to use a response file or command line
arguments with the compiler tools.
 -Ry will cause a response to be used.
 -Rn will cause command line arguments to be used.
 -R will reverse the current usage.
Note that the default for Windows DigitalMars is to use a response file
but for all other environments it is to use command line arguments.
 -info      Displays the version and path of the Build application
 -help      Displays the full 'usage' help text.
 -h         Same as -help, displays the full 'usage' help text.
 -?         Same as -help, displays the full 'usage' help text.
 -silent    Avoids unnecessary messages being displayed.
 -noautoimport Turns off the automatic addition of source paths
to the list of Import Roots.
 -od<path>  Nominate the directory where temporary (work) files
are to be created. By default they are created in
the same directory as the target file.
 -nodef     Prevents a Module Definition File being automatically created.
 This will override any pragma(/build_def) statements in the 
source code.
 [...]      All other options, objectfiles and libraries are
passed to the compiler

See also Response File