summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..b2d4f65
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# Copyright (c) 2026, Apollo Telephone Laboratories.
+# Provided under the BSD-3 clause.
+#
+
+MAKE=make
+
+#
+# Check if all the dependencies are installed on the host
+# machine.
+#
+# $@: Dependencies installed on the machine
+#
+check_deps() {
+ for dep in $@
+ do
+ printf "Checking if $dep is installed... "
+ which $dep &>/dev/null
+ if [ $? -ne 0 ]
+ then
+ echo "no"
+ echo "fatal: Please install '$dep'!"
+ exit 1
+ fi
+ echo "yes"
+ done
+}
+
+#
+# Prepare the build environment
+#
+build_prepare() {
+ source dev/build.env
+
+ check_deps \
+ make \
+ clang \
+ rsync \
+ llvm-objcopy \
+ ld.lld
+}
+
+#
+# Build a directory
+#
+# $1: Directory to build
+# $2: Subsystem name
+#
+build_dir() {
+ pushd $1
+ echo "[*] Building $2..."
+ $MAKE
+ popd
+}
+
+build_run() {
+ mkdir -p out
+
+ build_dir \
+ atos \
+ "kernel"
+}
+
+build_prepare
+build_run