1
<?xml version="1.0" encoding="latin1" ?>
2
<!DOCTYPE comref SYSTEM "comref.dtd">
9
<holder>Ericsson AB, All Rights Reserved</holder>
12
The contents of this file are subject to the Erlang Public License,
13
Version 1.1, (the "License"); you may not use this file except in
14
compliance with the License. You should have received a copy of the
15
Erlang Public License along with this software. If not, it can be
16
retrieved online at http://www.erlang.org/.
18
Software distributed under the License is distributed on an "AS IS"
19
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
20
the License for the specific language governing rights and limitations
23
The Initial Developer of the Original Code is Ericsson AB.
27
<prepared>Björn Gustavsson</prepared>
28
<responsible>Bjarne Däcker</responsible>
30
<approved>Bjarne Däcker</approved>
34
<file>erlc.sgml</file>
37
<comsummary>Compiler</comsummary>
39
<p>The <c><![CDATA[erlc]]></c> program provides a common way to run
40
all compilers in the Erlang system.
41
Depending on the extension of each input file, <c><![CDATA[erlc]]></c>
42
will invoke the appropriate compiler.
43
Regardless of which compiler is used, the same flags are used to provide parameters such as include paths and output directory.</p>
48
<name>erlc flags file1.ext file2.ext...</name>
49
<fsummary>Compile files</fsummary>
51
<p><c><![CDATA[Erlc]]></c> compiles one or more files.
52
The files must include the extension, for example <c><![CDATA[.erl]]></c>
53
for Erlang source code, or <c><![CDATA[.yrl]]></c> for Yecc source code.
54
<c><![CDATA[Erlc]]></c> uses the extension to invoke the correct compiler.</p>
60
<title>Generally Useful Flags</title>
61
<p>The following flags are supported:
64
<tag>-I <em>directory</em></tag>
66
<p>Instructs the compiler to search for include files in
67
the specified directory. When encountering an
68
<c><![CDATA[-include]]></c> or <c><![CDATA[-include_dir]]></c> directive, the
69
compiler searches for header files in the following
73
<p><c><![CDATA["."]]></c>, the current working directory of the
77
<p>the base name of the compiled file;</p>
80
<p>the directories specified using the <c><![CDATA[-I]]></c> option.
81
The directory specified last is searched first.</p>
85
<tag>-o <em>directory</em></tag>
87
<p>The directory where the compiler should place the output files.
88
If not specified, output files will be placed in the current working
91
<tag>-D<em>name</em></tag>
93
<p>Defines a macro.</p>
95
<tag>-D<em>name</em>=<em>value</em></tag>
97
<p>Defines a macro with the given value.
98
The value can be any Erlang term.
99
Depending on the platform, the value may need to be
100
quoted if the shell itself interprets certain characters.
101
On Unix, terms which contain tuples and list
102
must be quoted. Terms which contain spaces
103
must be quoted on all platforms.</p>
105
<tag>-W<em>number</em></tag>
107
<p>Sets warning level to <em>number</em>. Default is <c><![CDATA[1]]></c>.
108
Use <c><![CDATA[-W0]]></c> to turn off warnings.</p>
112
<p>Same as <c><![CDATA[-W1]]></c>. Default.</p>
116
<p>Enables verbose output.</p>
118
<tag>-b <em>output-type</em></tag>
120
<p>Specifies the type of output file.
121
Generally, <em>output-type</em> is the same as the file extension
122
of the output file but without the period.
123
This option will be ignored by compilers that have a
124
a single output format.</p>
128
<p>Compile using the hybrid-heap emulator. This is mainly useful
129
for compiling native code, which needs to be compiled with the same
130
run-time system that it should be run on.</p>
134
<p>Compile using the SMP emulator. This is mainly useful
135
for compiling native code, which needs to be compiled with the same
136
run-time system that it should be run on.</p>
140
<p>Signals that no more options will follow.
141
The rest of the arguments will be treated as file names,
142
even if they start with hyphens.</p>
144
<tag>+<em>term</em></tag>
146
<p>A flag starting with a plus ('<em>+</em>') rather than a hyphen
147
will be converted to an Erlang term and passed unchanged to
149
For instance, the <c><![CDATA[export_all]]></c> option for the Erlang
150
compiler can be specified as follows:</p>
152
erlc +export_all file.erl</pre>
153
<p>Depending on the platform, the value may need to be
154
quoted if the shell itself interprets certain characters.
155
On Unix, terms which contain tuples and list
156
must be quoted. Terms which contain spaces
157
must be quoted on all platforms.</p>
163
<title>Special Flags</title>
164
<p>The flags in this section are useful in special situations
165
such as re-building the OTP system.</p>
167
<tag>-pa <em>directory</em></tag>
169
<p>Appends <em>directory</em> to the front of the code path in
170
the invoked Erlang emulator.
171
This can be used to invoke another
172
compiler than the default one.</p>
174
<tag>-pz <em>directory</em></tag>
176
<p>Appends <em>directory</em> to the code path in
177
the invoked Erlang emulator.</p>
183
<title>Supported Compilers</title>
187
<p>Erlang source code. It generates a <c><![CDATA[.beam]]></c> file.</p>
188
<p>The options -P, -E, and -S are equivalent to +'P',
189
+'E', and +'S', except that it is not necessary to include the single quotes to protect them
191
<p>Supported options: -I, -o, -D, -v, -W, -b.</p>
195
<p>Yecc source code. It generates an <c><![CDATA[.erl]]></c> file.</p>
196
<p>Use the -I option with the name of a file to use that file
197
as a customized prologue file (the <c><![CDATA[includefile]]></c> option).</p>
198
<p>Supported options: -o, -v, -I, -W (see above).</p>
202
<p>MIB for SNMP. It generates a <c><![CDATA[.bin]]></c> file.</p>
203
<p>Supported options: -I, -o, -W.</p>
207
<p>A compiled MIB for SNMP. It generates a <c><![CDATA[.hrl]]></c> file.</p>
208
<p>Supported options: -o, -v.</p>
212
<p>Script file. It generates a boot file.</p>
213
<p>Use the -I to name directories to be searched for application
214
files (equivalent to the <c><![CDATA[path]]></c> in the option list for
215
<c><![CDATA[systools:make_script/2]]></c>).</p>
216
<p>Supported options: -o.</p>
221
<p>Creates an <c><![CDATA[.erl]]></c>, <c><![CDATA[.hrl]]></c>, and <c><![CDATA[.asn1db]]></c> file from
222
an <c><![CDATA[.asn1]]></c> file. Also compiles the <c><![CDATA[.erl]]></c> using the Erlang
223
compiler unless the <c><![CDATA[+noobj]]></c> options is given.</p>
224
<p>Supported options: -I, -o, -b, -W.</p>
229
<p>Runs the IDL compiler.</p>
230
<p>Supported options: -I, -o.</p>
236
<title>Environment Variables</title>
238
<tag>ERLC_EMULATOR</tag>
239
<item>The command for starting the emulator.
240
Default is <em>erl</em> in the same directory as the <em>erlc</em> program
241
itself, or if it doesn't exist, <em>erl</em> in any of the directories
242
given in the <em>PATH</em> environment variable.</item>
247
<title>SEE ALSO</title>
248
<p><seealso marker="erl">erl(1)</seealso>,
249
<seealso marker="compiler:compile">compile(3)</seealso>,
250
<seealso marker="parsetools:yecc">yecc(3)</seealso>,
251
<seealso marker="snmp:snmp">snmp(3)</seealso></p>