# 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 "$@" } 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