构建多个Erlang Beam文件?

Zub*_*air 20 erlang

我目前正在使用

c(module_name)
Run Code Online (Sandbox Code Playgroud)

逐个构建我的Erlang文件.如果Erlang的构建过程有多个文件,它们如何处理?

Chr*_*ian 25

我首先使用Erlang make,因为它启动VM一次并编译需要重新编译的所有内容.

在源目录中尝试以下操作,它将编译缺少相应Beam文件的.erl文件或自编译Beam文件以来修改.erl文件的文件:

erl -make
Run Code Online (Sandbox Code Playgroud)

了解有关其他技巧的Emakefile,例如使用debug_info编译所有源文件并将.beam文件放在ebin中:

{'*',
    [{outdir,"../ebin"},
    debug_info]}.
Run Code Online (Sandbox Code Playgroud)


小智 15

这将编译您当前所在目录中的所有内容:

cover:compile_directory().
Run Code Online (Sandbox Code Playgroud)


小智 5

很多项目使用常规的旧make文件和 erlc

erlc -h
Usage:  erlc [options] file.ext ...
Options:
-b type        type of output file (e.g. jam or beam)
-d             turn on debugging of erlc itself
-Dname         define name
-Dname=value   define name to have value
-hybrid        compile using hybrid-heap emulator
-help          shows this help text
-I path        where to search for include files
-o name        name output directory or file
-pa path       add path to the front of Erlang's code path
-pz path       add path to the end of Erlang's code path
-smp           compile using SMP emulator
-v             verbose compiler output
-Werror        make all warnings into errors
-W0            disable warnings
-Wnumber       set warning level to number
-Wall          enable all warnings
-W             enable warnings (default; same as -W1)
-E             generate listing of expanded code (Erlang compiler)
-S             generate assembly listing (Erlang compiler)
-P             generate listing of preprocessed code (Erlang compiler)
+term          pass the Erlang term unchanged to the compiler
Run Code Online (Sandbox Code Playgroud)