2014-01-25 03:27:22 +00:00
|
|
|
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Rust's standard distribution of crates and tools
|
|
|
|
#
|
|
|
|
# The crates outlined below are the standard distribution of libraries provided
|
|
|
|
# in a rust installation. These rules are meant to abstract over the
|
|
|
|
# dependencies (both native and rust) of crates and basically generate all the
|
|
|
|
# necessary makefile rules necessary to build everything.
|
|
|
|
#
|
|
|
|
# Here's an explanation of the variables below
|
|
|
|
#
|
|
|
|
# TARGET_CRATES
|
|
|
|
# This list of crates will be built for all targets, including
|
|
|
|
# cross-compiled targets
|
|
|
|
#
|
|
|
|
# HOST_CRATES
|
|
|
|
# This list of crates will be compiled for only host targets. Note that
|
|
|
|
# this set is explicitly *not* a subset of TARGET_CRATES, but rather it is
|
|
|
|
# a disjoint set. Nothing in the TARGET_CRATES set can depend on crates in
|
|
|
|
# the HOST_CRATES set, but the HOST_CRATES set can depend on target
|
|
|
|
# crates.
|
|
|
|
#
|
|
|
|
# TOOLS
|
|
|
|
# A list of all tools which will be built as part of the compilation
|
|
|
|
# process. It is currently assumed that most tools are built through
|
|
|
|
# src/driver/driver.rs with a particular configuration (there's a
|
|
|
|
# corresponding library providing the implementation)
|
|
|
|
#
|
|
|
|
# DEPS_<crate>
|
|
|
|
# These lists are the dependencies of the <crate> that is to be built.
|
|
|
|
# Rust dependencies are listed bare (i.e. std, extra, green) and native
|
|
|
|
# dependencies have a "native:" prefix (i.e. native:sundown). All deps
|
|
|
|
# will be built before the crate itself is built.
|
|
|
|
#
|
|
|
|
# TOOL_DEPS_<tool>/TOOL_SOURCE_<tool>
|
|
|
|
# Similar to the DEPS variable, this is the library crate dependencies
|
|
|
|
# list for tool as well as the source file for the specified tool
|
|
|
|
#
|
|
|
|
# You shouldn't need to modify much other than these variables. Crates are
|
|
|
|
# automatically generated for all stage/host/target combinations.
|
|
|
|
################################################################################
|
|
|
|
|
2014-02-02 23:20:32 +00:00
|
|
|
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
|
2014-02-20 03:08:12 +00:00
|
|
|
uuid serialize sync getopts collections num test time
|
2014-02-10 19:51:06 +00:00
|
|
|
HOST_CRATES := syntax rustc rustdoc fourcc
|
2014-01-25 03:27:22 +00:00
|
|
|
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
|
2014-02-02 07:56:55 +00:00
|
|
|
TOOLS := compiletest rustdoc rustc
|
2014-01-25 03:27:22 +00:00
|
|
|
|
2014-02-04 06:54:09 +00:00
|
|
|
DEPS_std := native:rustrt native:compiler-rt
|
2014-02-20 03:08:12 +00:00
|
|
|
DEPS_extra := std term sync serialize getopts collections time
|
2014-02-11 00:13:50 +00:00
|
|
|
DEPS_green := std native:context_switch
|
2014-01-25 03:27:22 +00:00
|
|
|
DEPS_rustuv := std native:uv native:uv_support
|
|
|
|
DEPS_native := std
|
2014-02-14 03:51:26 +00:00
|
|
|
DEPS_syntax := std term serialize collections
|
2014-02-03 05:56:49 +00:00
|
|
|
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
|
2014-02-20 03:08:12 +00:00
|
|
|
collections time extra
|
2014-02-14 01:49:11 +00:00
|
|
|
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
|
2014-02-20 03:08:12 +00:00
|
|
|
test time
|
2014-02-21 08:28:44 +00:00
|
|
|
DEPS_flate := std extra native:miniz
|
2014-02-03 05:56:49 +00:00
|
|
|
DEPS_arena := std collections
|
2014-01-29 02:51:33 +00:00
|
|
|
DEPS_glob := std
|
2014-02-21 22:18:39 +00:00
|
|
|
DEPS_serialize := std collections
|
2014-02-20 03:29:58 +00:00
|
|
|
DEPS_term := std collections
|
2014-02-03 08:13:08 +00:00
|
|
|
DEPS_semver := std
|
2014-02-05 16:52:54 +00:00
|
|
|
DEPS_uuid := std serialize
|
2014-01-30 20:04:47 +00:00
|
|
|
DEPS_sync := std
|
2014-02-02 23:20:32 +00:00
|
|
|
DEPS_getopts := std
|
2014-02-21 22:18:39 +00:00
|
|
|
DEPS_collections := std
|
2014-01-31 01:05:04 +00:00
|
|
|
DEPS_fourcc := syntax std
|
2014-02-21 22:18:39 +00:00
|
|
|
DEPS_num := std
|
2014-02-14 01:49:11 +00:00
|
|
|
DEPS_test := std extra collections getopts serialize term
|
2014-02-20 03:08:12 +00:00
|
|
|
DEPS_time := std serialize
|
2014-01-25 03:27:22 +00:00
|
|
|
|
2014-02-14 01:49:11 +00:00
|
|
|
TOOL_DEPS_compiletest := test green rustuv getopts
|
2014-01-25 03:27:22 +00:00
|
|
|
TOOL_DEPS_rustdoc := rustdoc green rustuv
|
|
|
|
TOOL_DEPS_rustc := rustc green rustuv
|
|
|
|
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
|
|
|
|
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
|
|
|
|
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# You should not need to edit below this line
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
DOC_CRATES := $(filter-out rustc, $(filter-out syntax, $(CRATES)))
|
|
|
|
|
|
|
|
# This macro creates some simple definitions for each crate being built, just
|
|
|
|
# some munging of all of the parameters above.
|
|
|
|
#
|
|
|
|
# $(1) is the crate to generate variables for
|
|
|
|
define RUST_CRATE
|
|
|
|
CRATEFILE_$(1) := $$(S)src/lib$(1)/lib.rs
|
|
|
|
RSINPUTS_$(1) := $$(wildcard $$(addprefix $(S)src/lib$(1), \
|
|
|
|
*.rs */*.rs */*/*.rs */*/*/*.rs))
|
|
|
|
RUST_DEPS_$(1) := $$(filter-out native:%,$$(DEPS_$(1)))
|
|
|
|
NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
|
|
|
|
|
|
|
|
# Similar to the macro above for crates, this macro is for tools
|
|
|
|
#
|
|
|
|
# $(1) is the crate to generate variables for
|
|
|
|
define RUST_TOOL
|
Redesign output flags for rustc
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 current
directory of the process.
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
2014-02-03 23:27:54 +00:00
|
|
|
TOOL_INPUTS_$(1) := $$(wildcard $$(addprefix $$(dir $$(TOOL_SOURCE_$(1))), \
|
2014-01-25 03:27:22 +00:00
|
|
|
*.rs */*.rs */*/*.rs */*/*/*.rs))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))
|