waf: Move logic to check for man pages generation in single function