Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 108 lines (91 sloc) 2.491 kb
#! /bin/bash
###########################################################################
## ##
## OCamlClean ##
## ##
## Benoit Vaugon, Université Pierre et Marie Curie ##
## ##
## Ce fichier est distribué sous les termes de la licence CeCILL-B ##
## décrite dans le fichier LICENCE. ##
## ##
###########################################################################
function error () {
echo "$@" 1>&2
exit 1
}
function usage () {
echo "$@" 1>&2
error "Usage: $0 [ -prefix <dir> ] [ -bindir <dir> ] [ -mandir <dir> ]"
}
function check_command () {
which "$1" > /dev/null
if [ $? -ne 0 ]; then
error "Error: \"$1\" not installed"
fi
}
###
check_command "ocamlc"
check_command "ocamlopt"
check_command "ocamlbuild"
check_command "ocamldep"
check_command "mkdir"
check_command "rmdir"
check_command "chmod"
check_command "echo"
check_command "cat"
check_command "sed"
check_command "cp"
check_command "rm"
check_command "ar"
check_command "cp"
mkdir -p etc
###
OCAMLOPT=$(which ocamlopt.opt || which ocamlopt)
OCAMLC=$(which ocamlc.opt || which ocamlc)
OCAMLBUILD=$(which ocamlbuild)
VERSION=$(cat VERSION)
PWD=$(pwd)
###
BINDIR=/usr/local/bin
MANDIR=/usr/local/man/man1
while [ $# -ne 0 ]; do
case "$1" in
-bindir) BINDIR="$2"; shift ;;
-mandir) MANDIR="$2"; shift ;;
-prefix)
BINDIR="$2"/bin
MANDIR="$2"/man/man1
shift;;
*)
usage "Don't know what to do with \"$1\""
esac
shift
done
###
echo -n "\
BINDIR = $BINDIR
MANDIR = $MANDIR
OCAMLC = $OCAMLC -w Ae
OCAMLOPT = $OCAMLOPT -w Ae
OCAMLC_UNSAFE = $OCAMLC
OCAMLBUILD = $OCAMLBUILD -cflags -w,Ae -no-links
BIN = $PWD/bin
ETC = $PWD/etc
DIST = $PWD/dist
define compile
@make --no-print-directory -q -C \$1 && \
make --no-print-directory -C \$1 || \
make -C \$1
endef
define clean
@make --no-print-directory -C \$1 clean > /dev/null
endef
" > etc/Makefile.conf
###
echo -n "\
let ocamlc = \"$OCAMLC\"
let ocamlclean = \"$BINDIR/ocamlclean\"
let version = \"$VERSION\"
" > etc/config.ml
###
echo "** OCamlClean configuration completed successfully **"
Jump to Line
Something went wrong with that request. Please try again.