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

rustc: Improve the dep-info experience #28768

Merged
merged 2 commits into from
Oct 2, 2015
Merged

Conversation

alexcrichton
Copy link
Member

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.

Currently the compiler supports the ability to emit multiple output types as
part of one compilation (e.g. asm, LLVM IR, bytecode, link, dep-info, etc). It
does not, however, support the ability to customize the output filename for each
of these output types. The `-o` flag is ignored if multiple emit types are
specified (and the compiler emits a warning about this).

Normally this doesn't matter too much, but in the case of `dep-info` it can lead
to a number of problems (e.g. see rust-lang#28716). By allowing customization of the
output filename for each emit type we're able to solve the problems in that
issue.

This commit adds support for the `--emit` option to the compiler to look like:

    rustc foo.rs --emit dep-info=.deps/foo.d,link

This indicates that the `dep-info` output type will be placed at `.deps/foo.d`
and the `link` output type will otherwise be determined via the `--out-dir` and
`-o` flags.

Closes rust-lang#28716
@alexcrichton
Copy link
Member Author

r? @brson

cc @rust-lang/tools -- changes to CLI flags here.

@rust-highfive rust-highfive assigned brson and unassigned Aatch Sep 30, 2015
@rust-highfive
Copy link
Collaborator

r? @Aatch

(rust_highfive has picked a reviewer for you, use r? to override)

@brson
Copy link
Contributor

brson commented Oct 1, 2015

@brson
Copy link
Contributor

brson commented Oct 1, 2015

cc @froydnj @rillian @apasel422

Hopefully a gecko engineer will give this a look.

@brson
Copy link
Contributor

brson commented Oct 1, 2015

r=me when you decide the phony issue and one of the gecko devs checks in.

@rillian
Copy link
Contributor

rillian commented Oct 1, 2015

Whether the targets are 'phony' in the make-specific sense depends on whether the file is present or not. 'dummy target' might be a better term. In any case, we don't want these included in a .PHONY.

.PHONY tells make to always run the rule for the specified targets, whether a file with the name of that target is present or not. This avoids files shadowing invocation targets like 'clean' or 'doc' which are intended to never be considered up-to-date, which is not the case we have here.

gcc doesn't emit any .PHONY rules either.

@froydnj
Copy link
Contributor

froydnj commented Oct 1, 2015

The GCC documentation calls them "phony" targets, which, as @rillian pointed out, has nothing to do with .PHONY and is probably an unfortunate choice of words on GCC's part.

This helps protect against files being deleted to ensure that `make` won't emit
errors.

Closes rust-lang#28735
@alexcrichton
Copy link
Member Author

@bors: r=brson 1741962

bors added a commit that referenced this pull request 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.
@bors
Copy link
Contributor

bors commented Oct 2, 2015

⌛ Testing commit 1741962 with merge e650491...

@bors bors merged commit 1741962 into rust-lang:master Oct 2, 2015
@alexcrichton alexcrichton deleted the dep-info++ branch October 21, 2015 06:15
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

Successfully merging this pull request may close these issues.

7 participants