cduce_mktop 815 Bytes
Newer Older
1 2
#!/bin/sh

3
FLAGS=
4 5
LINK=
NATIVE=true
6 7 8 9 10 11 12 13 14 15

while true; do
 case "$1" in
   -I)
    FLAGS="$FLAGS -I $2"
    shift
    shift
    ;;
   -p)
    FLAGS="$FLAGS -I `ocamlfind query $2`"
16
    LINK="$LINK -package $2"
17 18 19
    shift
    shift
    ;;
20 21 22 23 24 25 26 27 28
   -l)
    LINK="$LINK $2"
    shift
    shift
    ;;
  -byte)
    NATIVE=false
    shift
    ;;
29 30 31 32 33 34
  *)
    break
    ;;
 esac
done

35 36 37 38
TARG=$1
PRIMS=$2

if [ "${TARG}" = "" ] || [ "${PRIMS}" = "" ]; then
39
  echo "Usage: cduce_mktop [(-I path | -p package | -l unit.cmo/cma/cmx/cmxa) ...] <target> <primitive file>"
40 41 42
  exit 2
fi

43 44 45 46 47 48 49 50 51 52

if [ ${NATIVE} = "true" ]; then
 CAML=ocamlopt
else
 CAML=ocamlc
fi

echo "Effective flags for CDuce: $FLAGS"
echo "Effective flags for OCaml: $LINK"

53
exec ocamlfind $CAML -package cduce -o $TARG $FLAGS -linkpkg -pp "cduce --topstub $FLAGS" $LINK -impl $PRIMS