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.
|
2011-11-01 23:50:47 +00:00
|
|
|
#
|
2014-01-25 03:27:22 +00: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 23:50:47 +00:00
|
|
|
#
|
2014-01-25 03:27:22 +00: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 23:50:47 +00:00
|
|
|
#
|
2014-01-25 03:27:22 +00:00
|
|
|
# This section should need minimal modification to add new libraries. The
|
|
|
|
# relevant variables are:
|
2011-11-01 23:50:47 +00:00
|
|
|
#
|
2014-01-25 03:27:22 +00: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.
|
|
|
|
################################################################################
|
2015-12-02 18:31:29 +00:00
|
|
|
NATIVE_LIBS := hoedown miniz rust_test_helpers
|
2014-01-25 03:27:22 +00:00
|
|
|
|
|
|
|
# $(1) is the target triple
|
|
|
|
define NATIVE_LIBRARIES
|
|
|
|
|
2014-05-03 00:56:35 +00: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-25 05:00:31 +00:00
|
|
|
NATIVE_DEPS_miniz_$(1) = miniz.c
|
2014-06-05 18:08:43 +00:00
|
|
|
NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c
|
2014-01-25 03:27:22 +00: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 23:50:47 +00:00
|
|
|
|
2014-01-25 03:27:22 +00:00
|
|
|
RT_OUTPUT_DIR_$(1) := $(1)/rt
|
|
|
|
|
2014-01-28 22:14:51 +00:00
|
|
|
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
|
2014-01-25 03:27:22 +00:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$$(call E, compile: $$@)
|
|
|
|
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, \
|
2015-05-11 21:07:42 +00:00
|
|
|
$$(call CFG_CC_INCLUDE_$(1),$$(S)src/rt/hoedown/src) \
|
|
|
|
$$(call CFG_CC_INCLUDE_$(1),$$(S)src/rt) \
|
2014-01-25 03:27:22 +00:00
|
|
|
$$(RUNTIME_CFLAGS_$(1))) $$<
|
|
|
|
|
2014-01-28 22:14:51 +00:00
|
|
|
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.S $$(MKFILE_DEPS) \
|
|
|
|
$$(LLVM_CONFIG_$$(CFG_BUILD))
|
2014-01-25 03:27:22 +00:00
|
|
|
@mkdir -p $$(@D)
|
|
|
|
@$$(call E, compile: $$@)
|
|
|
|
$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
|
2015-06-25 22:30:00 +00:00
|
|
|
|
|
|
|
# On MSVC targets the compiler's default include path (e.g. where to find system
|
|
|
|
# headers) is specified by the INCLUDE environment variable. This may not be set
|
|
|
|
# so the ./configure script scraped the relevant values and this is the location
|
|
|
|
# that we put them into cl.exe's environment.
|
|
|
|
ifeq ($$(findstring msvc,$(1)),msvc)
|
|
|
|
$$(RT_OUTPUT_DIR_$(1))/%.o: \
|
|
|
|
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
|
|
|
|
$(1)/rustllvm/%.o: \
|
|
|
|
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(1)))
|
|
|
|
endif
|
2014-01-25 03:27:22 +00:00
|
|
|
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):.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: $$@)
|
2015-05-11 21:07:42 +00:00
|
|
|
$$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
|
2014-01-25 03:27:22 +00:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
2016-02-02 07:27:04 +00:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(eval $(call RUNTIME_RULES,$(target))))
|
2014-07-23 04:37:05 +00:00
|
|
|
$(foreach lib,$(NATIVE_LIBS), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2014-01-25 03:27:22 +00:00
|
|
|
$(eval $(call THIRD_PARTY_LIB,$(target),$(lib)))))
|
2012-03-26 22:54:22 +00:00
|
|
|
|
2014-01-25 03:27:22 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Building third-party targets with external build systems
|
|
|
|
#
|
2014-04-25 06:19:34 +00: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.
|
|
|
|
################################################################################
|
|
|
|
|
2013-10-08 16:20:17 +00:00
|
|
|
define DEF_THIRD_PARTY_TARGETS
|
|
|
|
|
|
|
|
# $(1) is the target triple
|
|
|
|
|
2015-12-17 07:06:00 +00:00
|
|
|
ifeq ($$(CFG_WINDOWSY_$(1)),1)
|
|
|
|
# A bit of history here, this used to be --enable-lazy-lock added in #14006
|
|
|
|
# which was filed with jemalloc in jemalloc/jemalloc#83 which was also
|
|
|
|
# reported to MinGW: http://sourceforge.net/p/mingw-w64/bugs/395/
|
2014-04-25 06:19:34 +00:00
|
|
|
#
|
2015-12-17 07:06:00 +00:00
|
|
|
# When updating jemalloc to 4.0, however, it was found that binaries would
|
|
|
|
# exit with the status code STATUS_RESOURCE_NOT_OWNED indicating that a thread
|
|
|
|
# was unlocking a mutex it never locked. Disabling this "lazy lock" option
|
|
|
|
# seems to fix the issue, but it was enabled by default for MinGW targets in
|
|
|
|
# 13473c7 for jemalloc.
|
|
|
|
#
|
|
|
|
# As a result of all that, force disabling lazy lock on Windows, and after
|
|
|
|
# reading some code it at least *appears* that the initialization of mutexes
|
|
|
|
# is otherwise ok in jemalloc, so shouldn't cause problems hopefully...
|
|
|
|
#
|
|
|
|
# tl;dr: make windows behave like other platforms by disabling lazy locking,
|
|
|
|
# but requires passing an option due to a historical default with
|
|
|
|
# jemalloc.
|
|
|
|
JEMALLOC_ARGS_$(1) := --disable-lazy-lock
|
2014-05-05 07:05:11 +00:00
|
|
|
else ifeq ($(OSTYPE_$(1)), apple-ios)
|
|
|
|
JEMALLOC_ARGS_$(1) := --disable-tls
|
2015-02-03 04:42:05 +00:00
|
|
|
else ifeq ($(findstring android, $(OSTYPE_$(1))), android)
|
2016-02-07 06:54:35 +00:00
|
|
|
# We force android to have prefixed symbols because apparently replacement of
|
|
|
|
# the libc allocator doesn't quite work. When this was tested (unprefixed
|
|
|
|
# symbols), it was found that the `realpath` function in libc would allocate
|
|
|
|
# with libc malloc (not jemalloc malloc), and then the standard library would
|
|
|
|
# free with jemalloc free, causing a segfault.
|
|
|
|
#
|
|
|
|
# If the test suite passes, however, without symbol prefixes then we should be
|
|
|
|
# good to go!
|
|
|
|
JEMALLOC_ARGS_$(1) := --disable-tls --with-jemalloc-prefix=je_
|
2014-06-10 17:01:21 +00:00
|
|
|
endif
|
|
|
|
|
2015-04-08 22:12:08 +00:00
|
|
|
ifdef CFG_ENABLE_DEBUG_JEMALLOC
|
|
|
|
JEMALLOC_ARGS_$(1) += --enable-debug --enable-fill
|
|
|
|
endif
|
|
|
|
|
2014-04-25 06:19:34 +00: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 21:42:45 +00:00
|
|
|
# See #17183 for details, this file is touched during the build process so we
|
|
|
|
# don't want to consider it as a dependency.
|
2016-02-02 07:27:04 +00:00
|
|
|
JEMALLOC_DEPS := $(filter-out $(S)src/jemalloc/VERSION,$(JEMALLOC_DEPS))
|
2014-09-14 21:42:45 +00:00
|
|
|
|
2014-04-25 06:19:34 +00: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 06:52:56 +00:00
|
|
|
JEMALLOC_LOCAL_$(1) := $$(JEMALLOC_BUILD_DIR_$(1))/lib/$$(JEMALLOC_REAL_NAME_$(1))
|
2014-04-25 06:19:34 +00:00
|
|
|
|
2014-06-07 06:52:56 +00:00
|
|
|
$$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
|
2014-04-25 06:19:34 +00:00
|
|
|
@$$(call E, make: jemalloc)
|
|
|
|
cd "$$(JEMALLOC_BUILD_DIR_$(1))"; "$(S)src/jemalloc/configure" \
|
2016-02-07 06:54:35 +00:00
|
|
|
$$(JEMALLOC_ARGS_$(1)) $(CFG_JEMALLOC_FLAGS) \
|
2014-07-23 18:56:36 +00:00
|
|
|
--build=$$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$$(CFG_GNU_TRIPLE_$(1)) \
|
2014-11-17 18:10:48 +00:00
|
|
|
CC="$$(CC_$(1)) $$(CFG_JEMALLOC_CFLAGS_$(1))" \
|
2014-04-25 06:19:34 +00:00
|
|
|
AR="$$(AR_$(1))" \
|
|
|
|
RANLIB="$$(AR_$(1)) s" \
|
2014-05-11 23:31:23 +00:00
|
|
|
CPPFLAGS="-I $(S)src/rt/" \
|
2014-12-25 04:20:01 +00:00
|
|
|
EXTRA_CFLAGS="-g1 -ffunction-sections -fdata-sections"
|
2014-04-25 06:19:34 +00:00
|
|
|
$$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
|
2014-06-07 06:52:56 +00: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 17:01:21 +00:00
|
|
|
$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
|
2014-06-07 06:52:56 +00:00
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
endif
|
|
|
|
else
|
2014-06-10 17:01:21 +00:00
|
|
|
$$(JEMALLOC_LIB_$(1)): $$(JEMALLOC_LOCAL_$(1))
|
2014-06-07 06:52:56 +00:00
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
endif
|
2014-04-25 06:19:34 +00:00
|
|
|
|
2014-02-04 06:54:09 +00: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
|
|
|
|
|
2015-05-11 19:29:08 +00:00
|
|
|
COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
|
2014-02-04 06:54:09 +00:00
|
|
|
COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1))
|
|
|
|
COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt
|
|
|
|
|
2015-05-11 21:09:25 +00:00
|
|
|
ifeq ($$(findstring msvc,$(1)),msvc)
|
2015-10-23 16:31:12 +00:00
|
|
|
$$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
|
|
|
|
@$$(call E, cmake: compiler-rt)
|
|
|
|
$$(Q)cd "$$(COMPRT_BUILD_DIR_$(1))"; $$(CFG_CMAKE) "$(S)src/compiler-rt" \
|
|
|
|
-DCMAKE_BUILD_TYPE=$$(LLVM_BUILD_CONFIG_MODE) \
|
|
|
|
-DLLVM_CONFIG_PATH=$$(LLVM_CONFIG_$(1)) \
|
|
|
|
-G"$$(CFG_CMAKE_GENERATOR)"
|
|
|
|
$$(Q)$$(CFG_CMAKE) --build "$$(COMPRT_BUILD_DIR_$(1))" \
|
|
|
|
--target lib/builtins/builtins \
|
|
|
|
--config $$(LLVM_BUILD_CONFIG_MODE) \
|
|
|
|
-- //v:m //nologo
|
|
|
|
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/lib/windows/$$(LLVM_BUILD_CONFIG_MODE)/clang_rt.builtins-$$(HOST_$(1)).lib $$@
|
2015-06-25 22:30:00 +00:00
|
|
|
else
|
2015-10-23 16:31:12 +00:00
|
|
|
COMPRT_CC_$(1) := $$(CC_$(1))
|
|
|
|
COMPRT_AR_$(1) := $$(AR_$(1))
|
|
|
|
# We chomp -Werror here because GCC warns about the type signature of
|
|
|
|
# builtins not matching its own and the build fails. It's a bit hacky,
|
|
|
|
# but what can we do, we're building libclang-rt using GCC ......
|
2016-01-24 10:07:47 +00:00
|
|
|
COMPRT_CFLAGS_$(1) := $$(CFG_GCCISH_CFLAGS_$(1)) -Wno-error -std=c99
|
2015-10-23 16:31:12 +00:00
|
|
|
|
|
|
|
# FreeBSD Clang's packaging is problematic; it doesn't copy unwind.h to
|
|
|
|
# the standard include directory. This should really be in our changes to
|
|
|
|
# compiler-rt, but we override the CFLAGS here so there isn't much choice
|
|
|
|
ifeq ($$(findstring freebsd,$(1)),freebsd)
|
|
|
|
COMPRT_CFLAGS_$(1) += -I/usr/include/c++/v1
|
2015-06-25 22:30:00 +00:00
|
|
|
endif
|
2015-05-11 21:09:25 +00:00
|
|
|
|
2015-11-26 19:05:10 +00:00
|
|
|
ifeq ($$(findstring emscripten,$(1)),emscripten)
|
|
|
|
|
|
|
|
# FIXME: emscripten doesn't use compiler-rt and can't build it without
|
|
|
|
# further hacks
|
|
|
|
$$(COMPRT_LIB_$(1)):
|
|
|
|
touch $$@
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2014-02-14 16:13:19 +00:00
|
|
|
$$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS)
|
2014-02-04 06:54:09 +00:00
|
|
|
@$$(call E, make: compiler-rt)
|
|
|
|
$$(Q)$$(MAKE) -C "$(S)src/compiler-rt" \
|
|
|
|
ProjSrcRoot="$(S)src/compiler-rt" \
|
|
|
|
ProjObjRoot="$$(abspath $$(COMPRT_BUILD_DIR_$(1)))" \
|
2015-05-11 21:09:25 +00:00
|
|
|
CC='$$(COMPRT_CC_$(1))' \
|
|
|
|
AR='$$(COMPRT_AR_$(1))' \
|
|
|
|
RANLIB='$$(COMPRT_AR_$(1)) s' \
|
|
|
|
CFLAGS="$$(COMPRT_CFLAGS_$(1))" \
|
2014-02-04 06:54:09 +00:00
|
|
|
TargetTriple=$(1) \
|
2014-04-22 01:43:19 +00:00
|
|
|
triple-builtins
|
2015-05-11 21:09:25 +00:00
|
|
|
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/triple/builtins/libcompiler_rt.a $$@
|
2015-11-26 19:05:10 +00:00
|
|
|
|
|
|
|
endif # if emscripten
|
2015-10-23 16:31:12 +00:00
|
|
|
endif
|
2015-11-26 19:05:10 +00:00
|
|
|
|
2014-02-05 23:19:40 +00: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
|
|
|
|
|
2015-08-26 00:44:55 +00:00
|
|
|
# We don't use this on platforms that aren't linux-based (with the exception of
|
|
|
|
# msys2/mingw builds on windows, which use it to read the dwarf debug
|
|
|
|
# information) so just make the file available, the compilation of libstd won't
|
|
|
|
# actually build it.
|
2014-05-05 07:05:11 +00:00
|
|
|
ifeq ($$(findstring darwin,$$(OSTYPE_$(1))),darwin)
|
|
|
|
# See comment above
|
2014-02-05 23:19:40 +00:00
|
|
|
$$(BACKTRACE_LIB_$(1)):
|
|
|
|
touch $$@
|
|
|
|
|
|
|
|
else
|
2014-05-05 07:05:11 +00:00
|
|
|
ifeq ($$(findstring ios,$$(OSTYPE_$(1))),ios)
|
|
|
|
# See comment above
|
|
|
|
$$(BACKTRACE_LIB_$(1)):
|
|
|
|
touch $$@
|
|
|
|
else
|
|
|
|
|
2015-08-26 00:44:55 +00:00
|
|
|
ifeq ($$(findstring msvc,$(1)),msvc)
|
2014-05-05 07:05:11 +00:00
|
|
|
# See comment above
|
2014-02-05 23:19:40 +00:00
|
|
|
$$(BACKTRACE_LIB_$(1)):
|
|
|
|
touch $$@
|
|
|
|
else
|
|
|
|
|
2015-11-26 19:05:10 +00:00
|
|
|
ifeq ($$(findstring emscripten,$(1)),emscripten)
|
|
|
|
# FIXME: libbacktrace doesn't understand the emscripten triple
|
|
|
|
$$(BACKTRACE_LIB_$(1)):
|
|
|
|
touch $$@
|
|
|
|
else
|
|
|
|
|
2014-02-05 23:19:40 +00:00
|
|
|
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.
|
2015-08-26 00:44:55 +00:00
|
|
|
#
|
|
|
|
# We also use `env PWD=` to clear the PWD environment variable, and then
|
|
|
|
# execute the command in a new shell. This is necessary to workaround a
|
|
|
|
# buildbot/msys2 bug: the shell is launched with PWD set to a windows-style path,
|
|
|
|
# which results in all further uses of `pwd` also printing a windows-style path,
|
|
|
|
# which breaks libbacktrace's configure script. Clearing PWD within the same
|
|
|
|
# shell is not sufficient.
|
|
|
|
|
2014-02-05 23:19:40 +00:00
|
|
|
$$(BACKTRACE_BUILD_DIR_$(1))/Makefile: $$(BACKTRACE_DEPS) $$(MKFILE_DEPS)
|
2014-10-20 18:04:45 +00:00
|
|
|
@$$(call E, configure: libbacktrace for $(1))
|
2014-02-05 23:19:40 +00:00
|
|
|
$$(Q)rm -rf $$(BACKTRACE_BUILD_DIR_$(1))
|
|
|
|
$$(Q)mkdir -p $$(BACKTRACE_BUILD_DIR_$(1))
|
2015-08-26 00:44:55 +00:00
|
|
|
$$(Q)(cd $$(BACKTRACE_BUILD_DIR_$(1)) && env \
|
|
|
|
PWD= \
|
2014-10-20 18:04:45 +00:00
|
|
|
CC="$$(CC_$(1))" \
|
|
|
|
AR="$$(AR_$(1))" \
|
|
|
|
RANLIB="$$(AR_$(1)) s" \
|
2016-01-24 10:07:47 +00:00
|
|
|
CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1)) -Wno-error -fno-stack-protector" \
|
2015-08-26 00:44:55 +00:00
|
|
|
$(S)src/libbacktrace/configure --build=$(CFG_GNU_TRIPLE_$(CFG_BUILD)) --host=$(CFG_GNU_TRIPLE_$(1)))
|
2014-02-05 23:19:40 +00:00
|
|
|
$$(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 $$@
|
|
|
|
|
2015-11-26 19:05:10 +00:00
|
|
|
endif # endif for emscripten
|
2015-08-26 00:44:55 +00:00
|
|
|
endif # endif for msvc
|
2014-05-05 07:05:11 +00:00
|
|
|
endif # endif for ios
|
2014-02-05 23:19:40 +00:00
|
|
|
endif # endif for darwin
|
|
|
|
|
2015-04-21 22:42:05 +00:00
|
|
|
################################################################################
|
|
|
|
# libc/libunwind for musl
|
|
|
|
#
|
|
|
|
# When we're building a musl-like target we're going to link libc/libunwind
|
|
|
|
# statically into the standard library and liblibc, so we need to make sure
|
|
|
|
# they're in a location that we can find
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
ifeq ($$(findstring musl,$(1)),musl)
|
|
|
|
$$(RT_OUTPUT_DIR_$(1))/%: $$(CFG_MUSL_ROOT)/lib/%
|
|
|
|
cp $$^ $$@
|
2015-11-08 01:44:44 +00:00
|
|
|
else
|
|
|
|
# Ask gcc where it is
|
|
|
|
$$(RT_OUTPUT_DIR_$(1))/%:
|
|
|
|
cp $$(shell $$(CC_$(1)) -print-file-name=$$(@F)) $$@
|
2015-04-21 22:42:05 +00:00
|
|
|
endif
|
|
|
|
|
2011-11-01 23:50:47 +00:00
|
|
|
endef
|
|
|
|
|
2013-10-08 16:20:17 +00:00
|
|
|
# Instantiate template for all stages/targets
|
2013-10-21 09:18:21 +00:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-10-08 16:20:17 +00:00
|
|
|
$(eval $(call DEF_THIRD_PARTY_TARGETS,$(target))))
|