From 394ba26d1d7acd395eb5075c211fd8aed8489a12 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 26 Jun 2024 17:59:04 +0200 Subject: [PATCH] ext_mod: Support to compile nested *.erl, and include other deps *.hrl This is useful to compile as a dependency https://github.com/deadtrickster/prometheus.erl --- src/ext_mod.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ext_mod.erl b/src/ext_mod.erl index fb7d5d438..fcf6fb172 100644 --- a/src/ext_mod.erl +++ b/src/ext_mod.erl @@ -594,15 +594,15 @@ compile_deps(LibDir) -> compile(LibDir) -> Bin = filename:join(LibDir, "ebin"), - Inc = filename:join(LibDir, "include"), Lib = filename:join(LibDir, "lib"), Src = filename:join(LibDir, "src"), - Options = [{outdir, Bin}, {i, Inc} | compile_options()], + Includes = [{i, Inc} || Inc <- filelib:wildcard(LibDir++"/../../**/include")], + Options = [{outdir, Bin}, {i, LibDir++"/.."} | Includes ++ compile_options()], filelib:ensure_dir(filename:join(Bin, ".")), [copy(App, Bin) || App <- filelib:wildcard(Src++"/*.app")], compile_c_files(LibDir), Er = [compile_erlang_file(Bin, File, Options) - || File <- filelib:wildcard(Src++"/*.erl")], + || File <- filelib:wildcard(Src++"/**/*.erl")], Ex = [compile_elixir_file(Bin, File) || File <- filelib:wildcard(Lib ++ "/**/*.ex")], compile_result(lists:flatten([Er, Ex])).