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