Currently, compdb iterates all edges. I am proposing an option to accept one target name, and only iterate edges it depends on. e.g. ninja -t compdb -a //foo:main cc cxx New help message will be: usage: ninja -t compdb [options] [target] [rules] options: -x expand @rspfile style response file invocations -a accept one target name, and only dump compilation database for this target