| 1 |
Ddoc |
|---|
| 2 |
|
|---|
| 3 |
$(D_S rdmd, |
|---|
| 4 |
|
|---|
| 5 |
<h2>Synopsis</h2> |
|---|
| 6 |
|
|---|
| 7 |
In a command prompt: |
|---|
| 8 |
<pre> |
|---|
| 9 |
% cat myprog.d |
|---|
| 10 |
import std.stdio; |
|---|
| 11 |
void main() |
|---|
| 12 |
{ |
|---|
| 13 |
writeln("Hello, world without explicit compilations!"); |
|---|
| 14 |
} |
|---|
| 15 |
% rdmd myprog |
|---|
| 16 |
Hello, world without explicit compilations! |
|---|
| 17 |
% <blink>_</blink> |
|---|
| 18 |
</pre> |
|---|
| 19 |
|
|---|
| 20 |
Inside a D program: |
|---|
| 21 |
<pre> |
|---|
| 22 |
% cat myprog.d |
|---|
| 23 |
#!/usr/bin/rdmd |
|---|
| 24 |
import std.stdio; |
|---|
| 25 |
void main() |
|---|
| 26 |
{ |
|---|
| 27 |
writeln("Hello, world with automated script running!"); |
|---|
| 28 |
} |
|---|
| 29 |
% ./myprog.d |
|---|
| 30 |
Hello, world with automated script running! |
|---|
| 31 |
% <blink>_</blink> |
|---|
| 32 |
</pre> |
|---|
| 33 |
|
|---|
| 34 |
(Under Windows replace $(B cat) with $(B type) and $(B |
|---|
| 35 |
#!/usr/bin/rdmd) with $(B #!rdmd), the latter assuming that $(B rdmd) |
|---|
| 36 |
can be found in your path.) |
|---|
| 37 |
|
|---|
| 38 |
<h2>Description</h2> |
|---|
| 39 |
|
|---|
| 40 |
$(P $(B rdmd) is a companion to the $(B dmd) compiler that simplifies |
|---|
| 41 |
the typical edit-compile-link-run or edit-make-run cycle to a rapid |
|---|
| 42 |
edit-run cycle. Like $(B make) and other tools, $(B rdmd) uses the |
|---|
| 43 |
relative dates of the files involved to minimize the amount of work |
|---|
| 44 |
necessary. Unlike $(B make), $(B rdmd) tracks dependencies and |
|---|
| 45 |
freshness without requiring additional information from the user.) |
|---|
| 46 |
|
|---|
| 47 |
$(P $(B rdmd): $(UL |
|---|
| 48 |
|
|---|
| 49 |
$(LI shields its user from the notion that producing a running program |
|---|
| 50 |
from D programming language files may entail several concerted steps |
|---|
| 51 |
against different source files producing various intermediate files;) |
|---|
| 52 |
|
|---|
| 53 |
$(LI automatically infers and builds dependent files, transitively, by |
|---|
| 54 |
following $(B import) directives;) |
|---|
| 55 |
|
|---|
| 56 |
$(LI recognizes and passes down all of $(B dmd)'s command-line options;) |
|---|
| 57 |
|
|---|
| 58 |
$(LI understands how various $(B dmd) compiler options (e.g. $(B |
|---|
| 59 |
-release) vs. $(B -debug)) affect generation of intermediate files, |
|---|
| 60 |
and avoids conflations (e.g., does not unwittingly run a debug |
|---|
| 61 |
executable when the release executable is asked for);) |
|---|
| 62 |
|
|---|
| 63 |
$(LI recompiles files only on a needed basis, e.g. two invocations of |
|---|
| 64 |
$(B rdmd) in sequence without an intervening change to any relevant |
|---|
| 65 |
source file does not produce the executable again.) |
|---|
| 66 |
|
|---|
| 67 |
)) |
|---|
| 68 |
|
|---|
| 69 |
<h2>Usage</h2> |
|---|
| 70 |
|
|---|
| 71 |
$(P |
|---|
| 72 |
$(B rdmd) [$(I dmd and rdmd options)] $(I progfile)[.d] [$(I program arguments)] |
|---|
| 73 |
) |
|---|
| 74 |
|
|---|
| 75 |
$(P In addition to $(B dmd)'s options, $(B rdmd) recognizes the following: |
|---|
| 76 |
) |
|---|
| 77 |
|
|---|
| 78 |
$(DL |
|---|
| 79 |
|
|---|
| 80 |
$(DT $(B --build-only)) $(DD just build the executable, don't run it) |
|---|
| 81 |
|
|---|
| 82 |
$(DT $(B --chatty)) $(DD write dmd commands to stdout before executing |
|---|
| 83 |
them) |
|---|
| 84 |
|
|---|
| 85 |
$(DT $(B --compiler)=/path/to/compiler) $(DD use the specified |
|---|
| 86 |
compiler (e.g. gdmd) instead of dmd) |
|---|
| 87 |
|
|---|
| 88 |
$(DT $(B --dry-run)) $(DD do not compile, just show what commands |
|---|
| 89 |
would be run (implies --chatty)) |
|---|
| 90 |
|
|---|
| 91 |
$(DT $(B --eval)=code) $(DD evaluate code including it in $(D_PARAM |
|---|
| 92 |
void main(char[][] args) { ... }) (multiple --eval allowed, will be |
|---|
| 93 |
evaluated in turn)) |
|---|
| 94 |
|
|---|
| 95 |
$(DT $(B --force)) $(DD force a rebuild even if apparently not |
|---|
| 96 |
necessary) |
|---|
| 97 |
|
|---|
| 98 |
$(DT $(B --help)) $(DD show a help message and exit) |
|---|
| 99 |
|
|---|
| 100 |
$(DT $(B --loop)=code) $(DD like --eval, but code will be additionally |
|---|
| 101 |
included in a loop $(D_PARAM foreach (line; stdin.byLine()) { ... })) |
|---|
| 102 |
|
|---|
| 103 |
$(DT $(B --main)) $(DD add an empty $(D_PARAM void main() {}) function |
|---|
| 104 |
(useful for running unittests)) |
|---|
| 105 |
|
|---|
| 106 |
$(DT $(B --man)) $(DD open web browser on manual page) |
|---|
| 107 |
|
|---|
| 108 |
$(DT $(B --shebang)) $(DD rdmd is in a shebang line (put as first argument)) |
|---|
| 109 |
) |
|---|
| 110 |
|
|---|
| 111 |
<h2>Download</h2> |
|---|
| 112 |
|
|---|
| 113 |
$(UL $(LI View syntax-colored $(LINK2 |
|---|
| 114 |
http://dsource.org/projects/phobos/browser/trunk/tools/rdmd.d, source |
|---|
| 115 |
code)) |
|---|
| 116 |
|
|---|
| 117 |
$(LI $(LINK2 |
|---|
| 118 |
http://dsource.org/projects/phobos/browser/trunk/tools/rdmd.d?format=txt, |
|---|
| 119 |
Download))) |
|---|
| 120 |
|
|---|
| 121 |
<h2>Author</h2> |
|---|
| 122 |
|
|---|
| 123 |
$(LINK2 http://erdani.org, Andrei Alexandrescu) |
|---|
| 124 |
) |
|---|
| 125 |
|
|---|
| 126 |
Macros: |
|---|
| 127 |
TITLE=rdmd |
|---|
| 128 |
WIKI=rdmd |
|---|