]> git.lizzy.rs Git - rust.git/blob - mk/crates.mk
auto merge of #14526 : pczarn/rust/hashmap-opt, r=alexcrichton
[rust.git] / mk / crates.mk
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.
4 #
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.
10
11 ################################################################################
12 # Rust's standard distribution of crates and tools
13 #
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.
18 #
19 # Here's an explanation of the variables below
20 #
21 #   TARGET_CRATES
22 #       This list of crates will be built for all targets, including
23 #       cross-compiled targets
24 #
25 #   HOST_CRATES
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
30 #       crates.
31 #
32 #   TOOLS
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)
37 #
38 #   DEPS_<crate>
39 #       These lists are the dependencies of the <crate> that is to be built.
40 #       Rust dependencies are listed bare (i.e. std, green) and native
41 #       dependencies have a "native:" prefix (i.e. native:hoedown). All deps
42 #       will be built before the crate itself is built.
43 #
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
47 #
48 # You shouldn't need to modify much other than these variables. Crates are
49 # automatically generated for all stage/host/target combinations.
50 ################################################################################
51
52 TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
53                  uuid serialize sync getopts collections num test time rand \
54                  url log regex graphviz core rlibc alloc debug
55 HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros
56 CRATES := $(TARGET_CRATES) $(HOST_CRATES)
57 TOOLS := compiletest rustdoc rustc
58
59 DEPS_core :=
60 DEPS_rlibc :=
61 DEPS_alloc := core libc native:jemalloc
62 DEPS_debug := std
63 DEPS_std := core rand libc alloc native:rustrt native:backtrace
64 DEPS_graphviz := std
65 DEPS_green := std native:context_switch
66 DEPS_rustuv := std native:uv native:uv_support
67 DEPS_native := std
68 DEPS_syntax := std term serialize collections log fmt_macros debug
69 DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
70               collections time log graphviz debug
71 DEPS_rustdoc := rustc native:hoedown serialize sync getopts collections \
72                 test time debug
73 DEPS_flate := std native:miniz
74 DEPS_arena := std collections
75 DEPS_graphviz := std
76 DEPS_glob := std
77 DEPS_serialize := std collections log
78 DEPS_term := std collections log
79 DEPS_semver := std
80 DEPS_uuid := std serialize
81 DEPS_sync := std alloc
82 DEPS_getopts := std
83 DEPS_collections := std debug
84 DEPS_fourcc := syntax std
85 DEPS_hexfloat := syntax std
86 DEPS_num := std
87 DEPS_test := std collections getopts serialize term time regex
88 DEPS_time := std serialize sync
89 DEPS_rand := core
90 DEPS_url := std collections
91 DEPS_log := std sync
92 DEPS_regex := std collections
93 DEPS_regex_macros = syntax std regex
94 DEPS_fmt_macros = std
95
96 TOOL_DEPS_compiletest := test green rustuv getopts
97 TOOL_DEPS_rustdoc := rustdoc native
98 TOOL_DEPS_rustc := rustc native
99 TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
100 TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
101 TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
102
103 ONLY_RLIB_core := 1
104 ONLY_RLIB_libc := 1
105 ONLY_RLIB_rlibc := 1
106 ONLY_RLIB_alloc := 1
107 ONLY_RLIB_rand := 1
108
109 ################################################################################
110 # You should not need to edit below this line
111 ################################################################################
112
113 DOC_CRATES := $(filter-out rustc, $(filter-out syntax, $(CRATES)))
114 COMPILER_DOC_CRATES := rustc syntax
115
116 # This macro creates some simple definitions for each crate being built, just
117 # some munging of all of the parameters above.
118 #
119 # $(1) is the crate to generate variables for
120 define RUST_CRATE
121 CRATEFILE_$(1) := $$(S)src/lib$(1)/lib.rs
122 RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
123 RUST_DEPS_$(1) := $$(filter-out native:%,$$(DEPS_$(1)))
124 NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))
125 endef
126
127 $(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
128
129 # Similar to the macro above for crates, this macro is for tools
130 #
131 # $(1) is the crate to generate variables for
132 define RUST_TOOL
133 TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
134 endef
135
136 $(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))