# A version of \`make\` that supports (almost) all Erlang source types

**URL:** <https://erlangforums.com/t/a-version-of-make-that-supports-almost-all-erlang-source-types/5222>\
**Category:** Proposals: Ideas\
**Tags:** erlang, compile, make\
**Created:** [November 10, 2025, 2:10pm UTC](https://erlangforums.com/t/a-version-of-make-that-supports-almost-all-erlang-source-types/5222 "2025-11-10T14:10:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![uwiger](https://erlangforums.com/user_avatar/erlangforums.com/uwiger/32/274_2.png) [@uwiger](https://erlangforums.com/u/uwiger)\
**Post date:** [November 10, 2025, 2:10pm UTC](https://erlangforums.com/t/a-version-of-make-that-supports-almost-all-erlang-source-types/5222/1 "2025-11-10T14:10:13Z")

</div>

I decided to make a fairly small extension to the `make` module:

> <https://github.com/erlang/otp/pull/10360>
>
> This extension makes it possible to use \`make\` to compile almost all source file… types supported by \`erlc\`. The exception is \`idl\` files, which have somewhat complex output.
> 
> The change is backwards-compatible, such that any time extensions are omitted, \`.erl\` is assumed, and the same logic as before is used. If the extension is given (and other than \`.erl\`), the work is passed to \`erl\_compile:compile(Args, CWD)\`, where \`Args\` is given by the new \`make\` option \`{erlc, Args}\`, and is a string, such as would have been given to the \`erlc\` command. Modification timestamps are compared as for \`.erl\`/\`.beam\` pairs, but using the list of supported file types in \`erl\_compile:extensions()\`.
> 
> Furthermore, a new load option, \`autoload\` is introduced. This is the default when running \`erl -make\`, and allows each \`Emakefile\` line to specify a load option (\`load\` or \`netload\`). This allows for parse-transform modules to be compiled and loaded selectively for use by later steps in the \`Emakefile\`.

It addresses two limitations that I’ve personally found a bit annoying:

- It supports all file types that can be built using `erlc` (except `.idl`)
- It allows for selective loading of compiled modules in the `Emakefile`

The latter is useful if you have parse-transforms. E.g.

```erlang
uwmbp:plain_fsm uwiger$ cat Emakefile
{“src/plain_fsm_xform.erl”, [debug_info, {i, “include/”}, {outdir, “ebin/”}, load]}.
{“src/*”, [debug_info, {i, “include/”}, {outdir, “ebin/”}]}.

uwmbp:plain_fsm uwiger$ erl -make
Recompile: src/plain_fsm_xform
Recompile: src/plain_fsm
Recompile: src/fsm_example
src/fsm_example.erl: undefined parse transform ‘plain_fsm_xform’

```

With the suggested change:

`uwmbp:plain_fsm uwiger$ ~/git/otp/bin/erl -make`  
`Recompile: src/plain_fsm_xform.erl`  
`Recompile: src/plain_fsm.erl`  
`Recompile: src/fsm_example.erl`  
`src/fsm_example.erl:26:2: Warning: behaviour plain_fsm undefined`  
`% 26| -behaviour(plain_fsm).`  
`% | ^`

(The behavior warning is a different, path-related, issue)

Re. the first item, it seems reasonable to me that Erlang’s `make` should support at least the different source types supported by `erlc`. This is a minimalistic way of achieving that.

From the test suite:

`uwmbp:non_erl uwiger$ mkdir out`  
`uwmbp:non_erl uwiger$ ls out/`  
`uwmbp:non_erl uwiger$ cat Emakefile`  
`{“../calx_{lexer,parser}.?rl”, [{erlc, “-o out”}]}.`  
`uwmbp:non_erl uwiger$ $ERL_TOP/bin/erl -make`  
`Recompile: ../calx_parser.yrl`  
`Recompile: ../calx_lexer.xrl`  
`uwmbp:non_erl uwiger$ ls out/`  
`calx_lexer.erl	calx_parser.erl`
