]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #12020 : alexcrichton/rust/output-flags, r=brson
authorbors <bors@rust-lang.org>
Thu, 6 Feb 2014 20:41:30 +0000 (12:41 -0800)
committerbors <bors@rust-lang.org>
Thu, 6 Feb 2014 20:41:30 +0000 (12:41 -0800)
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:

* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]

The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.

The new logic for files that rustc emits is as follows:

1. Output types are dictated by the --emit flag. The default value is
   --emit=link, and this option can be passed multiple times and have all options
   stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
   attribute. The flags can be passed many times and stack with the crate
   attribute.
3. If the -o flag is specified, and only one output type is specified, the
   output will be emitted at this location. If more than one output type is
   specified, then the filename of -o is ignored, and all output goes in the
   directory that -o specifies. The -o option always ignores the --out-dir
   option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the directory of
   the crate file.
6. When multiple output types are specified, the filestem of all output is the
   same as the name of the CrateId (derived from a crate attribute or from the
   filestem of the crate file).

Closes #7791
Closes #11056
Closes #11667

1  2 
mk/crates.mk
src/librustc/driver/driver.rs
src/librustc/lib.rs
src/librustdoc/test.rs

diff --cc mk/crates.mk
Simple merge
index 70974fae5cc287fba4cda3069cb81d97ba7bc853,9d03fbb60619dccd56e2a909a6c2168771c0ac26..b7bb603dd65e7f9fdc0a6429ae98fbf60febb85f
@@@ -992,22 -998,17 +998,17 @@@ pub fn parse_pretty(sess: Session, name
  }
  
  // rustc command line options
 -pub fn optgroups() -> ~[getopts::groups::OptGroup] {
 +pub fn optgroups() -> ~[getopts::OptGroup] {
   ~[
-   optflag("c", "",    "Compile and assemble, but do not link"),
-   optmulti("", "cfg", "Configure the compilation
-                           environment", "SPEC"),
-   optflag("",  "emit-llvm",
-                         "Produce an LLVM assembly file if used with -S option;
-                          produce an LLVM bitcode file otherwise"),
-   optflag("h", "help","Display this message"),
-   optmulti("L", "",   "Add a directory to the library search path",
-                               "PATH"),
-   optflag("",  "bin", "Compile an executable crate (default)"),
-   optflag("",  "lib", "Compile a rust library crate using the compiler's default"),
-   optflag("",  "rlib", "Compile a rust library crate as an rlib file"),
-   optflag("",  "staticlib", "Compile a static library crate"),
-   optflag("",  "dylib", "Compile a dynamic library crate"),
+   optflag("h", "help", "Display this message"),
+   optmulti("", "cfg", "Configure the compilation environment", "SPEC"),
+   optmulti("L", "",   "Add a directory to the library search path", "PATH"),
+   optmulti("", "crate-type", "Comma separated list of types of crates for the \
+                               compiler to emit",
+            "[bin|lib|rlib|dylib|staticlib]"),
+   optmulti("", "emit", "Comma separated list of types of output for the compiler
+                         to emit",
+            "[asm|bc|ir|obj|link]"),
    optopt("", "linker", "Program to use for linking instead of the default.", "LINKER"),
    optopt("", "ar", "Program to use for managing archives instead of the default.", "AR"),
    optflag("", "crate-id", "Output the crate id and exit"),
Simple merge
index 12f2f2ca9361c11bc0bdd890332e225c750d01d7,153ab8afaa8801b1b9dcd3ae0c056ebef84db3b0..b2216b3a28c57491e738c660b79be9e1627e4fb0
@@@ -16,7 -16,9 +16,8 @@@ use std::run
  use std::str;
  
  use extra::tempfile::TempDir;
 -use extra::getopts;
  use extra::test;
+ use rustc::back::link;
  use rustc::driver::driver;
  use rustc::driver::session;
  use rustc::metadata::creader::Loader;