全部博文(921)
分类: Erlang
2015-01-31 16:31:12
The erlc program provides a common way to run all compilers in the Erlang system. Depending on the extension of each input file, erlc will invoke the appropriate compiler. Regardless of which compiler is used, the same flags are used to provide parameters such as include paths and output directory.
erlc提供了一个公共的途径来运行Erlang系统的所有编译器. erlc会根据于各输入文件的扩展名,来调用合适的编译器.你无须关心哪个编译器被使用了.它们都使用相同的参数,例如include路径和输出目录.
Erlc compiles one or more files. The files must include the extension, for example .erl for Erlang source code, or .yrl for Yecc source code. Erlc uses the extension to invoke the correct compiler.
Erlc编译一个或一个以上文件.文件必须包括它们的扩展名.例如.erl代表Erlang源代码,而.yrl代表Yecc源代码.Erlc用扩展名来调用正确的编译器.
The following flags are supported:
下面的标记都支持:
代码
- erlc +export_all file.erl
Depending on the platform, the value may need to be quoted if the shell itself interprets certain characters. On Unix, terms which contain tuples and list must be quoted. Terms which contain spaces must be quoted on all platforms. 根据平台,如果shell自身会解释特定的字符,这个值可能需要用引号标注.在Unix中, 包含元组和list的项必须用引号标注. 有空格的项在所有平台,都得用引号标注.特殊标记
The flags in this section are useful in special situations such as re-building the OTP system. 此节的标记在特殊情况下有用,比如重编译OTP系统.
-pa directory Appends directory to the front of the code path in the invoked Erlang emulator. This can be used to invoke another compiler than the default one. -pz directory Appends directory to the code path in the invoked Erlang emulator.
支持的编译器
.erl Erlang source code. It generates a .beam file. The options -P, -E, and -S are equivalent to +'P', +'E', and +'S', except that it is not necessary to include the single quotes to protect them from the shell. Supported options: -I, -o, -D, -v, -W, -b. Erlang源文件.生成 .beam文件. .yrl Yecc source code. It generates an .erl file. Use the -I option with the name of a file to use that file as a customized prologue file (the includefileoption). Supported options: -o, -v, -I, -W (see above). .mib MIB for SNMP. It generates a .bin file. Supported options: -I, -o, -W. .bin A compiled MIB for SNMP. It generates a .hrl file. Supported options: -o, -v. .rel Script file. It generates a boot file. Use the -I to name directories to be searched for application files (equivalent to the path in the option list for systools:make_script/2). Supported options: -o. 脚本文件. 生成boot 文件. .asn1 ASN1 file. Creates an .erl, .hrl, and .asn1db file from an .asn1 file. Also compiles the .erl using the Erlang compiler unless the +noobj options is given. Supported options: -I, -o, -b, -W. .idl IC file. Runs the IDL compiler. Supported options: -I, -o.
环境变量
ERLC_EMULATOR The command for starting the emulator. Default is erl in the same directory as the erlc program itself, or if it doesn't exist, erl in any of the directories given in the PATH environment variable. 启动模拟器的命令. 默认erl与erlc程序在同一目录, 如果此环境变量不存在, erl在PATH环境变量给出的一个目录中.
另见
erl(1), compile(3), yecc(3), snmp(3) 原文链接