1 # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
11 ################################################################################
12 # Rust's standard distribution of crates and tools
14 # The crates outlined below are the standard distribution of libraries provided
15 # in a rust installation. These rules are meant to abstract over the
16 # dependencies (both native and rust) of crates and basically generate all the
17 # necessary makefile rules necessary to build everything.
19 # Here's an explanation of the variables below
22 # This list of crates will be built for all targets, including
23 # cross-compiled targets
26 # This list of crates will be compiled for only host targets. Note that
27 # this set is explicitly *not* a subset of TARGET_CRATES, but rather it is
28 # a disjoint set. Nothing in the TARGET_CRATES set can depend on crates in
29 # the HOST_CRATES set, but the HOST_CRATES set can depend on target
33 # A list of all tools which will be built as part of the compilation
34 # process. It is currently assumed that most tools are built through
35 # src/driver/driver.rs with a particular configuration (there's a
36 # corresponding library providing the implementation)
39 # These lists are the dependencies of the <crate> that is to be built.
40 # Rust dependencies are listed bare (i.e. std) and native
41 # dependencies have a "native:" prefix (i.e. native:hoedown). All deps
42 # will be built before the crate itself is built.
44 # TOOL_DEPS_<tool>/TOOL_SOURCE_<tool>
45 # Similar to the DEPS variable, this is the library crate dependencies
46 # list for tool as well as the source file for the specified tool
48 # You shouldn't need to modify much other than these variables. Crates are
49 # automatically generated for all stage/host/target combinations.
50 ################################################################################
52 TARGET_CRATES := libc std flate arena term \
53 serialize getopts collections test rand \
54 log regex graphviz core rbml alloc \
56 RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
57 rustc_trans rustc_back rustc_llvm
58 HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
59 CRATES := $(TARGET_CRATES) $(HOST_CRATES)
60 TOOLS := compiletest rustdoc rustc
65 DEPS_alloc := core libc native:jemalloc
66 DEPS_std := core libc rand alloc collections unicode \
67 native:rust_builtin native:backtrace native:rustrt_native
69 DEPS_syntax := std term serialize log fmt_macros arena libc
70 DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
71 rustc_typeck rustc_resolve log syntax serialize rustc_llvm rustc_trans
72 DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
73 log syntax serialize rustc_llvm
74 DEPS_rustc_typeck := rustc syntax
75 DEPS_rustc_borrowck := rustc log graphviz syntax
76 DEPS_rustc_resolve := rustc log syntax
77 DEPS_rustc := syntax flate arena serialize getopts rbml \
78 log graphviz rustc_llvm rustc_back
79 DEPS_rustc_llvm := native:rustllvm libc std
80 DEPS_rustc_back := std syntax rustc_llvm flate log libc
81 DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
83 DEPS_flate := std native:miniz
87 DEPS_serialize := std log
88 DEPS_rbml := std log serialize
91 DEPS_collections := core alloc unicode
93 DEPS_test := std getopts serialize rbml term regex native:rust_test_helpers
99 TOOL_DEPS_compiletest := test getopts
100 TOOL_DEPS_rustdoc := rustdoc
101 TOOL_DEPS_rustc := rustc_driver
102 TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
103 TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
104 TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
110 ONLY_RLIB_collections := 1
111 ONLY_RLIB_unicode := 1
113 ################################################################################
114 # You should not need to edit below this line
115 ################################################################################
117 DOC_CRATES := $(filter-out rustc, \
118 $(filter-out rustc_trans, \
119 $(filter-out rustc_typeck, \
120 $(filter-out rustc_borrowck, \
121 $(filter-out rustc_resolve, \
122 $(filter-out rustc_driver, \
124 $(filter-out regex, \
125 $(filter-out getopts, \
126 $(filter-out syntax, $(CRATES)))))))))))
127 COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
128 rustc_typeck rustc_driver syntax
130 # This macro creates some simple definitions for each crate being built, just
131 # some munging of all of the parameters above.
133 # $(1) is the crate to generate variables for
135 CRATEFILE_$(1) := $$(S)src/lib$(1)/lib.rs
136 RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
137 RUST_DEPS_$(1) := $$(filter-out native:%,$$(DEPS_$(1)))
138 NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))
141 $(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
143 # Similar to the macro above for crates, this macro is for tools
145 # $(1) is the crate to generate variables for
147 TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
150 $(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))