2014-01-24 21:27:22 -06: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.
|
2014-03-14 13:16:10 -05:00
|
|
|
# Rust dependencies are listed bare (i.e. std, green) and native
|
2014-05-02 19:56:35 -05:00
|
|
|
# dependencies have a "native:" prefix (i.e. native:hoedown). All deps
|
2014-01-24 21:27:22 -06:00
|
|
|
# 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-26 11:58:41 -06:00
|
|
|
TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
|
2014-03-14 13:16:10 -05:00
|
|
|
uuid serialize sync getopts collections num test time rand \
|
2014-05-13 18:10:05 -05:00
|
|
|
workcache url log regex graphviz core rlibc alloc
|
2014-05-06 11:52:53 -05:00
|
|
|
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros
|
2014-01-24 21:27:22 -06:00
|
|
|
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
|
2014-02-02 01:56:55 -06:00
|
|
|
TOOLS := compiletest rustdoc rustc
|
2014-01-24 21:27:22 -06:00
|
|
|
|
2014-04-30 22:05:14 -05:00
|
|
|
DEPS_core :=
|
2014-05-14 13:24:12 -05:00
|
|
|
DEPS_rlibc :=
|
2014-05-13 18:10:05 -05:00
|
|
|
DEPS_alloc := core libc native:jemalloc
|
|
|
|
DEPS_std := core libc alloc native:rustrt native:backtrace
|
2014-04-17 14:00:08 -05:00
|
|
|
DEPS_graphviz := std
|
2014-03-01 18:23:04 -06:00
|
|
|
DEPS_green := std rand native:context_switch
|
2014-01-24 21:27:22 -06:00
|
|
|
DEPS_rustuv := std native:uv native:uv_support
|
|
|
|
DEPS_native := std
|
2014-05-06 11:52:53 -05:00
|
|
|
DEPS_syntax := std term serialize collections log fmt_macros
|
2014-02-02 23:56:49 -06:00
|
|
|
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
|
2014-04-17 14:00:08 -05:00
|
|
|
collections time log graphviz
|
2014-05-02 19:56:35 -05:00
|
|
|
DEPS_rustdoc := rustc native:hoedown serialize sync getopts collections \
|
2014-02-19 21:08:12 -06:00
|
|
|
test time
|
2014-03-14 13:16:10 -05:00
|
|
|
DEPS_flate := std native:miniz
|
2014-02-02 23:56:49 -06:00
|
|
|
DEPS_arena := std collections
|
2014-04-25 12:10:03 -05:00
|
|
|
DEPS_graphviz := std
|
2014-01-28 20:51:33 -06:00
|
|
|
DEPS_glob := std
|
log: Introduce liblog, the old std::logging
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:
* The crate map has always been a bit of a code smell among rust programs. It
has difficulty being loaded on almost all platforms, and it's used almost
exclusively for logging and only logging. Removing the crate map is one of the
end goals of this movement.
* The compiler has a fair bit of special support for logging. It has the
__log_level() expression as well as generating a global word per module
specifying the log level. This is unfairly favoring the built-in logging
system, and is much better done purely in libraries instead of the compiler
itself.
* Initialization of logging is much easier to do if there is no reliance on a
magical crate map being available to set module log levels.
* If the logging library can be written outside of the standard library, there's
no reason that it shouldn't be. It's likely that we're not going to build the
highest quality logging library of all time, so third-party libraries should
be able to provide just as high-quality logging systems as the default one
provided in the rust distribution.
With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:
* The core change of this migration is that there is no longer a physical
log-level per module. This concept is still emulated (it is quite useful), but
there is now only a global log level, not a local one. This global log level
is a reflection of the maximum of all log levels specified. The previously
generated logging code looked like:
if specified_level <= __module_log_level() {
println!(...)
}
The newly generated code looks like:
if specified_level <= ::log::LOG_LEVEL {
if ::log::module_enabled(module_path!()) {
println!(...)
}
}
Notably, the first layer of checking is still intended to be "super fast" in
that it's just a load of a global word and a compare. The second layer of
checking is executed to determine if the current module does indeed have
logging turned on.
This means that if any module has a debug log level turned on, all modules
with debug log levels get a little bit slower (they all do more expensive
dynamic checks to determine if they're turned on or not).
Semantically, this migration brings no change in this respect, but
runtime-wise, this will have a perf impact on some code.
* A `RUST_LOG=::help` directive will no longer print out a list of all modules
that can be logged. This is because the crate map will no longer specify the
log levels of all modules, so the list of modules is not known. Additionally,
warnings can no longer be provided if a malformed logging directive was
supplied.
The new "hello world" for logging looks like:
#[phase(syntax, link)]
extern crate log;
fn main() {
debug!("Hello, world!");
}
2014-03-09 00:11:44 -06:00
|
|
|
DEPS_serialize := std collections log
|
2014-04-08 10:18:10 -05:00
|
|
|
DEPS_term := std collections log
|
2014-02-03 02:13:08 -06:00
|
|
|
DEPS_semver := std
|
2014-03-01 18:23:04 -06:00
|
|
|
DEPS_uuid := std serialize rand
|
2014-05-13 18:10:05 -05:00
|
|
|
DEPS_sync := std alloc
|
2014-02-02 17:20:32 -06:00
|
|
|
DEPS_getopts := std
|
2014-03-01 18:23:04 -06:00
|
|
|
DEPS_collections := std rand
|
2014-01-30 19:05:04 -06:00
|
|
|
DEPS_fourcc := syntax std
|
2014-03-02 12:41:17 -06:00
|
|
|
DEPS_hexfloat := syntax std
|
2014-03-01 18:23:04 -06:00
|
|
|
DEPS_num := std rand
|
2014-05-05 07:19:38 -05:00
|
|
|
DEPS_test := std collections getopts serialize term time regex
|
2014-05-14 19:54:36 -05:00
|
|
|
DEPS_time := std serialize sync
|
2014-03-01 18:23:04 -06:00
|
|
|
DEPS_rand := std
|
2014-03-14 13:16:10 -05:00
|
|
|
DEPS_url := std collections
|
2014-03-13 01:34:31 -05:00
|
|
|
DEPS_workcache := std serialize collections log
|
log: Introduce liblog, the old std::logging
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:
* The crate map has always been a bit of a code smell among rust programs. It
has difficulty being loaded on almost all platforms, and it's used almost
exclusively for logging and only logging. Removing the crate map is one of the
end goals of this movement.
* The compiler has a fair bit of special support for logging. It has the
__log_level() expression as well as generating a global word per module
specifying the log level. This is unfairly favoring the built-in logging
system, and is much better done purely in libraries instead of the compiler
itself.
* Initialization of logging is much easier to do if there is no reliance on a
magical crate map being available to set module log levels.
* If the logging library can be written outside of the standard library, there's
no reason that it shouldn't be. It's likely that we're not going to build the
highest quality logging library of all time, so third-party libraries should
be able to provide just as high-quality logging systems as the default one
provided in the rust distribution.
With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:
* The core change of this migration is that there is no longer a physical
log-level per module. This concept is still emulated (it is quite useful), but
there is now only a global log level, not a local one. This global log level
is a reflection of the maximum of all log levels specified. The previously
generated logging code looked like:
if specified_level <= __module_log_level() {
println!(...)
}
The newly generated code looks like:
if specified_level <= ::log::LOG_LEVEL {
if ::log::module_enabled(module_path!()) {
println!(...)
}
}
Notably, the first layer of checking is still intended to be "super fast" in
that it's just a load of a global word and a compare. The second layer of
checking is executed to determine if the current module does indeed have
logging turned on.
This means that if any module has a debug log level turned on, all modules
with debug log levels get a little bit slower (they all do more expensive
dynamic checks to determine if they're turned on or not).
Semantically, this migration brings no change in this respect, but
runtime-wise, this will have a perf impact on some code.
* A `RUST_LOG=::help` directive will no longer print out a list of all modules
that can be logged. This is because the crate map will no longer specify the
log levels of all modules, so the list of modules is not known. Additionally,
warnings can no longer be provided if a malformed logging directive was
supplied.
The new "hello world" for logging looks like:
#[phase(syntax, link)]
extern crate log;
fn main() {
debug!("Hello, world!");
}
2014-03-09 00:11:44 -06:00
|
|
|
DEPS_log := std sync
|
2014-04-24 23:27:24 -05:00
|
|
|
DEPS_regex := std collections
|
|
|
|
DEPS_regex_macros = syntax std regex
|
2014-05-06 11:52:53 -05:00
|
|
|
DEPS_fmt_macros = std
|
2014-01-24 21:27:22 -06:00
|
|
|
|
2014-02-13 19:49:11 -06:00
|
|
|
TOOL_DEPS_compiletest := test green rustuv getopts
|
2014-02-26 15:03:40 -06:00
|
|
|
TOOL_DEPS_rustdoc := rustdoc native
|
|
|
|
TOOL_DEPS_rustc := rustc native
|
2014-01-24 21:27:22 -06:00
|
|
|
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
|
|
|
|
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
|
|
|
|
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
|
|
|
|
|
2014-04-30 22:05:14 -05:00
|
|
|
ONLY_RLIB_core := 1
|
2014-05-14 13:24:12 -05:00
|
|
|
ONLY_RLIB_rlibc := 1
|
2014-05-13 18:10:05 -05:00
|
|
|
ONLY_RLIB_alloc := 1
|
2014-04-30 22:05:14 -05:00
|
|
|
|
2014-01-24 21:27:22 -06:00
|
|
|
################################################################################
|
|
|
|
# You should not need to edit below this line
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
DOC_CRATES := $(filter-out rustc, $(filter-out syntax, $(CRATES)))
|
2014-03-08 08:41:31 -06:00
|
|
|
COMPILER_DOC_CRATES := rustc syntax
|
2014-01-24 21:27:22 -06:00
|
|
|
|
|
|
|
# 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
|
2014-03-25 17:40:52 -05:00
|
|
|
RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
|
2014-01-24 21:27:22 -06:00
|
|
|
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
|
2014-03-25 17:40:52 -05:00
|
|
|
TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
|
2014-01-24 21:27:22 -06:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))
|