summaryrefslogtreecommitdiff
path: root/build
blob: 4fca642e40e581c240a2d234e7acd1b58328327a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

FLAGS=
OCAMLBUILD=ocamlbuild
CFG=config/coq_config.ml
MYCFG=myocamlbuild_config.ml

export CAML_LD_LIBRARY_PATH=`pwd`/_build/kernel/byterun

check_config() {
 [ -f $CFG ] || (echo "please run ./configure first"; exit 1)
 [ -L $MYCFG ] || ln -sf $CFG $MYCFG
}

# NB: we exec ocamlbuild and run ocb last for a correct exit code

ocb() { exec $OCAMLBUILD $FLAGS $*; }

rule() {
  check_config
  case $1 in
    clean)  rm -rf bin/* $MYCFG && ocb -clean;;
    all)    ocb coq.otarget;;
    win32)  ocb coq-win32.otarget;;
    *)      ocb $1;;
  esac;
}

if [ $# -eq 0 ]; then
  rule all
else
  while [ $# -gt 0 ]; do
    rule $1;
    shift
  done
fi