Search code examples
erlang

Building multiple Erlang Beam files?


I am currently using

c(module_name)

to build my Erlang files one by one. How can the build process for Erlang be handle when they have multiple files?


Solution

  • Everyone should probably be using the official build tool for Erlang: rebar3. It did not exist when I provided this older answer:

    I start out by using Erlang make, because it starts the VM once and compiles everything that needs to be recompiled.

    Try the following in your source directory, it will compile those .erl files that are missing a corresponding Beam file or those where the .erl file has been modified since the Beam file was compiled:

    erl -make
    

    Learn about Emakefile for additional tricks, such as compiling all source files with debug_info and placing the .beam files in ebin:

    {'*',
        [{outdir,"../ebin"},
        debug_info]}.