Skip to content

Instantly share code, notes, and snippets.

@jordwalke
Created April 15, 2014 08:05
Show Gist options
  • Save jordwalke/10712353 to your computer and use it in GitHub Desktop.
Save jordwalke/10712353 to your computer and use it in GitHub Desktop.
General OCaml Build
#!/bin/sh
set -e
# Just make sure there's a file called fileName.ml in the same directory
TARGET=fileName
# Disabling duplicate record warning (30) and non-opened record field names (40)
FLAGS="-libs unix,nums -cflags -w,-30,-w,-40"
OCAMLBUILD=ocamlbuild
ocb()
{
$OCAMLBUILD $FLAGS $*
}
rule() {
case $1 in
clean) ocb -clean;;
native) ocb $TARGET.native;;
byte) ocb $TARGET.byte;;
all) ocb $TARGET.native $TARGET.byte;;
depend) echo "Not needed.";;
*) echo "Unknown action $1";;
esac;
}
if [ $# -eq 0 ]; then
rule all
else
while [ $# -gt 0 ]; do
rule $1;
shift
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment