[erlang-questions] Patch to produce dependencies Makefile with erlc(1)

Jean-Sébastien Pédron <>
Sat Jul 7 01:43:08 CEST 2007


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

Hello,

GCC's preprocessor offers a collection of flags to output Makefiles
which describe sources dependencies. For instance, if hello.c includes
hello.h, the preprocessor will output a Makefile like this:

hello.o: hello.c hello.h

Obviously, if hello.h is modified, hello.c will be recompiled.

Automake uses this feature to track dependencies (but needs more than
that to handle Erlang sources :)

I made a patch that add a subset of GCC flag to compiler(3) and erlc(1).
Supported flags are:

    -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).
    -MP         add a phony target for each dependency.
    -MD         same as -M -MT file.Pbeam

I ignored the following GCC flag, but some may be useful:

    -MM         ignore system headers
    -MG         consider missing headers as generated files and add the
                to the dependencies
    -MMD        same as -MD but ignore system headers

You'll find more details in GCC documentation. Here for gcc 4.2.0:
http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Preprocessor-Options.html#Preprocessor-Options

The patch was tested with R11B-5 on FreeBSD and Linux.

Best regards,

- --
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.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGjtOMa+xGJsFYOlMRAqX5AJ91wJhgcevith6qBluoJA+/qSKnsQCfR3U8
4HysS/IYSlsnqLGoIHcBpHY=
=ltGv
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: otp_src_R11B-5-makedep-a.patch
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070707/de7848b7/attachment.ksh>


More information about the erlang-questions mailing list