diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index e2835ae8f0d..0ec3424b82d 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -881,9 +881,16 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, id: &str) {
                                    .collect();
         let mut file = try!(fs::File::create(&deps_filename));
         for path in &out_filenames {
-            try!(write!(&mut file,
+            try!(write!(file,
                         "{}: {}\n\n", path.display(), files.join(" ")));
         }
+
+        // Emit a fake target for each input file to the compilation. This
+        // prevents `make` from spitting out an error if a file is later
+        // deleted. For more info see #28735
+        for path in files {
+            try!(writeln!(file, "{}:", path));
+        }
         Ok(())
     })();
 
diff --git a/src/test/run-make/dep-info/Makefile b/src/test/run-make/dep-info/Makefile
index a1828cd1f5d..9b79d1af521 100644
--- a/src/test/run-make/dep-info/Makefile
+++ b/src/test/run-make/dep-info/Makefile
@@ -7,9 +7,10 @@
 ifneq ($(shell uname),FreeBSD)
 ifndef IS_WINDOWS
 all:
-	$(RUSTC) --emit dep-info,link --crate-type=lib lib.rs
+	cp *.rs $(TMPDIR)
+	$(RUSTC) --emit dep-info,link --crate-type=lib $(TMPDIR)/lib.rs
 	sleep 2
-	touch foo.rs
+	touch $(TMPDIR)/foo.rs
 	-rm -f $(TMPDIR)/done
 	$(MAKE) -drf Makefile.foo
 	sleep 2
@@ -17,6 +18,11 @@ all:
 	pwd
 	$(MAKE) -drf Makefile.foo
 	rm $(TMPDIR)/done && exit 1 || exit 0
+
+	# When a source file is deleted `make` should still work
+	rm $(TMPDIR)/bar.rs
+	cp $(TMPDIR)/lib2.rs $(TMPDIR)/lib.rs
+	$(MAKE) -drf Makefile.foo
 else
 all:
 
diff --git a/src/test/run-make/dep-info/lib2.rs b/src/test/run-make/dep-info/lib2.rs
new file mode 100644
index 00000000000..1b70fb4eb4b
--- /dev/null
+++ b/src/test/run-make/dep-info/lib2.rs
@@ -0,0 +1,13 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_name = "foo"]
+
+pub mod foo;