Admin/exec_process/build
author wenzelm
Fri, 27 Apr 2012 20:10:09 +0200
changeset 47799 0d5773841bc4
child 47801 a832454c4003
permissions -rwxr-xr-x
multi-platform build script and component settings;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47799
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     2
#
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     3
# Multi-platform build script
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     4
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     5
THIS="$(cd "$(dirname "$0")"; pwd)"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     6
PRG="$(basename "$0")"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     7
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     8
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
     9
# diagnostics
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    10
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    11
function usage()
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    12
{
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    13
  echo
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    14
  echo "Usage: $PRG TARGET"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    15
  echo
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    16
  exit 1
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    17
}
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    18
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    19
function fail()
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    20
{
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    21
  echo "$1" >&2
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    22
  exit 2
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    23
}
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    24
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    25
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    26
# command line args
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    27
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    28
[ "$#" -eq 0 ] && usage
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    29
TARGET="$1"; shift
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    30
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    31
[ "$#" -eq 0 ] || usage
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    32
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    33
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    34
# main
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    35
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    36
mkdir -p "$TARGET"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    37
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    38
case "$TARGET" in
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    39
  x86_64-linux)
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    40
    cc -m64 exec_process.c -o "$TARGET/exec_process"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    41
    ;;
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    42
  x86-linux)
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    43
    cc -m32 exec_process.c -o "$TARGET/exec_process"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    44
    ;;
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    45
  x86-cygwin)
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    46
    cc exec_process.c -o "$TARGET/exec_process.exe"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    47
    ;;
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    48
  *)
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    49
    cc exec_process.c -o "$TARGET/exec_process"
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    50
    ;;
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    51
esac
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    52
0d5773841bc4 multi-platform build script and component settings;
wenzelm
parents:
diff changeset
    53