[erlang-questions] Configuring rebar across directories

Tuncer Ayaz tuncer.ayaz@REDACTED
Tue Jun 18 13:40:16 CEST 2013

On Wed, May 29, 2013 at 3:58 PM,  <yashgt@REDACTED> wrote:
> I have
> myapp
> /src
> myapp.erl
> myapp_sup.erl
> /include
> and
> mymodule
> /src
> mymodule.erl
> /include
> mymodule.hrl
> As you can see, I have developed a module which is outside the
> structure of the myapp. If a module in myapp has to use the header
> files of mymodule, what do I need to do in the rebar.config of
> myapp?
> Currently, when I compile myapp, it gives an error that the
> mymoduel.hrl cannot be found.
> My intention is to develop mymodule as a shared module across
> several apps.

The usual way is to make mymodule part of ERL_LIBS and then

You can either configure the ERL_LIBS env var or {lib_dirs, []} in
rebar.config. Many projects put libs or apps in a separate apps/
directory and configure the top level rebar.config accordingly.
In your case that would be:
{lib_dirs, ["apps"]}.
{sub_dirs, ["apps/myapp", "apps/mymodule"]}.

Alternatively you can modify erl_opts (.erl compile opts) in
rebar.config to add extra include paths as follows, but this would be
unconventional and might be less flexible:
{erl_opts, [{i, "../mymodule/include"}]}.

For more help see compile(3)[1] or run 'rebar help compile'.

[1] http://www.erlang.org/doc/man/compile.html

More information about the erlang-questions mailing list