backend/access/transam/Makefile contains
# ensure that version checks in xlog.c get recompiled when catversion.h changes
xlog.o: xlog.c $(top_srcdir)/src/include/catalog/catversion.h
which, at the time it was added, was sufficient to ensure you could do
"make check" after bumping catversion and things would work, whether
or not you bother with --enable-depend.
It ain't sufficient anymore though. First off, pg_rewind.c also has
compiled-in knowledge of CATALOG_VERSION_NO. So if you try "make
check-world" after naively bumping catversion, the pg_rewind TAP tests
will blow up most spectacularly, because the backend will have been
rebuilt to use the new catversion while pg_rewind won't have.
I started this post with the intention of proposing that we add a
similar forced dependency for pg_rewind.o. However, grepping revealed
a much bigger hazard, which is that CATALOG_VERSION_NO also factors
into TABLESPACE_VERSION_DIRECTORY, and there are dependencies on that
in about eight different files. The scary thing there is that a naive
test run will appear to work as long as you didn't rebuild any of those
files; while if you caused a rebuild of just some of them, it's gonna
be a mess.
So what I now think is that we'd be better off removing the forced
dependency shown above. It's just encouraging people to take unsafe
shortcuts.
regards, tom lane