Kevin Albrecht
Kevin Albrecht

Reputation: 7014

Wildcards in erlc's -I option?

Is it possible to use wildcards in the Erlang compiler's -I option?

For example, I want to do something like this:

erlc -I deps/*/include -I deps src/foo.erl

I know that other solutions exist (like using rebar or make) but in this case, I am looking explicitly at erlc.

Upvotes: 1

Views: 217

Answers (1)

Kijewski
Kijewski

Reputation: 26022

In Linux (and other unixoid systems) wildcards are never resolved by the invoked program. The shell you use (e.g. bash) resolves all wildcards. So erlc won't see the the asterix at all. (If you read the documentation of find(1) you may find that my previous explanation is somewhat oversimplified.)

If you don't want to use an extra tool (I'd recommend looking at rebar oder make, though), you could try:

erlc $(find deps -name include -exec echo '-I {}' ';') -I deps src/foo.erl

(Weak substitute, I know.)

Upvotes: 2

Related Questions