Previously if an imported aidl file has been deleted or moved,
the generated dependency file still contains the stale file name,
and make will fail with "No rule to make target <the deleted/moved
file>".
This change uses technique described in section "Automatic Dependency
Generation", Chapter 8 of "Managing Projects with GNU Make (3d
Edition)".
The same technique is used by the Android platform build system to
generate C/C++ header dependencies.
Bug:
10459179
Change-Id: Ib0c01a4234ef1af994487fdc846cdf8d13a675f6
fprintf(to, "\n");
+ // Output "<imported_file>: " so make won't fail if the imported file has
+ // been deleted, moved or renamed in incremental build.
+ import = g_imports;
+ while (import) {
+ if (import->filename) {
+ fprintf(to, "%s :\n", import->filename);
+ }
+ import = import->next;
+ }
+
fclose(to);
}