Fix changewindowattributes opcode
[llpp.git] / doocaml.sh
blobd78d8a771edfbb01b2d4182c9e9f6eefb356ef16
1 #!/bin/sh
2 set -e
4 compiler="$1"
5 out="$2"
6 in="$3"
7 outdir="$(dirname "$out")"
8 srcdir="$(pwd -P)"
10 shift 3
12 incs=""
13 pp=""
14 extractpp ()
16 test $# -eq 0 || {
17 case "$1" in
18 "-I")
19 shift
20 incs="$incs -I $1"
22 "-pp")
23 shift
24 pp="$1"
26 esac
27 shift
28 extractpp "$@"
31 extractpp "$@"
33 dodep ()
35 (cd >/dev/null $srcdir && ocamldep.opt $1 $(basename $in)) | \
36 (sed >$objdir/$out.d \
37 -e "/.cmx/d" \
38 -e 's;\([[:alnum:]\.]\+\);'$outdir'/\1;g' \
39 -e '/:$/d')
42 test "x" = "x$pp" || {
43 ef=$(mktemp)
44 trap 'test -n "$ef" && rm -f "$ef"' 0
45 (cd >/dev/null $outdir && $compiler 2>$ef "$@" -o $out $in)
46 rc=$?
47 if test "$rc" != 0; then
48 sed 1>&2 "s;File \"\([^\"]*\)\"\(.*\)$;File $in\2;" $ef
49 else
50 dodep -pp $pp
52 exit $rc
53 } && {
54 (cd >/dev/null $outdir && $compiler "$@" -o $out $in) && dodep