Generate a compile_commands.json for a specific target

Is it expensive to reconfigure? What’s wrong with having two build trees, one with and one without?

Using something like ccache would help here; the actual compiles would be cached at least.

That said, there’s no mechanism currently available to have different compilation databases. This might be a reasonable request (though something has to “lose” and not get compile_commands.json as the filename).