diff options
author | Loïc Hoguin <[email protected]> | 2015-06-06 15:35:10 +0300 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-06-06 15:35:10 +0300 |
commit | ff56b5a89e2574915ef00f637d69da34fe31b570 (patch) | |
tree | 94e8cfa80e29a7100bb930c82d7aa47b5af5a1dc /core/deps.mk | |
parent | e197f6532f3926898208e15b7cb1da5a9849187f (diff) | |
download | erlang.mk-ff56b5a89e2574915ef00f637d69da34fe31b570.tar.gz erlang.mk-ff56b5a89e2574915ef00f637d69da34fe31b570.tar.bz2 erlang.mk-ff56b5a89e2574915ef00f637d69da34fe31b570.zip |
Improve parse_transform and import detection
Necessary changes for the alog application.
Diffstat (limited to 'core/deps.mk')
-rw-r--r-- | core/deps.mk | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/deps.mk b/core/deps.mk index c86621a..dc5e6e6 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -214,8 +214,13 @@ define dep_autopatch_rebar.erl end(), FindFirst = fun(F, Fd) -> case io:parse_erl_form(Fd, undefined) of - {ok, {attribute, _,compile, {parse_transform, PT}}, _} -> + {ok, {attribute, _, compile, {parse_transform, PT}}, _} -> [PT, F(F, Fd)]; + {ok, {attribute, _, compile, CompileOpts}, _} when is_list(CompileOpts) -> + case proplists:get_value(parse_transform, CompileOpts) of + undefined -> [F(F, Fd)]; + PT -> [PT, F(F, Fd)] + end; {ok, {attribute, _, include, Hrl}, _} -> case file:open("$(DEPS_DIR)/$(1)/include/" ++ Hrl, [read]) of {ok, HrlFd} -> [F(F, HrlFd), F(F, Fd)]; @@ -228,6 +233,11 @@ define dep_autopatch_rebar.erl {ok, {attribute, _, include_lib, "$(1)/include/" ++ Hrl}, _} -> {ok, HrlFd} = file:open("$(DEPS_DIR)/$(1)/include/" ++ Hrl, [read]), [F(F, HrlFd), F(F, Fd)]; + {ok, {attribute, _, include_lib, Hrl}, _} -> + case file:open("$(DEPS_DIR)/$(1)/include/" ++ Hrl, [read]) of + {ok, HrlFd} -> [F(F, HrlFd), F(F, Fd)]; + _ -> [F(F, Fd)] + end; {ok, {attribute, _, import, {Imp, _}}, _} -> case file:open("$(DEPS_DIR)/$(1)/src/" ++ atom_to_list(Imp) ++ ".erl", [read]) of {ok, ImpFd} -> [Imp, F(F, ImpFd), F(F, Fd)]; |