gbuild: avoid leaving invalid .d files behind if build interrupted

The LinkTarget command builds the LinkTarget's dep-file as well as an
optimization so the next make does not restart; in this case the
dep-file is not the target so it will not be deleted by make in case the
build is interrupted, and the next make can choke on the partially
written .d file.

Change-Id: I13b1884f1a974b7ce10b00e1df1d0f30222f4790
(cherry picked from commit 7ea6e5412d067001da4ab5a45aeb0ce8d58cdbad)