-
-
Notifications
You must be signed in to change notification settings - Fork 368
/
rdmd.dd
163 lines (120 loc) · 4.12 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
Ddoc
$(D_S rdmd,
$(H2 Synopsis)
In a command prompt:
$(CONSOLE > cat myprog.d)
---
import std.stdio;
void main()
{
writeln("Hello, world without explicit compilations!");
}
---
$(CONSOLE
\> rdmd myprog
Hello, world without explicit compilations!
)
Inside a D program:
$(CONSOLE > cat myprog.d)
---
#!/usr/bin/env rdmd
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}
---
$(CONSOLE
\> ./myprog.d
Hello, world with automated script running!
)
$(MESSAGE_BOX gray, $(B Windows): replace $(B cat) with $(B type) and $(B
#!/usr/bin/env rdmd) with $(B #!rdmd), the latter assuming that $(B rdmd)
can be found in your path.)
$(H2 Description)
$(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)
$(CONSOLE
$(B rdmd) [$(I dmd and rdmd options)] $(I progfile)[.d] [$(I program arguments)]
)
$(P In addition to $(LINK2 $(ROOT_DIR)dmd.html, `dmd`)'s options, $(B rdmd) recognizes the following:
)
$(DL
$(DT $(B --build-only)) $(DD just build the executable, don't run it. By default, the executable is placed into the source file directory)
$(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
---
void main(string[] args) { ... }
---
(multiple --eval allowed, will be
evaluated in turn))
$(DT $(B --exclude)=package) $(DD exclude a package from the build (multiple --exclude allowed))
$(DT $(B --include)=package) $(DD negate $(B --exclude) or a standard package (std, etc, core))
$(DT $(B --extra-file)=file) $(DD include an extra source or object in the compilation (multiple --extra-file allowed))
$(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
---
foreach (line; stdin.byLine()) { ... }
---
)
$(DT $(B --main)) $(DD add an empty
---
void main() {}
---
(useful for running unittests))
$(DT $(B --makedepend)) $(DD print dependencies in makefile format and exit)
$(DT $(B --man)) $(DD open web browser on manual page)
$(DT $(B --shebang)) $(DD rdmd is in a shebang line (put as first argument). Example:
$(CONSOLE > cat myprog.d)
---
#!/usr/bin/rdmd --shebang -version=test -O
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}
---
)
$(DT $(B --tmpdir)) $(DD use a different temporary directory)
)
$(H2 Download)
$(UL $(LI View syntax-colored $(LINK2
https://github.com/dlang/tools/blob/master/rdmd.d, source
code))
$(LI $(LINK2
https://raw.github.com/dlang/tools/master/rdmd.d,
Download)))
$(H2 Author)
$(LINK2 http://erdani.org/, Andrei Alexandrescu)
)
Macros:
TITLE=rdmd
SUBNAV=$(SUBNAV_CLI_REFERENCE)