[erlang-questions] Configuring rebar across directories

Fred Hebert mononcqc@REDACTED
Wed May 29 16:26:24 CEST 2013


Hi,

Usually the structure would be to have your module that stands on its
own as a library application -- an OTP application that contains all the
usual metadata in its .app file, except for the {mod, _} tuple, which is
absent. This will let Erlang/OTP see it as an OTP application.

All these applications can be put in your path if they're in a
directory (say deps/ and apps/) by adding them to the ERL_LIBS env
variable in any of the following ways:

$ export ERL_LIBS=`pwd`/deps/:`pwd`/apps/:$ERL_LIBS
$ erl

$ ERL_LIBS=`pwd`/deps/:`pwd`/apps/:$ERL_LIBS erl ...

$ erl -env ERL_LIBS `pwd`/deps/:`pwd`/apps/

and so on.

Then the file can be accessed by any library by using
-include_lib("my_library_app/include/file.hrl").

ERL_LIBS and how it works with other OTP applications is something more
people should be aware of, and that thing is much simpler than
hardcoding paths or whatever.

Regards,
Fred.

On 05/29, yashgt@REDACTED wrote:
> <p>I have<br />myapp<br /> /src<br /> myapp.erl<br /> myapp_sup.erl<br /> /include<br />and <br />mymodule<br /> /src<br /> mymodule.erl<br /> /include<br /> mymodule.hrl</p>
> <p>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?</p>
> <p>Currently, when I compile myapp, it gives an error that the mymoduel.hrl cannot be found.</p>
> <p>My intention is to develop mymodule as a shared module across several apps.</p>
> <p>Thanks,<br />Yash</p>

> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list