Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4972182
  • 博文数量: 921
  • 博客积分: 16037
  • 博客等级: 上将
  • 技术积分: 8469
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-05 02:08
文章分类

全部博文(921)

文章存档

2020年(1)

2019年(3)

2018年(3)

2017年(6)

2016年(47)

2015年(72)

2014年(25)

2013年(72)

2012年(125)

2011年(182)

2010年(42)

2009年(14)

2008年(85)

2007年(89)

2006年(155)

分类: Erlang

2015-01-31 16:31:12

erlc

命令

erlc

概要

编译器

描述

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:
下面的标记都支持:


-I directory Instructs the compiler to search for include files in the specified directory. When encountering an-include or -include_dir directive, the compiler searches for header files in the following directories:
指示编译器在指定的目录去查找include文件.编译器每碰到一个 -include或-include_dir标记, 就会在其后指定的目录中查找头文件.
  1. ".", the current working directory of the file server;
    ".", 当前工作目录
  2. the base name of the compiled file;

  3. the directories specified using the -I option. The directory specified last is searched first.
    -I 选项指定目录, 最后指定的目录,却最先被查找.
-o directory The directory where the compiler should place the output files. If not specified, output files will be placed in the current working directory. 
编译器输出文件的目录.如果没定义,输出文件将放置在当前工作目录.
-Dname Defines a macro. 
定义一条宏.
-Dname=value Defines a macro with the given value. The value can be any Erlang term. 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. 
定义一条拥有给定值的宏. 这个值可以是任意Erlang项.根据平台,如果shell自身会解释特定的字符,这个值可能需要用引号标注.在Unix中, 包含元组和list的项必须用引号标注. 有空格的项在所有平台,都得用引号标注.
-Wnumber Sets warning level to number. Default is 1. Use -W0 to turn off warnings. 
将警告级别定义为number级. 默认为1. 用-W0关闭警告. -W Same as -W1. Default. 
和 -W1意义一样.默认的. -v Enables verbose output.
打开详细输出
-b output-type Specifies the type of output file. Generally, output-type is the same as the file extension of the output file but without the period. This option will be ignored by compilers that have a a single output format. 
指定输入文件类型.一般output-type 如果输出类型只有一种,这个选项就会被忽略. -hybrid Compile using the hybrid-heap emulator. This is mainly useful for compiling native code, which needs to be compiled with the same run-time system that it should be run on.
用混合堆模拟器编译. 这对于编译原生代码很有用,同时还需要编译此原生代码能运行的运行时系统. -smp Compile using the SMP emulator. This is mainly useful for compiling native code, which needs to be compiled with the same run-time system that it should be run on. 
用SMP模拟器编译. 这对于编译原生代码很有用,同时还需要编译此原生代码能运行的运行时系统.
-- Signals that no more options will follow. The rest of the arguments will be treated as file names, even if they start with hyphens. 
告诉编译器之后没有选项了.它之后的参数全被当作文件名,尽管以连字符开头也一样.  (译注, 连字符-后面一般是编译器选项,但定义了这个之后,就不是选项了) +term A flag starting with a plus ('+') rather than a hyphen will be converted to an Erlang term and passed unchanged to the compiler. For instance, the export_all option for the Erlang compiler can be specified as follows: 
一个以加号 ('+')开头而不是连字符开头的选项,会被转义成一个Erlang项,且被原样传入编译器. 例如, Erlang 编译器的export_all选项可以写成如下形式: 
	
	
代码
  1. 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. 启动模拟器的命令. 默认erlerlc程序在同一目录, 如果此环境变量不存在, erlPATH环境变量给出的一个目录中.

另见

erl(1), compile(3), yecc(3), snmp(3) 原文链接

阅读(1760) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~