add syntax for checking versions
docs for ninja_required_version

(And some extra docs for top-level variables in general.)
depfile helper: check errors on writing .d files

Closes #492 and #493.