« Return to Thread: Producing dependencies Makefile for Erlang using erlc(1)

Re: Producing dependencies Makefile for Erlang using erlc(1)

by Paul Fisher-3 :: Rate this Message:

Reply to Author | View in Thread

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

Jean-Sébastien Pédron wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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.
>
> - --
> Jean-Sébastien Pédron
> http://www.dumbbell.fr/
>
> PGP Key: http://www.dumbbell.fr/pgp/pubkey.asc
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (FreeBSD)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkkIfWAACgkQa+xGJsFYOlP9swCdGsB6Ydsa6yTz3dLijCeyFAGh
> NzgAoMAsrNe2oEan+1ItXO+IuRVuSNwU
> =GOml
> -----END PGP SIGNATURE-----
>

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

 « Return to Thread: Producing dependencies Makefile for Erlang using erlc(1)