summaryrefslogtreecommitdiff
path: root/infra/nnfw/command/build
diff options
context:
space:
mode:
Diffstat (limited to 'infra/nnfw/command/build')
-rw-r--r--infra/nnfw/command/build24
1 files changed, 24 insertions, 0 deletions
diff --git a/infra/nnfw/command/build b/infra/nnfw/command/build
new file mode 100644
index 000000000..c9fe814c8
--- /dev/null
+++ b/infra/nnfw/command/build
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+import "build.configuration"
+
+if [[ ! -d "${BUILD_ALIAS}" ]]; then
+ echo "'${BUILD_ALIAS}' does not exist. Please run 'configure' first"
+ exit 255
+fi
+
+# Set parallel build
+# TODO Use argument instead of environment variable
+HOST_OS=${HOST_OS:-linux}
+NPROCS=${NPROCS:-1}
+PARALLEL_BUILD=${PARALLEL_BUILD:-1}
+
+if [ "${PARALLEL_BUILD}" == "1" ]; then
+ # Get number of processors (linux only for now)
+ if [ "${HOST_OS}" == "linux" ]; then
+ NPROCS="$(grep -c ^processor /proc/cpuinfo)"
+ fi
+fi
+
+cd ${BUILD_ALIAS}
+make -j ${NPROCS} "$@"