Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--emit dep-info should support emitting "phony" dependencies for input files #28735

Closed
froydnj opened this issue Sep 29, 2015 · 1 comment
Closed

Comments

@froydnj
Copy link
Contributor

froydnj commented Sep 29, 2015

Running something like:

rustc --emit dep-info -o x.o lib.rs

will produce a depfile containing a rule like:

x.o: /path/to/lib.rs /path/to/a.rs /path/to/b.rs

This output has a problem: if a.rs is deleted from the filesystem and dependencies on it erased from lib.rs, then make will attempt to look for a rule to generate a.rs when we request that things be remade. Not finding one, it will helpfully complain that there is no rule to make a.rs and exit.

This can, of course, be worked around by clearing out your entire build directory and starting over, but this seems undesirable.

GCC has an option (-MP) to produce "phony" targets for all the dependencies of the object file; this prevents issues in cases like the above:

x.o: /path/to/lib.rs /path/to/a.rs /path/to/b.rs

/path/to/lib.rs:

/path/to/a.rs:

/path/to/b.rs:

since make now understands how to "generate" a.rs if it doesn't find it.

@alexcrichton
Copy link
Member

cc #28716

bors added a commit that referenced this issue Oct 2, 2015
This PR closes out #28716 and #28735 by making two changes to the compiler:

1. The `--emit` flag to the compiler now supports the ability to specify the output file name of a partuclar emit type. For example `--emit dep-info=bar.d,asm=foo.s,link` is now accepted.
2. The dep-info emission now emits a dummy target for all input file names to protect against deleted files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants