Using the -M dependencies generator of erlc

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using the -M dependencies generator of erlc

Stavros Aronis
Hi!

I've been trying to make Dialyzer's makefile use the new functionality
added in R14B02 to erlc: "Dependency generation for Makefiles has been
added to the compiler and erlc. See the manual pages for compile and
erlc."

What I've already done can be checked here:
https://github.com/aronisstav/otp/commit/67e07a

What troubles me is whether this "heavy pollution" of the ebin
directory with .Pbeam files is really required for this to work. Is
there somewhere an example of how one can properly use this? If this
is the correct way, should I move the Pbeam exclusion rule to the root
.gitignore file?

Stavros Aronis
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Using the -M dependencies generator of erlc

Matthew Sackman-2
On Sun, Apr 03, 2011 at 12:48:51PM +0300, Stavros Aronis wrote:
> I've been trying to make Dialyzer's makefile use the new functionality
> added in R14B02 to erlc: "Dependency generation for Makefiles has been
> added to the compiler and erlc. See the manual pages for compile and
> erlc."

(Apologies for potentially hijacking this thread.)

As the man page says, this is only for tracking header dependencies,
which, IME, is at best only part of the story. Tracking behaviours and
parse_transformers are just as, if not more, important.

Eg, file state_t.erl:
-module(state_t, [InnerMonad]).
-compile({parse_transform, erlando}).

-behaviour(monad).

> erlc -pa ebin -M src/state_t.erl
state_t.beam: src/state_t.erl

I don't think so! Our generate_deps script correctly spits out:

ebin/state_t.beam: src/state_t.erl ebin/monad.beam ebin/erlando.beam

You may like to have a look at
http://hg.rabbitmq.com/erlando/file/default/Makefile and
http://hg.rabbitmq.com/erlando/file/default/generate_deps

(and yes, generate_deps also copes with headers, and you get just one
file of additional dependencies which you can then -include into your
Makefile).

Matthew
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Using the -M dependencies generator of erlc

Jean-Sébastien Pédron-4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

On 03.04.2011 11:59, Matthew Sackman wrote:
> As the man page says, this is only for tracking header dependencies,
> which, IME, is at best only part of the story. Tracking behaviours and
> parse_transformers are just as, if not more, important.

You're completly right. When I made the patch to add dependencies
tracking (2007), I didn't knew about parse transform and totally forget
the behaviours. I'll fix this when I have some spare time.

> (...) you get just one file of additional dependencies which you can
> then -include into your Makefile).

Concerning the "Pbeam pollution", I kept GCC's behaviour, because my
goal was to add Erlang support to automake and I didn't want to mess up
too much with automake's code.

I'll fix the -MF option to be able to write all rules to one Makefile
(or add another option).

Thanks for your feedbacks to both of you!

- --
Jean-Sébastien Pédron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2ZlpoACgkQa+xGJsFYOlNLwwCg0joG+rnyLNKrYGHnqt25UGO6
kFoAn2UiwBQqXTY32atT2IUfUs4AJfjJ
=d0Zt
-----END PGP SIGNATURE-----
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Using the -M dependencies generator of erlc

Matthew Sackman-2
On Mon, Apr 04, 2011 at 11:59:54AM +0200, Jean-Sébastien Pédron wrote:
> You're completly right. When I made the patch to add dependencies
> tracking (2007), I didn't knew about parse transform and totally forget
> the behaviours. I'll fix this when I have some spare time.

Cool. However, be very careful: some simple testing of mine over the
weekend shows that erlc -M needs the AST to get through the linter (and
other steps). If the source file depends on a parse transformer then
there's the possibility that whilst the AST of the source is formable,
it's entirely possible that without the parse transformer being run on
the AST, it won't get through subsequent stages of the compiler and make
it to the -M steps.

Thus I suspect the -M bits are in the wrong place and need to be move
much much higher up the chain, to a point pre any parse transformers or
anything like that has been run.

Best wishes,

Matthew
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions