blob: ab0f5865b3f2d092e2e87e2f8cab7c6df9059053 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/bin/sh
progname="$(basename "$0")"
showmode() {
mode=" ($1)"
col=$(( $(tput cols) - $(echo "$mode" | wc -L) + 1 ))
printf '\e[1A\e['$col'G\e[1;30m%s\e[0m\n' "$mode"
}
mode_cmake() {
showmode 'cmake'
builddir="build"
[ "$*" = "clean" ] && exec rm -rf "$builddir"
export CMAKE_GENERATOR="Ninja"
# re-run configuration if fresh or CMakeLists was changed
if [ ! -e "$builddir/build.ninja" ] ||
[ "CMakeLists.txt" -nt "$builddir/build.ninja" ] ; then
cmake --log-level WARNING -B "$builddir"
fi
exec cmake --build "$builddir" -- "$@"
}
[ -e "CMakeLists.txt" ] && mode_cmake "$@"
mode_make() {
showmode 'make'
exec make "$@"
}
[ -e "makefile" ] && mode_make "$@"
[ -e "Makefile" ] && mode_make "$@"
mode_latexmk() {
showmode 'latexmk'
[ "$*" = "clean" ] && exec latexmk -c
exec latexmk "$@"
}
[ -e "latexmkrc" ] && mode_latexmk "$@"
[ -e ".latexmkrc" ] && mode_latexmk "$@"
echo "$progname: unable to determine project build system!" >&2
exit 1
|