inaka / aleppo

Alternative Erlang Pre-Processor
MIT License
7 stars 5 forks source link

Add include relative to current file. #46

Closed seriyps closed 6 years ago

seriyps commented 6 years ago

Erlang docs http://erlang.org/doc/man/erlc.html are saying:

When encountering an -include or -include_lib directive, the compiler searches for header files in the following directories:

  • ".", the current working directory of the file server
  • The base name of the compiled file
  • The directories specified using option -I; the directory specified last is searched first

Here we implementing 2nd option for recursive includes (include inside another include)

$ tree
app1
- src
-- my_file.erl
app2
- include
-- my_header1.hrl
-- my_header2.hrl

$ cat app1/src/my_file.erl
-include_lib("app2/include/my_header1.hrl").

$ cat app2/include/my_header1.hrl
-include("my_header2").

$ cat app2/include/my_header2.hrl
-define(...).
jfacorro commented 6 years ago

Since this was merged into upstream and we are bringing those changes in #50, I will close this one.

seriyps commented 6 years ago

Thanks!