rust/mk
Alex Crichton e338a4154b Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.

When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.

Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.

Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:

* If both a .dylib and .rlib are found for a rust library, the compiler will
  prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
  overridable by explicitly saying what flavor you'd like (rlib, staticlib,
  dylib).
* If no options are passed to the command line, and no crate_type is found in
  the destination crate, then an executable is generated

With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.

This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.

Closes #552
2013-11-29 18:36:13 -08:00
..
clean.mk Add generation of static libraries to rustc 2013-11-29 18:36:13 -08:00
ctags.mk Don't make tags for our dependencies and tests. 2013-11-16 13:44:52 +11:00
dist.mk support for GNU configure syntax 2013-10-29 16:22:08 -07:00
docs.mk rustdoc: pass through --cfg to rustc 2013-11-24 23:33:44 -05:00
host.mk Add generation of static libraries to rustc 2013-11-29 18:36:13 -08:00
install.mk Add generation of static libraries to rustc 2013-11-29 18:36:13 -08:00
llvm.mk support for GNU configure syntax 2013-10-29 16:22:08 -07:00
perf.mk support for GNU configure syntax 2013-10-29 16:22:08 -07:00
platform.mk Add generation of static libraries to rustc 2013-11-29 18:36:13 -08:00
pp.mk support for GNU configure syntax 2013-10-29 16:22:08 -07:00
rt.mk Remove sjlj stuff from rust_upcall and don't pass -Werror to libuv. 2013-11-22 22:04:36 -08:00
rustllvm.mk support for GNU configure syntax 2013-10-29 16:22:08 -07:00
snap.mk support for GNU configure syntax 2013-10-29 16:22:08 -07:00
stage0.mk configure: Fix passing multiple target and host triples. 2013-11-01 03:34:16 -04:00
target.mk Add generation of static libraries to rustc 2013-11-29 18:36:13 -08:00
tests.mk Add generation of static libraries to rustc 2013-11-29 18:36:13 -08:00
tools.mk Rename files to match current recommendations. 2013-11-03 23:49:01 +11:00