summaryrefslogtreecommitdiff
path: root/scripts/command/build
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/command/build')
-rw-r--r--scripts/command/build26
1 files changed, 22 insertions, 4 deletions
diff --git a/scripts/command/build b/scripts/command/build
index 5219001c3..1e8b9b731 100644
--- a/scripts/command/build
+++ b/scripts/command/build
@@ -1,7 +1,25 @@
#!/bin/bash
-# NOTE 'run' sets NNFW_PROJECT_PATH and invokes this script
+# NOTE 'run' sets NNFW_SCRIPT_PATH and invokes this script
+source "${NNFW_SCRIPT_PATH}/config/build.configuration"
-# TODO Support command-line options
-# TODO Implement build steps inside this script
-make -C "${NNFW_PROJECT_PATH}"
+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} "$@"