Use dependency files generated by llvm-rs-cc for Java

This is a reland of 4c474617d491fe98fa02571349138fb757959232
This time, we use awk instead of sed, and the script works
on Mac.

For C++ code llvm-rs-cc defines two targets but it defines
three targets for Java. The sed script was updated to handle
both cases appropriately.

Bug: 26839129
Change-Id: I1bca7d253764554d552950e03deedabaa9b7f17e
2 files changed