aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorOleksiy Kebkal <[email protected]>2017-01-05 11:52:46 +0100
committerLoïc Hoguin <[email protected]>2017-04-25 15:54:03 +0200
commit094ece5472c07b50c38d7d6f369fbf6f97968a89 (patch)
tree280b45493108b5ff53689051036807d2589786c4 /core
parentf638c36f5c6ca817bf9cc69d54ef785d2867e5d5 (diff)
downloaderlang.mk-094ece5472c07b50c38d7d6f369fbf6f97968a89.tar.gz
erlang.mk-094ece5472c07b50c38d7d6f369fbf6f97968a89.tar.bz2
erlang.mk-094ece5472c07b50c38d7d6f369fbf6f97968a89.zip
core/erlc.mk: added src subfolders support in makedep.erl
Diffstat (limited to 'core')
-rw-r--r--core/erlc.mk17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/erlc.mk b/core/erlc.mk
index 8a8aea0..2545467 100644
--- a/core/erlc.mk
+++ b/core/erlc.mk
@@ -188,7 +188,12 @@ define makedep.erl
(F, Mod, include_lib, "$1/include/" ++ Hrl) -> AddHd(F, Mod, "include/" ++ Hrl);
(F, Mod, include_lib, Hrl) -> AddHd(F, Mod, "include/" ++ Hrl);
(F, Mod, import, {Imp, _}) ->
- case filelib:is_file("src/" ++ atom_to_list(Imp) ++ ".erl") of
+ IsFile =
+ case lists:keyfind(Imp, 1, Modules) of
+ false -> false;
+ {_, FilePath} -> filelib:is_file(FilePath)
+ end,
+ case IsFile of
false -> ok;
true -> Add(Mod, Imp)
end;
@@ -212,9 +217,17 @@ define makedep.erl
end || F <- ErlFiles],
Depend = sofs:to_external(sofs:relation_to_family(sofs:relation(ets:tab2list(E)))),
CompileFirst = [X || X <- lists:reverse(digraph_utils:topsort(G)), [] =/= digraph:in_neighbours(G, X)],
+ TargetPath = fun(Target) ->
+ case lists:keyfind(Target, 1, Modules) of
+ false -> "";
+ {_, DepFile} ->
+ DirSubname = tl(string:tokens(filename:dirname(DepFile), "/")),
+ string:join(DirSubname ++ [atom_to_list(Target)], "/")
+ end
+ end,
ok = file:write_file("$(1)", [
[[F, "::", [[" ", D] || D <- Deps], "; @touch \$$@\n"] || {F, Deps} <- Depend],
- "\nCOMPILE_FIRST +=", [[" ", atom_to_list(CF)] || CF <- CompileFirst], "\n"
+ "\nCOMPILE_FIRST +=", [[" ", TargetPath(CF)] || CF <- CompileFirst], "\n"
]),
halt()
endef