build system: Improve valgrind integration