summaryrefslogtreecommitdiff
path: root/mk.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mk.sh')
-rwxr-xr-xmk.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/mk.sh b/mk.sh
new file mode 100755
index 0000000..1f749eb
--- /dev/null
+++ b/mk.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+repo=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
+srcdir="$repo/src"
+
+if [[ "$(pwd -P)" = "$repo" ]]; then
+ test ! -d build || rm -r build
+ mkdir build
+ cd build
+fi
+
+cat >config.mak <<EOF
+CONFIGURED = 1
+srcdir = $srcdir
+EOF
+ln -s "$srcdir/Makefile"
+
+n="$(nproc)"
+watchexec -w "$srcdir" -- \
+make "-j$n" "-l$n" "$@"