aboutsummaryrefslogtreecommitdiff
path: root/shellrc.d/dev
blob: 4167c54f4510b43c9755f21fda1bcd2121342644 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# vim: ft=sh:


if command -v valgrind >/dev/null; then

	alias memcheck="valgrind --track-fds=yes --leak-check=full --track-origins=yes"
	alias massif="valgrind --tool=massif"
	alias drd="valgrind --tool=drd"
	alias helgrind="valgrind --tool=helgrind"

fi


if command -v meson >/dev/null; then

_meson_setup() {
	if [ ! -f "build/build.ninja" ]; then
		meson setup -Doptimization=plain build
	fi
}

mbuild() {
	_meson_setup \
		&& meson compile -C build "$@"
}

mtest() {
	_meson_setup \
		&& meson test -C build "$@"
}

mcoverage() {
	_meson_setup \
		&& meson configure build -Db_coverage=true \
		&& meson test -C build "$@" \
		&& ninja -C build coverage-html
}

mdist() {
	_meson_setup \
		&& meson dist -C build --formats xztar,gztar,zip "$@"
}

mupdate() {
	meson subprojects update
}

mpurge() {
	meson subprojects purge
}

fi


if command -v bear >/dev/null; then

	bmake() {
		mkdir -p build
		bear --output build/compile_commands.json --append -- make "$@"
	}

	alias mbmake='bmake -j$(($(nproc) * 2)) -l$(nproc)'

fi