2012-12-10 19:32:48 -06:00
|
|
|
# Copyright 2012 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.
|
|
|
|
|
2011-05-01 15:18:52 -05:00
|
|
|
######################################################################
|
|
|
|
# rustc LLVM-extensions (C++) library variables and rules
|
|
|
|
######################################################################
|
|
|
|
|
2011-11-01 19:28:41 -05:00
|
|
|
define DEF_RUSTLLVM_TARGETS
|
|
|
|
|
2011-11-27 00:38:36 -06:00
|
|
|
# FIXME: Lately, on windows, llvm-config --includedir is not enough
|
|
|
|
# to find the llvm includes (probably because we're not actually installing
|
|
|
|
# llvm, but using it straight out of the build directory)
|
2013-03-02 06:25:12 -06:00
|
|
|
ifdef CFG_WINDOWSY_$(1)
|
2015-05-11 16:11:37 -05:00
|
|
|
LLVM_EXTRA_INCDIRS_$(1)= $$(call CFG_CC_INCLUDE_$(1),$(S)src/llvm/include) \
|
|
|
|
$$(call CFG_CC_INCLUDE_$(1),\
|
|
|
|
$$(CFG_LLVM_BUILD_DIR_$(1))/include)
|
2011-11-27 00:38:36 -06:00
|
|
|
endif
|
|
|
|
|
2014-11-24 12:55:14 -06:00
|
|
|
RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, \
|
|
|
|
ExecutionEngineWrapper.cpp RustWrapper.cpp PassWrapper.cpp)
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2011-11-27 00:38:36 -06:00
|
|
|
RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
|
2015-05-11 16:11:37 -05:00
|
|
|
$$(call CFG_CC_INCLUDE_$(1),$$(LLVM_INCDIR_$(1))) \
|
|
|
|
$$(call CFG_CC_INCLUDE_$(1),$$(S)src/rustllvm/include)
|
2013-09-04 01:48:45 -05:00
|
|
|
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
|
2015-05-11 16:11:37 -05:00
|
|
|
|
|
|
|
# Note that we appease `cl.exe` and its need for some sort of exception
|
|
|
|
# handling flag with the `EHsc` argument here as well.
|
|
|
|
ifeq ($$(findstring msvc,$(1)),msvc)
|
|
|
|
EXTRA_RUSTLLVM_CXXFLAGS_$(1) := //EHsc
|
|
|
|
endif
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2014-01-24 21:27:22 -06:00
|
|
|
$$(RT_OUTPUT_DIR_$(1))/$$(call CFG_STATIC_LIB_NAME_$(1),rustllvm): \
|
|
|
|
$$(RUSTLLVM_OBJS_OBJS_$(1))
|
2011-11-01 19:28:41 -05:00
|
|
|
@$$(call E, link: $$@)
|
2015-05-11 16:11:37 -05:00
|
|
|
$$(Q)$$(call CFG_CREATE_ARCHIVE_$(1),$$@) $$^
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2015-05-11 16:11:37 -05:00
|
|
|
# On MSVC we need to double-escape arguments that llvm-config printed which
|
|
|
|
# start with a '/'. The shell we're running in will auto-translate the argument
|
|
|
|
# `/foo` to `C:/msys64/foo` but we really want it to be passed through as `/foo`
|
|
|
|
# so the argument passed to our shell must be `//foo`.
|
2014-01-28 16:14:51 -06:00
|
|
|
$(1)/rustllvm/%.o: $(S)src/rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
|
2011-11-01 19:28:41 -05:00
|
|
|
@$$(call E, compile: $$@)
|
2015-05-11 16:11:37 -05:00
|
|
|
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@,) \
|
|
|
|
$$(subst /,//,$$(LLVM_CXXFLAGS_$(1))) \
|
|
|
|
$$(EXTRA_RUSTLLVM_CXXFLAGS_$(1)) \
|
|
|
|
$$(RUSTLLVM_INCS_$(1)) \
|
|
|
|
$$<
|
2011-11-01 19:28:41 -05:00
|
|
|
endef
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2011-11-01 19:28:41 -05:00
|
|
|
# Instantiate template for all stages
|
2013-10-21 04:18:21 -05:00
|
|
|
$(foreach host,$(CFG_HOST), \
|
2013-02-21 18:15:01 -06:00
|
|
|
$(eval $(call DEF_RUSTLLVM_TARGETS,$(host))))
|