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.
|
2011-11-01 18:50:47 -05:00
|
|
|
#
|
2014-01-24 21:27:22 -06:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Native libraries built as part of the rust build process
|
2011-11-01 18:50:47 -05:00
|
|
|
#
|
2014-01-24 21:27:22 -06:00
|
|
|
# This portion of the rust build system is meant to keep track of native
|
|
|
|
# dependencies and how to build them. It is currently required that all native
|
|
|
|
# dependencies are built as static libraries, as slinging around dynamic
|
|
|
|
# libraries isn't exactly the most fun thing to do.
|
2011-11-01 18:50:47 -05:00
|
|
|
#
|
2014-01-24 21:27:22 -06:00
|
|
|
# This section should need minimal modification to add new libraries. The
|
|
|
|
# relevant variables are:
|
2011-11-01 18:50:47 -05:00
|
|
|
#
|
2014-01-24 21:27:22 -06:00
|
|
|
# NATIVE_LIBS
|
|
|
|
# This is a list of all native libraries which are built as part of the
|
|
|
|
# build process. It will build all libraries into RT_OUTPUT_DIR with the
|
|
|
|
# appropriate name of static library as dictated by the target platform
|
|
|
|
#
|
|
|
|
# NATIVE_DEPS_<lib>
|
|
|
|
# This is a list of files relative to the src/rt directory which are
|
|
|
|
# needed to build the native library. Each file will be compiled to an
|
|
|
|
# object file, and then all the object files will be assembled into an
|
|
|
|
# archive (static library). The list contains files of any extension
|
|
|
|
#
|
|
|
|
# If adding a new library, you should update the NATIVE_LIBS list, and then list
|
|
|
|
# the required files below it. The list of required files is a list of files
|
|
|
|
# that's per-target so you're allowed to conditionally add files based on the
|
|
|
|
# target.
|
|
|
|
################################################################################
|
std: Extract librustrt out of libstd
As part of the libstd facade efforts, this commit extracts the runtime interface
out of the standard library into a standalone crate, librustrt. This crate will
provide the following services:
* Definition of the rtio interface
* Definition of the Runtime interface
* Implementation of the Task structure
* Implementation of task-local-data
* Implementation of task failure via unwinding via libunwind
* Implementation of runtime initialization and shutdown
* Implementation of thread-local-storage for the local rust Task
Notably, this crate avoids the following services:
* Thread creation and destruction. The crate does not require the knowledge of
an OS threading system, and as a result it seemed best to leave out the
`rt::thread` module from librustrt. The librustrt module does depend on
mutexes, however.
* Implementation of backtraces. There is no inherent requirement for the runtime
to be able to generate backtraces. As will be discussed later, this
functionality continues to live in libstd rather than librustrt.
As usual, a number of architectural changes were required to make this crate
possible. Users of "stable" functionality will not be impacted by this change,
but users of the `std::rt` module will likely note the changes. A list of
architectural changes made is:
* The stdout/stderr handles no longer live directly inside of the `Task`
structure. This is a consequence of librustrt not knowing about `std::io`.
These two handles are now stored inside of task-local-data.
The handles were originally stored inside of the `Task` for perf reasons, and
TLD is not currently as fast as it could be. For comparison, 100k prints goes
from 59ms to 68ms (a 15% slowdown). This appeared to me to be an acceptable
perf loss for the successful extraction of a librustrt crate.
* The `rtio` module was forced to duplicate more functionality of `std::io`. As
the module no longer depends on `std::io`, `rtio` now defines structures such
as socket addresses, addrinfo fiddly bits, etc. The primary change made was
that `rtio` now defines its own `IoError` type. This type is distinct from
`std::io::IoError` in that it does not have an enum for what error occurred,
but rather a platform-specific error code.
The native and green libraries will be updated in later commits for this
change, and the bulk of this effort was put behind updating the two libraries
for this change (with `rtio`).
* Printing a message on task failure (along with the backtrace) continues to
live in libstd, not in librustrt. This is a consequence of the above decision
to move the stdout/stderr handles to TLD rather than inside the `Task` itself.
The unwinding API now supports registration of global callback functions which
will be invoked when a task fails, allowing for libstd to register a function
to print a message and a backtrace.
The API for registering a callback is experimental and unsafe, as the
ramifications of running code on unwinding is pretty hairy.
* The `std::unstable::mutex` module has moved to `std::rt::mutex`.
* The `std::unstable::sync` module has been moved to `std::rt::exclusive` and
the type has been rewritten to not internally have an Arc and to have an RAII
guard structure when locking. Old code should stop using `Exclusive` in favor
of the primitives in `libsync`, but if necessary, old code should port to
`Arc<Exclusive<T>>`.
* The local heap has been stripped down to have fewer debugging options. None of
these were tested, and none of these have been used in a very long time.
[breaking-change]
2014-06-03 21:11:49 -05:00
|
|
|
NATIVE_LIBS := rust_builtin hoedown uv_support morestack miniz context_switch \
|
|
|
|
rustrt_native rust_test_helpers
|
2014-01-24 21:27:22 -06:00
|
|
|
|
|
|
|
# $(1) is the target triple
|
|
|
|
define NATIVE_LIBRARIES
|
|
|
|
|
2014-05-02 19:56:35 -05:00
|
|
|
NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
|
|
|
|
hoedown/src/buffer.c \
|
|
|
|
hoedown/src/document.c \
|
|
|
|
hoedown/src/escape.c \
|
|
|
|
hoedown/src/html.c \
|
|
|
|
hoedown/src/html_blocks.c \
|
|
|
|
hoedown/src/html_smartypants.c \
|
|
|
|
hoedown/src/stack.c \
|
|
|
|
hoedown/src/version.c
|
2014-01-24 21:27:22 -06:00
|
|
|
NATIVE_DEPS_uv_support_$(1) := rust_uv.c
|
2014-01-24 23:00:31 -06:00
|
|
|
NATIVE_DEPS_miniz_$(1) = miniz.c
|
std: Extract librustrt out of libstd
As part of the libstd facade efforts, this commit extracts the runtime interface
out of the standard library into a standalone crate, librustrt. This crate will
provide the following services:
* Definition of the rtio interface
* Definition of the Runtime interface
* Implementation of the Task structure
* Implementation of task-local-data
* Implementation of task failure via unwinding via libunwind
* Implementation of runtime initialization and shutdown
* Implementation of thread-local-storage for the local rust Task
Notably, this crate avoids the following services:
* Thread creation and destruction. The crate does not require the knowledge of
an OS threading system, and as a result it seemed best to leave out the
`rt::thread` module from librustrt. The librustrt module does depend on
mutexes, however.
* Implementation of backtraces. There is no inherent requirement for the runtime
to be able to generate backtraces. As will be discussed later, this
functionality continues to live in libstd rather than librustrt.
As usual, a number of architectural changes were required to make this crate
possible. Users of "stable" functionality will not be impacted by this change,
but users of the `std::rt` module will likely note the changes. A list of
architectural changes made is:
* The stdout/stderr handles no longer live directly inside of the `Task`
structure. This is a consequence of librustrt not knowing about `std::io`.
These two handles are now stored inside of task-local-data.
The handles were originally stored inside of the `Task` for perf reasons, and
TLD is not currently as fast as it could be. For comparison, 100k prints goes
from 59ms to 68ms (a 15% slowdown). This appeared to me to be an acceptable
perf loss for the successful extraction of a librustrt crate.
* The `rtio` module was forced to duplicate more functionality of `std::io`. As
the module no longer depends on `std::io`, `rtio` now defines structures such
as socket addresses, addrinfo fiddly bits, etc. The primary change made was
that `rtio` now defines its own `IoError` type. This type is distinct from
`std::io::IoError` in that it does not have an enum for what error occurred,
but rather a platform-specific error code.
The native and green libraries will be updated in later commits for this
change, and the bulk of this effort was put behind updating the two libraries
for this change (with `rtio`).
* Printing a message on task failure (along with the backtrace) continues to
live in libstd, not in librustrt. This is a consequence of the above decision
to move the stdout/stderr handles to TLD rather than inside the `Task` itself.
The unwinding API now supports registration of global callback functions which
will be invoked when a task fails, allowing for libstd to register a function
to print a message and a backtrace.
The API for registering a callback is experimental and unsafe, as the
ramifications of running code on unwinding is pretty hairy.
* The `std::unstable::mutex` module has moved to `std::rt::mutex`.
* The `std::unstable::sync` module has been moved to `std::rt::exclusive` and
the type has been rewritten to not internally have an Arc and to have an RAII
guard structure when locking. Old code should stop using `Exclusive` in favor
of the primitives in `libsync`, but if necessary, old code should port to
`Arc<Exclusive<T>>`.
* The local heap has been stripped down to have fewer debugging options. None of
these were tested, and none of these have been used in a very long time.
[breaking-change]
2014-06-03 21:11:49 -05:00
|
|
|
NATIVE_DEPS_rust_builtin_$(1) := rust_builtin.c \
|
|
|
|
rust_android_dummy.c
|
|
|
|
NATIVE_DEPS_rustrt_native_$(1) := \
|
2014-01-24 21:27:22 -06:00
|
|
|
rust_try.ll \
|
|
|
|
arch/$$(HOST_$(1))/record_sp.S
|
2014-06-05 13:08:43 -05:00
|
|
|
NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c
|
2014-01-24 21:27:22 -06:00
|
|
|
NATIVE_DEPS_morestack_$(1) := arch/$$(HOST_$(1))/morestack.S
|
2014-02-10 18:13:50 -06:00
|
|
|
NATIVE_DEPS_context_switch_$(1) := \
|
|
|
|
arch/$$(HOST_$(1))/_context.S
|
2014-01-24 21:27:22 -06:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# You shouldn't find it that necessary to edit anything below this line.
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# While we're defining the native libraries for each target, we define some
|
|
|
|
# common rules used to build files for various targets.
|
2011-11-01 18:50:47 -05:00
|
|
|
|
2014-01-24 21:27:22 -06:00
|
|
|
RT_OUTPUT_DIR_$(1) := $(1)/rt
|
|
|
|
|
2014-01-28 16:14:51 -06:00
|
|
|
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.ll $$(MKFILE_DEPS) \
|
|
|
|
$$(LLVM_CONFIG_$$(CFG_BUILD))
|
2014-01-24 21:27:22 -06:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$$(call E, compile: $$@)
|
|
|
|
$$(Q)$$(LLC_$$(CFG_BUILD)) $$(CFG_LLC_FLAGS_$(1)) \
|
|
|
|
-filetype=obj -mtriple=$(1) -relocation-model=pic -o $$@ $$<
|
|
|
|
|
2014-01-28 16:14:51 -06:00
|
|
|
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
|
2014-01-24 21:27:22 -06:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$$(call E, compile: $$@)
|
|
|
|
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, \
|
2014-05-02 19:56:35 -05:00
|
|
|
-I $$(S)src/rt/hoedown/src \
|
2014-01-24 21:27:22 -06:00
|
|
|
-I $$(S)src/libuv/include -I $$(S)src/rt \
|
|
|
|
$$(RUNTIME_CFLAGS_$(1))) $$<
|
|
|
|
|
2014-01-28 16:14:51 -06:00
|
|
|
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.S $$(MKFILE_DEPS) \
|
|
|
|
$$(LLVM_CONFIG_$$(CFG_BUILD))
|
2014-01-24 21:27:22 -06:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$$(call E, compile: $$@)
|
|
|
|
$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach target,$(CFG_TARGET),$(eval $(call NATIVE_LIBRARIES,$(target))))
|
|
|
|
|
|
|
|
# A macro for devining how to build third party libraries listed above (based
|
|
|
|
# on their dependencies).
|
|
|
|
#
|
|
|
|
# $(1) is the target
|
|
|
|
# $(2) is the lib name
|
|
|
|
define THIRD_PARTY_LIB
|
|
|
|
|
|
|
|
OBJS_$(2)_$(1) := $$(NATIVE_DEPS_$(2)_$(1):%=$$(RT_OUTPUT_DIR_$(1))/%)
|
|
|
|
OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.c=.o)
|
|
|
|
OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.cpp=.o)
|
|
|
|
OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.ll=.o)
|
|
|
|
OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.S=.o)
|
|
|
|
NATIVE_$(2)_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),$(2))
|
|
|
|
$$(RT_OUTPUT_DIR_$(1))/$$(NATIVE_$(2)_$(1)): $$(OBJS_$(2)_$(1))
|
|
|
|
@$$(call E, link: $$@)
|
|
|
|
$$(Q)$$(AR_$(1)) rcs $$@ $$^
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2014-07-22 23:37:05 -05:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2014-01-24 21:27:22 -06:00
|
|
|
$(eval $(call RUNTIME_RULES,$(target))))
|
2014-07-22 23:37:05 -05:00
|
|
|
$(foreach lib,$(NATIVE_LIBS), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2014-01-24 21:27:22 -06:00
|
|
|
$(eval $(call THIRD_PARTY_LIB,$(target),$(lib)))))
|
2012-03-26 17:54:22 -05:00
|
|
|
|
2014-01-24 21:27:22 -06:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Building third-party targets with external build systems
|
|
|
|
#
|
2014-04-25 01:19:34 -05:00
|
|
|
# This location is meant for dependencies which have external build systems. It
|
|
|
|
# is still assumed that the output of each of these steps is a static library
|
|
|
|
# in the correct location.
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# libuv
|
2014-01-24 21:27:22 -06:00
|
|
|
################################################################################
|
2012-03-26 17:54:22 -05:00
|
|
|
|
2013-08-28 19:01:44 -05:00
|
|
|
define DEF_LIBUV_ARCH_VAR
|
|
|
|
LIBUV_ARCH_$(1) = $$(subst i386,ia32,$$(subst x86_64,x64,$$(HOST_$(1))))
|
|
|
|
endef
|
2013-10-21 04:18:21 -05:00
|
|
|
$(foreach t,$(CFG_TARGET),$(eval $(call DEF_LIBUV_ARCH_VAR,$(t))))
|
2013-08-28 19:01:44 -05:00
|
|
|
|
2013-10-08 11:20:17 -05:00
|
|
|
ifdef CFG_ENABLE_FAST_MAKE
|
|
|
|
LIBUV_DEPS := $(S)/.gitmodules
|
|
|
|
else
|
|
|
|
LIBUV_DEPS := $(wildcard \
|
|
|
|
$(S)src/libuv/* \
|
|
|
|
$(S)src/libuv/*/* \
|
|
|
|
$(S)src/libuv/*/*/* \
|
|
|
|
$(S)src/libuv/*/*/*/*)
|
|
|
|
endif
|
|
|
|
|
|
|
|
LIBUV_NO_LOAD = run-benchmarks.target.mk run-tests.target.mk \
|
|
|
|
uv_dtrace_header.target.mk uv_dtrace_provider.target.mk
|
|
|
|
|
|
|
|
export PYTHONPATH := $(PYTHONPATH):$(S)src/gyp/pylib
|
|
|
|
|
|
|
|
define DEF_THIRD_PARTY_TARGETS
|
|
|
|
|
|
|
|
# $(1) is the target triple
|
|
|
|
|
|
|
|
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
|
|
|
|
LIBUV_OSTYPE_$(1) := win
|
2014-04-25 01:19:34 -05:00
|
|
|
# This isn't necessarily a desired option, but it's harmless and works around
|
|
|
|
# what appears to be a mingw-w64 bug.
|
|
|
|
#
|
|
|
|
# https://sourceforge.net/p/mingw-w64/bugs/395/
|
|
|
|
JEMALLOC_ARGS_$(1) := --enable-lazy-lock
|
2013-10-08 11:20:17 -05:00
|
|
|
else ifeq ($(OSTYPE_$(1)), apple-darwin)
|
|
|
|
LIBUV_OSTYPE_$(1) := mac
|
2014-05-05 02:05:11 -05:00
|
|
|
else ifeq ($(OSTYPE_$(1)), apple-ios)
|
|
|
|
LIBUV_OSTYPE_$(1) := ios
|
|
|
|
JEMALLOC_ARGS_$(1) := --disable-tls
|
2013-10-08 11:20:17 -05:00
|
|
|
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
|
|
|
|
LIBUV_OSTYPE_$(1) := freebsd
|
2014-07-29 09:44:39 -05:00
|
|
|
else ifeq ($(OSTYPE_$(1)), unknown-dragonfly)
|
|
|
|
LIBUV_OSTYPE_$(1) := freebsd
|
|
|
|
# required on DragonFly, otherwise gyp fails with a Python exception
|
|
|
|
LIBUV_GYP_ARGS_$(1) := --no-parallel
|
2013-10-08 11:20:17 -05:00
|
|
|
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
|
|
|
|
LIBUV_OSTYPE_$(1) := android
|
|
|
|
LIBUV_ARGS_$(1) := PLATFORM=android host=android OS=linux
|
2014-04-25 01:19:34 -05:00
|
|
|
JEMALLOC_ARGS_$(1) := --disable-tls
|
2012-02-10 14:07:01 -06:00
|
|
|
else
|
2013-10-08 11:20:17 -05:00
|
|
|
LIBUV_OSTYPE_$(1) := linux
|
2012-02-10 14:07:01 -06:00
|
|
|
endif
|
|
|
|
|
2013-10-08 11:20:17 -05:00
|
|
|
LIBUV_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),uv)
|
2013-12-19 01:44:10 -06:00
|
|
|
LIBUV_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/libuv
|
2014-01-24 21:27:22 -06:00
|
|
|
LIBUV_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(LIBUV_NAME_$(1))
|
2013-08-18 19:11:45 -05:00
|
|
|
|
2013-10-08 11:20:17 -05:00
|
|
|
LIBUV_MAKEFILE_$(1) := $$(CFG_BUILD_DIR)$$(RT_OUTPUT_DIR_$(1))/libuv/Makefile
|
2014-05-05 02:05:11 -05:00
|
|
|
LIBUV_BUILD_DIR_$(1) := $$(CFG_BUILD_DIR)$$(RT_OUTPUT_DIR_$(1))/libuv
|
|
|
|
LIBUV_XCODEPROJ_$(1) := $$(LIBUV_BUILD_DIR_$(1))/uv.xcodeproj
|
2013-08-18 19:11:45 -05:00
|
|
|
|
2013-12-19 01:44:10 -06:00
|
|
|
LIBUV_STAMP_$(1) = $$(LIBUV_DIR_$(1))/libuv-auto-clean-stamp
|
|
|
|
|
|
|
|
$$(LIBUV_STAMP_$(1)): $(S)src/rt/libuv-auto-clean-trigger
|
|
|
|
$$(Q)rm -rf $$(LIBUV_DIR_$(1))
|
|
|
|
$$(Q)mkdir -p $$(@D)
|
|
|
|
touch $$@
|
|
|
|
|
2013-11-22 20:21:37 -06:00
|
|
|
# libuv triggers a few warnings on some platforms
|
|
|
|
LIBUV_CFLAGS_$(1) := $(subst -Werror,,$(CFG_GCCISH_CFLAGS_$(1)))
|
|
|
|
|
2013-12-19 01:44:10 -06:00
|
|
|
$$(LIBUV_MAKEFILE_$(1)): $$(LIBUV_DEPS) $$(MKFILE_DEPS) $$(LIBUV_STAMP_$(1))
|
2013-08-18 19:11:45 -05:00
|
|
|
(cd $(S)src/libuv/ && \
|
2013-11-07 17:26:47 -06:00
|
|
|
$$(CFG_PYTHON) ./gyp_uv.py -f make -Dtarget_arch=$$(LIBUV_ARCH_$(1)) \
|
2013-10-08 11:20:17 -05:00
|
|
|
-D ninja \
|
|
|
|
-DOS=$$(LIBUV_OSTYPE_$(1)) \
|
2014-07-29 09:44:39 -05:00
|
|
|
-Goutput_dir=$$(@D) $$(LIBUV_GYP_ARGS_$(1)) --generator-output $$(@D))
|
2013-12-19 01:44:10 -06:00
|
|
|
touch $$@
|
2013-08-18 19:11:45 -05:00
|
|
|
|
2013-10-08 11:20:17 -05:00
|
|
|
# Windows has a completely different build system for libuv because of mingw. In
|
|
|
|
# theory when we support msvc then we should be using gyp's msvc output instead
|
|
|
|
# of mingw's makefile for windows
|
2013-03-02 06:25:12 -06:00
|
|
|
ifdef CFG_WINDOWSY_$(1)
|
2014-06-10 12:01:21 -05:00
|
|
|
LIBUV_LOCAL_$(1) := $$(S)src/libuv/libuv.a
|
|
|
|
$$(LIBUV_LOCAL_$(1)): $$(LIBUV_DEPS) $$(MKFILE_DEPS)
|
2013-08-18 19:11:45 -05:00
|
|
|
$$(Q)$$(MAKE) -C $$(S)src/libuv -f Makefile.mingw \
|
2013-11-22 20:21:37 -06:00
|
|
|
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS_$(1))" \
|
|
|
|
CC="$$(CC_$(1)) $$(LIBUV_CFLAGS_$(1)) $$(SNAP_DEFINES)" \
|
|
|
|
CXX="$$(CXX_$(1))" \
|
2013-08-18 19:11:45 -05:00
|
|
|
AR="$$(AR_$(1))" \
|
2013-02-02 14:14:04 -06:00
|
|
|
V=$$(VERBOSE)
|
2014-05-05 02:05:11 -05:00
|
|
|
else ifeq ($(OSTYPE_$(1)), apple-ios) # iOS
|
|
|
|
$$(LIBUV_XCODEPROJ_$(1)): $$(LIBUV_DEPS) $$(MKFILE_DEPS) $$(LIBUV_STAMP_$(1))
|
|
|
|
cp -rf $(S)src/libuv/ $$(LIBUV_BUILD_DIR_$(1))
|
|
|
|
(cd $$(LIBUV_BUILD_DIR_$(1)) && \
|
|
|
|
$$(CFG_PYTHON) ./gyp_uv.py -f xcode \
|
|
|
|
-D ninja \
|
|
|
|
-R libuv)
|
|
|
|
touch $$@
|
|
|
|
|
|
|
|
LIBUV_XCODE_OUT_LIB_$(1) := $$(LIBUV_BUILD_DIR_$(1))/build/Release-$$(CFG_SDK_NAME_$(1))/libuv.a
|
|
|
|
|
|
|
|
$$(LIBUV_LIB_$(1)): $$(LIBUV_XCODE_OUT_LIB_$(1)) $$(MKFILE_DEPS)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
$$(LIBUV_XCODE_OUT_LIB_$(1)): $$(LIBUV_DEPS) $$(LIBUV_XCODEPROJ_$(1)) \
|
|
|
|
$$(MKFILE_DEPS)
|
|
|
|
$$(Q)xcodebuild -project $$(LIBUV_BUILD_DIR_$(1))/uv.xcodeproj \
|
|
|
|
CFLAGS="$$(LIBUV_CFLAGS_$(1)) $$(SNAP_DEFINES)" \
|
|
|
|
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS_$(1))" \
|
|
|
|
$$(LIBUV_ARGS_$(1)) \
|
|
|
|
V=$$(VERBOSE) \
|
|
|
|
-configuration Release \
|
|
|
|
-sdk "$$(CFG_SDK_NAME_$(1))" \
|
|
|
|
ARCHS="$$(CFG_SDK_ARCHS_$(1))"
|
|
|
|
$$(Q)touch $$@
|
2013-02-26 23:53:35 -06:00
|
|
|
else
|
2014-06-10 12:01:21 -05:00
|
|
|
LIBUV_LOCAL_$(1) := $$(LIBUV_DIR_$(1))/Release/libuv.a
|
|
|
|
$$(LIBUV_LOCAL_$(1)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) $$(MKFILE_DEPS)
|
2013-12-19 01:44:10 -06:00
|
|
|
$$(Q)$$(MAKE) -C $$(LIBUV_DIR_$(1)) \
|
2013-11-22 20:21:37 -06:00
|
|
|
CFLAGS="$$(LIBUV_CFLAGS_$(1)) $$(SNAP_DEFINES)" \
|
2013-11-20 05:00:49 -06:00
|
|
|
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS_$(1))" \
|
2013-03-19 00:32:03 -05:00
|
|
|
CC="$$(CC_$(1))" \
|
|
|
|
CXX="$$(CXX_$(1))" \
|
|
|
|
AR="$$(AR_$(1))" \
|
2013-10-08 11:20:17 -05:00
|
|
|
$$(LIBUV_ARGS_$(1)) \
|
2013-08-18 19:11:45 -05:00
|
|
|
BUILDTYPE=Release \
|
|
|
|
NO_LOAD="$$(LIBUV_NO_LOAD)" \
|
2013-02-02 09:40:40 -06:00
|
|
|
V=$$(VERBOSE)
|
2014-03-27 16:29:07 -05:00
|
|
|
$$(Q)touch $$@
|
2014-01-24 21:27:22 -06:00
|
|
|
endif
|
2013-10-31 01:22:04 -05:00
|
|
|
|
2014-06-10 12:01:21 -05:00
|
|
|
ifeq ($(1),$$(CFG_BUILD))
|
|
|
|
ifneq ($$(CFG_LIBUV_ROOT),)
|
|
|
|
$$(LIBUV_LIB_$(1)): $$(CFG_LIBUV_ROOT)/libuv.a
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
else
|
|
|
|
$$(LIBUV_LIB_$(1)): $$(LIBUV_LOCAL_$(1))
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
$$(LIBUV_LIB_$(1)): $$(LIBUV_LOCAL_$(1))
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
endif
|
|
|
|
|
2014-04-25 01:19:34 -05:00
|
|
|
################################################################################
|
|
|
|
# jemalloc
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
ifdef CFG_ENABLE_FAST_MAKE
|
|
|
|
JEMALLOC_DEPS := $(S)/.gitmodules
|
|
|
|
else
|
|
|
|
JEMALLOC_DEPS := $(wildcard \
|
|
|
|
$(S)src/jemalloc/* \
|
|
|
|
$(S)src/jemalloc/*/* \
|
|
|
|
$(S)src/jemalloc/*/*/* \
|
|
|
|
$(S)src/jemalloc/*/*/*/*)
|
|
|
|
endif
|
|
|
|
|
2014-09-14 16:42:45 -05:00
|
|
|
# See #17183 for details, this file is touched during the build process so we
|
|
|
|
# don't want to consider it as a dependency.
|
|
|
|
JEMALLOC_DEPS := $(filter-out $(S)src/jemalloc/VERSION,$(JEMALLOC_DEPS))
|
|
|
|
|
2014-04-25 01:19:34 -05:00
|
|
|
JEMALLOC_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc)
|
|
|
|
ifeq ($$(CFG_WINDOWSY_$(1)),1)
|
|
|
|
JEMALLOC_REAL_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc_s)
|
|
|
|
else
|
|
|
|
JEMALLOC_REAL_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),jemalloc_pic)
|
|
|
|
endif
|
|
|
|
JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(JEMALLOC_NAME_$(1))
|
|
|
|
JEMALLOC_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc
|
2014-06-07 01:52:56 -05:00
|
|
|
JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1))
|
2014-04-25 01:19:34 -05:00
|
|
|
|
2014-06-07 01:52:56 -05:00
|
|
|
$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
|
2014-04-25 01:19:34 -05:00
|
|
|
@$$(call E, make: jemalloc)
|
|
|
|
cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
|
2014-09-07 13:05:32 -05:00
|
|
|
$$(JEMALLOC_ARGS_$(1)) --with-jemalloc-prefix=je_ $(CFG_JEMALLOC_FLAGS) \
|
2014-05-05 02:05:11 -05:00
|
|
|
--build=$(CFG_BUILD) --host=$(1) \
|
2014-04-25 01:19:34 -05:00
|
|
|
CC="$$(CC_$(1))" \
|
|
|
|
AR="$$(AR_$(1))" \
|
|
|
|
RANLIB="$$(AR_$(1)) s" \
|
2014-05-11 18:31:23 -05:00
|
|
|
CPPFLAGS="-I $(S)src/rt/" \
|
2014-05-05 02:05:11 -05:00
|
|
|
EXTRA_CFLAGS="$$(CFG_CFLAGS_$(1)) $$(CFG_JEMALLOC_CFLAGS_$(1)) -g1"
|
2014-04-25 01:19:34 -05:00
|
|
|
$$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
|
2014-06-07 01:52:56 -05:00
|
|
|
|
2014-06-14 01:23:31 -05:00
|
|
|
ifeq ($$(CFG_DISABLE_JEMALLOC),)
|
|
|
|
RUSTFLAGS_alloc := --cfg jemalloc
|
2014-06-07 01:52:56 -05:00
|
|
|
ifeq ($(1),$$(CFG_BUILD))
|
|
|
|
ifneq ($$(CFG_JEMALLOC_ROOT),)
|
|
|
|
$$(JEMALLOC_LIB_$(1)): $$(CFG_JEMALLOC_ROOT)/libjemalloc_pic.a
|
|
|
|
@$$(call E, copy: jemalloc)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
else
|
2014-06-10 12:01:21 -05:00
|
|
|
$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
|
2014-06-07 01:52:56 -05:00
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
endif
|
|
|
|
else
|
2014-06-10 12:01:21 -05:00
|
|
|
$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
|
2014-06-07 01:52:56 -05:00
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
endif
|
2014-06-14 01:23:31 -05:00
|
|
|
else
|
|
|
|
$$(JEMALLOC_LIB_$(1)): $$(MKFILE_DEPS)
|
|
|
|
$$(Q)touch $$@
|
|
|
|
endif
|
2014-04-25 01:19:34 -05:00
|
|
|
|
2014-02-04 00:54:09 -06:00
|
|
|
################################################################################
|
|
|
|
# compiler-rt
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
ifdef CFG_ENABLE_FAST_MAKE
|
|
|
|
COMPRT_DEPS := $(S)/.gitmodules
|
|
|
|
else
|
|
|
|
COMPRT_DEPS := $(wildcard \
|
|
|
|
$(S)src/compiler-rt/* \
|
|
|
|
$(S)src/compiler-rt/*/* \
|
|
|
|
$(S)src/compiler-rt/*/*/* \
|
|
|
|
$(S)src/compiler-rt/*/*/*/*)
|
|
|
|
endif
|
|
|
|
|
|
|
|
COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
|
|
|
|
COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1))
|
|
|
|
COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt
|
|
|
|
|
2014-02-14 10:13:19 -06:00
|
|
|
$$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS)
|
2014-02-04 00:54:09 -06:00
|
|
|
@$$(call E, make: compiler-rt)
|
|
|
|
$$(Q)$$(MAKE) -C "$(S)src/compiler-rt" \
|
|
|
|
ProjSrcRoot="$(S)src/compiler-rt" \
|
|
|
|
ProjObjRoot="$$(abspath $$(COMPRT_BUILD_DIR_$(1)))" \
|
|
|
|
CC="$$(CC_$(1))" \
|
|
|
|
AR="$$(AR_$(1))" \
|
|
|
|
RANLIB="$$(AR_$(1)) s" \
|
|
|
|
CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1))" \
|
|
|
|
TargetTriple=$(1) \
|
2014-04-21 20:43:19 -05:00
|
|
|
triple-builtins
|
|
|
|
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/triple/builtins/libcompiler_rt.a $$(COMPRT_LIB_$(1))
|
2014-02-04 00:54:09 -06:00
|
|
|
|
2014-02-05 17:19:40 -06:00
|
|
|
################################################################################
|
|
|
|
# libbacktrace
|
|
|
|
#
|
|
|
|
# We use libbacktrace on linux to get symbols in backtraces, but only on linux.
|
|
|
|
# Elsewhere we use other system utilities, so this library is only built on
|
|
|
|
# linux.
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
BACKTRACE_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),backtrace)
|
|
|
|
BACKTRACE_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(BACKTRACE_NAME_$(1))
|
|
|
|
BACKTRACE_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/libbacktrace
|
|
|
|
|
|
|
|
# We don't use this on platforms that aren't linux-based, so just make the file
|
|
|
|
# available, the compilation of libstd won't actually build it.
|
2014-05-05 02:05:11 -05:00
|
|
|
ifeq ($$(findstring darwin,$$(OSTYPE_$(1))),darwin)
|
|
|
|
# See comment above
|
2014-02-05 17:19:40 -06:00
|
|
|
$$(BACKTRACE_LIB_$(1)):
|
|
|
|
touch $$@
|
|
|
|
|
|
|
|
else
|
2014-05-05 02:05:11 -05:00
|
|
|
ifeq ($$(findstring ios,$$(OSTYPE_$(1))),ios)
|
|
|
|
# See comment above
|
|
|
|
$$(BACKTRACE_LIB_$(1)):
|
|
|
|
touch $$@
|
|
|
|
else
|
|
|
|
|
2014-02-05 17:19:40 -06:00
|
|
|
ifeq ($$(CFG_WINDOWSY_$(1)),1)
|
2014-05-05 02:05:11 -05:00
|
|
|
# See comment above
|
2014-02-05 17:19:40 -06:00
|
|
|
$$(BACKTRACE_LIB_$(1)):
|
|
|
|
touch $$@
|
|
|
|
else
|
|
|
|
|
|
|
|
ifdef CFG_ENABLE_FAST_MAKE
|
|
|
|
BACKTRACE_DEPS := $(S)/.gitmodules
|
|
|
|
else
|
|
|
|
BACKTRACE_DEPS := $(wildcard $(S)src/libbacktrace/*)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# We need to export CFLAGS because otherwise it doesn't pick up cross compile
|
|
|
|
# builds. If libbacktrace doesn't realize this, it will attempt to read 64-bit
|
|
|
|
# elf headers when compiled for a 32-bit system, yielding blank backtraces.
|
|
|
|
#
|
|
|
|
# This also removes the -Werror flag specifically to prevent errors during
|
|
|
|
# configuration.
|
|
|
|
#
|
|
|
|
# Down below you'll also see echos into the config.h generated by the
|
|
|
|
# ./configure script. This is done to force libbacktrace to *not* use the
|
|
|
|
# atomic/sync functionality because it pulls in unnecessary dependencies and we
|
|
|
|
# never use it anyway.
|
|
|
|
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: \
|
|
|
|
export CFLAGS:=$$(CFG_GCCISH_CFLAGS_$(1):-Werror=) \
|
|
|
|
-fno-stack-protector
|
|
|
|
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: export CC:=$$(CC_$(1))
|
|
|
|
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: export AR:=$$(AR_$(1))
|
|
|
|
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: export RANLIB:=$$(AR_$(1)) s
|
|
|
|
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: $$(BACKTRACE_DEPS) $$(MKFILE_DEPS)
|
|
|
|
$$(Q)rm -rf $$(BACKTRACE_BUILD_DIR_$(1))
|
|
|
|
$$(Q)mkdir -p $$(BACKTRACE_BUILD_DIR_$(1))
|
|
|
|
$$(Q)(cd $$(BACKTRACE_BUILD_DIR_$(1)) && \
|
|
|
|
$(S)src/libbacktrace/configure --target=$(1) --host=$(CFG_BUILD))
|
|
|
|
$$(Q)echo '#undef HAVE_ATOMIC_FUNCTIONS' >> \
|
|
|
|
$$(BACKTRACE_BUILD_DIR_$(1))/config.h
|
|
|
|
$$(Q)echo '#undef HAVE_SYNC_FUNCTIONS' >> \
|
|
|
|
$$(BACKTRACE_BUILD_DIR_$(1))/config.h
|
|
|
|
|
|
|
|
$$(BACKTRACE_LIB_$(1)): $$(BACKTRACE_BUILD_DIR_$(1))/Makefile $$(MKFILE_DEPS)
|
|
|
|
@$$(call E, make: libbacktrace)
|
|
|
|
$$(Q)$$(MAKE) -C $$(BACKTRACE_BUILD_DIR_$(1)) \
|
|
|
|
INCDIR=$(S)src/libbacktrace
|
|
|
|
$$(Q)cp $$(BACKTRACE_BUILD_DIR_$(1))/.libs/libbacktrace.a $$@
|
|
|
|
|
|
|
|
endif # endif for windowsy
|
2014-05-05 02:05:11 -05:00
|
|
|
endif # endif for ios
|
2014-02-05 17:19:40 -06:00
|
|
|
endif # endif for darwin
|
|
|
|
|
2011-11-01 18:50:47 -05:00
|
|
|
endef
|
|
|
|
|
2013-10-08 11:20:17 -05:00
|
|
|
# Instantiate template for all stages/targets
|
2013-10-21 04:18:21 -05:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-10-08 11:20:17 -05:00
|
|
|
$(eval $(call DEF_THIRD_PARTY_TARGETS,$(target))))
|