#!/bin/bash # Copyright 2016, Data61, CSIRO # # This software may be distributed and modified according to the terms of # the BSD 2-Clause license. Note that NO WARRANTY is provided. # See "LICENSE_BSD2.txt" for details. # # @TAG(DATA61_BSD) # Bash 'strict' mode set -euo pipefail IFS=$'\n\t' DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" function show_architectures () { ( cd "$DIR" ARCHES= shopt -s nullglob for EXE in */tokenizer; do ARCHES="$ARCHES ${EXE%/tokenizer}" done if [ -z "$ARCHES" ]; then echo "There are no standalone C-parser architectures currently built." echo "Try running 'make' in $DIR" else echo "Available architectures are:$ARCHES" echo "Please supply an architecture name as the first argument." fi ) exit 1 } if [ $# -eq 0 ]; then show_architectures fi ARCH="$1"; shift EXE="$DIR/$ARCH/tokenizer" if [ ! -x "$EXE" ]; then echo "Unknown architecture $ARCH" >&2 show_architectures fi exec "$EXE" "$@"