Erlang -- make

User's Guide
Reference Manual
Release Notes
PDF
Top

Tools
Reference Manual
Version 2.8.6

Expand All
Contract All

Table of Contents

- cover
  - Top of manual page
  - analyse/0
  - analyse/1
  - analyse/2
  - analyse/1
  - analyse/1
  - analyse/2
  - analyse/3
  - analyse/2
  - analyse_to_file/0
  - analyse_to_file/1
  - analyse_to_file/2
  - analyse_to_file/1
  - async_analyse_to_file/1
  - async_analyse_to_file/2
  - async_analyse_to_file/3
  - async_analyse_to_file/2
  - compile/1
  - compile/2
  - compile_beam/1
  - compile_beam_directory/0
  - compile_beam_directory/1
  - compile_directory/0
  - compile_directory/1
  - compile_directory/2
  - compile_module/1
  - compile_module/2
  - export/1
  - export/2
  - flush/1
  - import/1
  - imported/0
  - imported_modules/0
  - is_compiled/1
  - modules/0
  - reset/0
  - reset/1
  - start/0
  - start/1
  - stop/0
  - stop/1
  - which_nodes/0
- cprof
  - Top of manual page
  - analyse/0
  - analyse/1
  - analyse/1
  - analyse/2
  - pause/0
  - pause/1
  - pause/2
  - pause/3
  - restart/0
  - restart/1
  - restart/2
  - restart/3
  - start/0
  - start/1
  - start/2
  - start/3
  - stop/0
  - stop/1
  - stop/2
  - stop/3
- eprof
  - Top of manual page
  - analyze/0
  - analyze/1
  - analyze/2
  - log/1
  - profile/1
  - profile/2
  - profile/1
  - profile/2
  - profile/3
  - profile/4
  - profile/5
  - profile/6
  - start/0
  - start_profiling/1
  - start_profiling/2
  - start_profiling/3
  - stop/0
  - stop_profiling/0
- erlang.el
- fprof
  - Top of manual page
  - analyse/0
  - analyse/1
  - analyse/2
  - analyse/1
  - analyse/1
  - apply/2
  - apply/3
  - apply/3
  - apply/4
  - profile/0
  - profile/1
  - profile/2
  - profile/1
  - profile/1
  - start/0
  - stop/0
  - stop/1
  - trace/1
  - trace/2
  - trace/1
  - trace/2
  - trace/1
  - trace/2
  - trace/1
- instrument
  - Top of manual page
  - allocator_descr/2
  - block_header_size/1
  - class_descr/2
  - descr/1
  - holes/1
  - mem_limits/1
  - memory_data/0
  - memory_status/1
  - read_memory_data/1
  - read_memory_status/1
  - sort/1
  - store_memory_data/1
  - store_memory_status/1
  - sum_blocks/1
  - type_descr/2
  - type_no_range/1
- lcnt
  - Top of manual page
  - apply/1
  - apply/2
  - apply/3
  - clear/0
  - clear/1
  - collect/0
  - collect/1
  - conflicts/0
  - conflicts/1
  - information/0
  - inspect/1
  - inspect/2
  - load/1
  - locations/0
  - locations/1
  - pid/2
  - pid/3
  - port/1
  - port/2
  - rt_clear/0
  - rt_clear/1
  - rt_collect/0
  - rt_collect/1
  - rt_opt/2
  - rt_opt/1
  - save/1
  - start/0
  - stop/0
  - swap_pid_keys/0
- make
  - Top of manual page
  - all/0
  - all/1
  - files/1
  - files/2
- tags
  - Top of manual page
  - dir/1
  - dirs/1
  - file/1
  - files/1
  - root/1
  - subdir/1
  - subdirs/1
- xref
  - Top of manual page
  - add_application/2
  - add_directory/2
  - add_module/2
  - add_release/2
  - analyze/2
  - d/1
  - forget/1
  - forget/2
  - format_error/1
  - get_default/1
  - get_default/2
  - get_library_path/1
  - info/1
  - info/2
  - info/3
  - m/1
  - m/1
  - q/2
  - remove_application/2
  - remove_module/2
  - remove_release/2
  - replace_application/3
  - replace_module/3
  - set_default/3
  - set_default/2
  - set_library_path/2
  - start/2
  - start/1
  - stop/1
  - update/1
  - variables/1

# make

### MODULE

make

### MODULE SUMMARY

A Make Utility for Erlang

### DESCRIPTION

The module make provides a set of functions similar to the UNIX type Make functions.

### EXPORTS

all() -> up_to_date | error
all(Options) -> up_to_date | error

Types:

Options = [Option]
Option = noexec | load | netload | <compiler option>

This function first looks in the current working directory for a file named Emakefile (see below) specifying the set of modules to compile and the compile options to use. If no such file is found, the set of modules to compile defaults to all modules in the current working directory.

Traversing the set of modules, it then recompiles every module for which at least one of the following conditions apply:

- there is no object file, or
- the source file has been modified since it was last compiled, or,
- an include file has been modified since the source file was last compiled.

As a side effect, the function prints the name of each module it tries to compile. If compilation fails for a module, the make procedure stops and error is returned.

Options is a list of make- and compiler options. The following make options exist:

- noexec
  No execution mode. Just prints the name of each module that needs to be compiled.
- load
  Load mode. Loads all recompiled modules.
- netload
  Net load mode. Loads all recompiled modules on all known nodes.

All items in Options that are not make options are assumed to be compiler options and are passed as-is to compile:file/2. Options defaults to [].

files(ModFiles) -> up_to_date | error
files(ModFiles, Options) -> up_to_date | error

Types:

ModFiles = [Module | File]
Module = atom()
File = string()
Options = [Option]
Option = noexec | load | netload | <compiler option>

files/1,2 does exactly the same thing as all/0,1 but for the specified ModFiles, which is a list of module or file names. The file extension .erl may be omitted.

The Emakefile (if it exists) in the current directory is searched for compiler options for each module. If a given module does not exist in Emakefile or if Emakefile does not exist, the module is still compiled.

### Emakefile

make:all/0,1 and make:files/1,2 looks in the current working directory for a file named Emakefile. If it exists, Emakefile should contain elements like this:

    Modules.
    {Modules,Options}.

Modules is an atom or a list of atoms. It can be

- a module name, e.g. file1
- a module name in another directory, e.g. ../foo/file3
- a set of modules specified with a wildcards, e.g. 'file*'
- a wildcard indicating all modules in current directory, i.e. '*'
- a list of any of the above, e.g. ['file*','../foo/file3','File4']

Options is a list of compiler options.

Emakefile is read from top to bottom. If a module matches more than one entry, the first match is valid. For example, the following Emakefile means that file1 shall be compiled with the options [debug_info,{i,"../foo"}], while all other files in the current directory shall be compiled with only the debug_info flag.

    {'file1',[debug_info,{i,"../foo"}]}.
    {'*',[debug_info]}.