From dd3e666c5114f81c9518e9f5ba14959ced079ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Mon, 14 Dec 2009 23:04:00 +0100 Subject: Add dependencies Makefile generation to erlc(1) and compile(3) This is useful when a project is built with Makefiles and erlc(1) instead of EMakefiles. Tracking dependencies by hand is error-prone and it becomes painful when using external application headers like EUnit's one. A dependencies Makefile will look like this: module.beam: module.erl \ /usr/local/lib/erlang/lib/eunit-2.1.4/include/eunit.hrl \ header.hrl When included in the main Makefile, 'module' will be recompiled only when needed. GCC offers the same feature and new erlc(1) options are compatible with it. More informations at: http://wiki.github.com/dumbbell/otp/dependencies-makefile --- lib/compiler/doc/src/compile.xml | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'lib/compiler/doc/src') diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml index c3d65b4cb5..77f3e9b0be 100644 --- a/lib/compiler/doc/src/compile.xml +++ b/lib/compiler/doc/src/compile.xml @@ -164,6 +164,70 @@ for details.

+ makedep + +

Produce a Makefile rule to track headers dependencies. + No object file is produced. +

+

By default, this rule is written to + .Pbeam]]>. However, if the option + binary is set, nothing is written and the rule is + returned in Binary. +

+

For instance, if one has the following module: +

+ +-module(module). + +-include_lib("eunit/include/eunit.hrl"). +-include("header.hrl"). + +

Here is the Makefile rule generated by this option: +

+ +module.beam: module.erl \ + /usr/local/lib/erlang/lib/eunit/include/eunit.hrl \ + header.hrl + +
+ + {makedep_output, Output} + +

Write generated rule(s) to Output instead of the + default .Pbeam]]>. Output + can be a filename or an io_device(). To write to + stdout, use standard_io. However if binary + is set, nothing is written to Output and the + result is returned to the caller with + {ok, ModuleName, Binary}. +

+
+ + {makedep_target, Target} + +

Change the name of the rule emitted to Target. +

+
+ + makedep_quote_target + +

Characters in Target special to make(1) are quoted. +

+
+ + makedep_add_missing + +

Consider missing headers as generated files and add them to the + dependencies. +

+
+ + makedep_phony + +

Add a phony target for each dependency. +

+
+ 'P'

Produces a listing of the parsed code after preprocessing -- cgit v1.2.3