* Create new option, erlang-compile-outdir, which is concat'ed to the beam outdir...
[erlware-mode.git] / flymaker.sh
blobf3e403984ef99806353ba4c76343c9f1bb379db8
1 #!/usr/bin/env bash
3 dname (){ (cd $1 ; pwd); }
4 bdname(){ basename `dname $1`; }
6 # if our module lives here;
7 # .../a/b/<our module>
8 # we add these to include/load paths, respectively;
9 # .../*/include
10 # .../*/ebin
11 # note: the load path is used to resolve the -include_lib()"
12 Is=""
13 PAs=""
15 # $HOME/bla.erl
16 if [ `dname $2` == "$HOME" ]; then echo -n ""
18 # $HOME/bla/foo.erl or /bla/foo.erl
19 elif [ `bdname $2/..` == "$HOME" -o `bdname $2/..` == "/" ]; then echo -n ""
21 # $HOME/bla/src/foo.erl or /bla/src/foo.erl
22 elif [ `bdname $2/../..` == "HOME" -o `bdname $2/../..` == "/" ]; then
23 top=`dname $2/..`
24 Is="-I $top/include"
25 PAs="-pa $top/ebin"
27 # $HOME/lib/app/src/foo.erl or /erlang/app/src/foo.erl
28 else
29 top=`dname $2/../..`
30 for i in $top/*/include; do
31 Is="-I$i $Is"
32 done
33 for e in $top/*/ebin; do
34 PAs="-pa$e $PAs"
35 done
38 OUT=`dirname $1`
40 erlc -o $OUT $Is $PAs -Wall $1 | grep -v "list comprehension has no gene"
42 exit 0