Our development workflow tooling prevents trailing blank lines
from being added, but some such lines remain from before that
was enforced. Remove them to make it easier to rename files
without triggering enforcement.
- Make sure the original link line is untouched
- Avoid duplicating the link line when supporting version < 1.4
- Make sure the cyclic dependencies and such are output correctly in
complicated cases.
- Avoid outputing dependencies that are already satisfied on the original
link line when possible.