aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-12-14 10:29:40 +0100
committerGitHub <[email protected]>2017-12-14 10:29:40 +0100
commitebe6e8a7fa591b31c1378106173a4ebb8a2b16de (patch)
tree00a858bab0cda5bd1b5fbc31469f232aec9597e3 /lib/compiler
parent9f229208baa457f9a5979dedf2d8094d5c9af53a (diff)
parentd455cf67203c29354ff792ea44aea09e7a2155f8 (diff)
downloadotp-ebe6e8a7fa591b31c1378106173a4ebb8a2b16de.tar.gz
otp-ebe6e8a7fa591b31c1378106173a4ebb8a2b16de.tar.bz2
otp-ebe6e8a7fa591b31c1378106173a4ebb8a2b16de.zip
Merge pull request #1653 from tonyrog/makedep_side_effect
Add -MMD option to erlc OTP-14830
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/doc/src/compile.xml9
-rw-r--r--lib/compiler/src/compile.erl18
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml
index b398871ddf..06afc55c07 100644
--- a/lib/compiler/doc/src/compile.xml
+++ b/lib/compiler/doc/src/compile.xml
@@ -233,6 +233,15 @@ module.beam: module.erl \
header.hrl</code>
</item>
+ <tag><c>makedep_side_effect</c></tag>
+ <item>
+ <p>The dependecies are created as a side effect to the
+ normal compilation process. This means that the object
+ file will also be produced. This option override the
+ <c>makedep</c> option.
+ </p>
+ </item>
+
<tag><c>{makedep_output, Output}</c></tag>
<item>
<p>Writes generated rules to <c>Output</c> instead of the
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index f963d9a480..770aa2c6c1 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -203,7 +203,12 @@ expand_opts(Opts0) ->
{_,_,undefined} -> [debug_info|Opts0];
{_,_,_} -> Opts0
end,
- foldr(fun expand_opt/2, [], Opts).
+ %% iff,unless processing is to complex...
+ Opts1 = case proplists:is_defined(makedep_side_effect,Opts) of
+ true -> proplists:delete(makedep,Opts);
+ false -> Opts
+ end,
+ foldr(fun expand_opt/2, [], Opts1).
expand_opt(basic_validation, Os) ->
[no_code_generation,to_pp,binary|Os];
@@ -674,6 +679,7 @@ select_list_passes_1([], _, Acc) ->
standard_passes() ->
[?pass(transform_module),
+ {iff,makedep_side_effect,?pass(makedep_and_output)},
{iff,makedep,[
?pass(makedep),
{unless,binary,?pass(makedep_output)}
@@ -1128,6 +1134,16 @@ core_lint_module(Code, St) ->
errors=St#compile.errors ++ Es}}
end.
+%% makedep + output and continue
+makedep_and_output(Code0, St) ->
+ {ok,DepCode,St1} = makedep(Code0,St),
+ case makedep_output(DepCode, St1) of
+ {ok,_IgnoreCode,St2} ->
+ {ok,Code0,St2};
+ {error,St2} ->
+ {error,St2}
+ end.
+
makedep(Code0, #compile{ifile=Ifile,ofile=Ofile,options=Opts}=St) ->
%% Get the target of the Makefile rule.