Admin/bash_process/build
changeset 62293 72f6d6fd5853
parent 49447 bec1add86e79
child 62566 fe02dcee9493
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/bash_process/build	Sat Feb 13 17:27:23 2016 +0100
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+#
+# Multi-platform build script
+
+THIS="$(cd "$(dirname "$0")"; pwd)"
+PRG="$(basename "$0")"
+
+
+# diagnostics
+
+function usage()
+{
+  echo
+  echo "Usage: $PRG TARGET"
+  echo
+  exit 1
+}
+
+function fail()
+{
+  echo "$1" >&2
+  exit 2
+}
+
+
+# command line args
+
+[ "$#" -eq 0 ] && usage
+TARGET="$1"; shift
+
+[ "$#" -eq 0 ] || usage
+
+
+# main
+
+mkdir -p "$TARGET"
+
+case "$TARGET" in
+  x86_64-linux | x86_64-darwin)
+    cc -m64 bash_process.c -o "$TARGET/bash_process"
+    ;;
+  x86-linux | x86-darwin)
+    cc -m32 bash_process.c -o "$TARGET/bash_process"
+    ;;
+  x86-cygwin)
+    cc bash_process.c -o "$TARGET/bash_process.exe"
+    ;;
+  *)
+    cc bash_process.c -o "$TARGET/bash_process"
+    ;;
+esac