Admin/bash_process/build
author paulson <lp15@cam.ac.uk>
Mon Jun 11 22:43:33 2018 +0100 (14 months ago)
changeset 68420 529d6b132c27
parent 66691 a8703e8ee1d3
permissions -rwxr-xr-x
tidier Cauchy proofs
wenzelm@47799
     1
#!/usr/bin/env bash
wenzelm@47799
     2
#
wenzelm@47799
     3
# Multi-platform build script
wenzelm@47799
     4
wenzelm@47799
     5
THIS="$(cd "$(dirname "$0")"; pwd)"
wenzelm@47799
     6
PRG="$(basename "$0")"
wenzelm@47799
     7
wenzelm@47799
     8
wenzelm@47799
     9
# diagnostics
wenzelm@47799
    10
wenzelm@47799
    11
function usage()
wenzelm@47799
    12
{
wenzelm@47799
    13
  echo
wenzelm@47799
    14
  echo "Usage: $PRG TARGET"
wenzelm@47799
    15
  echo
wenzelm@47799
    16
  exit 1
wenzelm@47799
    17
}
wenzelm@47799
    18
wenzelm@47799
    19
function fail()
wenzelm@47799
    20
{
wenzelm@47799
    21
  echo "$1" >&2
wenzelm@47799
    22
  exit 2
wenzelm@47799
    23
}
wenzelm@47799
    24
wenzelm@47799
    25
wenzelm@47799
    26
# command line args
wenzelm@47799
    27
wenzelm@47799
    28
[ "$#" -eq 0 ] && usage
wenzelm@47799
    29
TARGET="$1"; shift
wenzelm@47799
    30
wenzelm@47799
    31
[ "$#" -eq 0 ] || usage
wenzelm@47799
    32
wenzelm@47799
    33
wenzelm@47799
    34
# main
wenzelm@47799
    35
wenzelm@47799
    36
mkdir -p "$TARGET"
wenzelm@47799
    37
wenzelm@47799
    38
case "$TARGET" in
wenzelm@47801
    39
  x86_64-linux | x86_64-darwin)
wenzelm@62566
    40
    cc -Wall -m64 bash_process.c -o "$TARGET/bash_process"
wenzelm@47799
    41
    ;;
wenzelm@47801
    42
  x86-linux | x86-darwin)
wenzelm@62566
    43
    cc -Wall -m32 bash_process.c -o "$TARGET/bash_process"
wenzelm@47799
    44
    ;;
wenzelm@66691
    45
  x86_64-cygwin | x86-cygwin)
wenzelm@62566
    46
    cc -Wall bash_process.c -o "$TARGET/bash_process.exe"
wenzelm@47799
    47
    ;;
wenzelm@47799
    48
  *)
wenzelm@62566
    49
    cc -Wall bash_process.c -o "$TARGET/bash_process"
wenzelm@47799
    50
    ;;
wenzelm@47799
    51
esac