From 9caffaf31737ca2b67ffcf4fc52cefdb38ae7414 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Senior=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Thu, 8 Mar 2018 09:57:15 +0900 Subject: [PATCH] Introduce run (#41) This commit introduces 'run' script which will serve as an entry point for various utility scripts. This commit also introduces 'build' command as an example. Signed-off-by: Jonghyun Park --- run | 22 ++++++++++++++++++++++ scripts/command/build | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100755 run create mode 100644 scripts/command/build diff --git a/run b/run new file mode 100755 index 0000000..2fe577b --- /dev/null +++ b/run @@ -0,0 +1,22 @@ +#!/bin/bash + +COMMAND=$1; shift + +if [[ -z "${COMMAND}" ]]; then + echo "USAGE: $0 [COMMAND] ..." + exit 255 +fi + +NNFW_PROJECT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NNFW_COMMAND_RPATH="scripts/command" + +NNFW_COMMAND_FILE="${NNFW_PROJECT_PATH}/${NNFW_COMMAND_RPATH}/${COMMAND}" + +if [[ ! -f "${NNFW_COMMAND_FILE}" ]]; then + echo "ERROR: '${COMMAND}' is not supported" + exit 255 +fi + +export NNFW_PROJECT_PATH + +source "${NNFW_COMMAND_FILE}" "$@" diff --git a/scripts/command/build b/scripts/command/build new file mode 100644 index 0000000..5219001 --- /dev/null +++ b/scripts/command/build @@ -0,0 +1,7 @@ +#!/bin/bash + +# NOTE 'run' sets NNFW_PROJECT_PATH and invokes this script + +# TODO Support command-line options +# TODO Implement build steps inside this script +make -C "${NNFW_PROJECT_PATH}" -- 2.7.4