diff options
author | Tony Rogvall <[email protected]> | 2017-12-06 02:28:29 +0100 |
---|---|---|
committer | Tony Rogvall <[email protected]> | 2017-12-06 02:28:29 +0100 |
commit | d455cf67203c29354ff792ea44aea09e7a2155f8 (patch) | |
tree | c7d09e1bbb1cd628fe9c9d70f99d6de1acee9785 /lib/compiler/src/compile.erl | |
parent | ad484fc2003885e12b92ea49dcb1c71669761d62 (diff) | |
download | otp-d455cf67203c29354ff792ea44aea09e7a2155f8.tar.gz otp-d455cf67203c29354ff792ea44aea09e7a2155f8.tar.bz2 otp-d455cf67203c29354ff792ea44aea09e7a2155f8.zip |
Add -MMD option to erlc
The compile option makedep_side_effect, erlc -MMD, instructs
the compiler to emit dependencies and continue to compile
as normal.
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r-- | lib/compiler/src/compile.erl | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 327fecf0e6..ad57eae855 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. |