[erlang-patches] Producing dependencies Makefile for Erlang using erlc(1)

David Sveningsson <>
Mon Apr 27 11:31:48 CEST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul Fisher wrote:
> Did anything ever happen with this patch?  I would love to see such a 
> thing added to erlc, since for better or worse, we do use .hrl files for 
> record and guard definitions pretty heavily.
> 
> 
> --
> paul

I would also like to see this functionality added. Currently I use
grep+sed magic to create dependency rules.

> Jean-Sébastien Pédron wrote:
> Hello,
> 
> When using erlc(1) and standard Makefiles to compile Erlang source
> files, there's currently no way to track header dependencies. Thus, if a
> header is modified, a module that depends on it will be recompiled only
> if the dependency is explicitly indicated in the Makefile. This becomes
> problematic when the header is external (for instance, a header from
> another application, such as xmerl.hrl).
> 
> Attached is a patch that adds support for producing dependencies
> Makefiles to erlc(1) and compiler(3). It was modeled after GCC.
> 
> For example, let's take the following module:
>     -module(mod1).
>     -include("header1.hrl").
>     ...
> 
> The command "erlc -M mod1.erl" will output:
>     mod1.beam: mod1.erl header1.hrl
> 
> The patch adds the following options to erlc(1) and compiler(3):
> 
>     -M          generate a rule describing dependencies; output on
>                 stdout.
>     -MF File    rule(s) is(are) written to `File'.
>     -MT Target  change the name of the rule emitted.
>     -MQ Target  same as -MT but quote special characters for make(1).
>     -MG         consider missing headers as generated files and add the
>                 to the dependencies
>     -MP         add a phony target for each dependency.
>     -MD         same as -M -MT file.Pbeam
> 
> They're the same as GCC. The following options are not supported:
> 
>     -MM         ignore system headers
>     -MMD        same as -MD but ignore system headers
> 
> I choose to keep the same names as GCC because I'm working on Erlang
> support in Automake and it wants to use these options. Regarding
> compiler(3), options could have a more Erlang-fashion name.
> 
> The patch, against R12B-4, includes the documentation updates. But I
> don't know how to make it, so it's untested.
> 
> Thanks,
> 
> PS: I already sent an older patch to erlang-questions@ more than a year
> ago. The attached patch obsoletes it.
> 
>>

> _______________________________________________
> erlang-patches mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-patches

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkn1e4QACgkQ6pa1H/H5pqW7HACgqkP7+KjU/jyA9aWpWuiXcRzp
VR4Anjc5ykYROfiJOpJ+NS82OkUrO0eg
=C8ul
-----END PGP SIGNATURE-----



More information about the erlang-patches mailing list