summaryrefslogtreecommitdiff
path: root/mk.sh
blob: 1f749eb1cff0e85cc40b941a6af0f21ed2ab94f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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" "$@"