]> git.lizzy.rs Git - rust.git/blob - mk/rustllvm.mk
Auto merge of #24818 - tbelaire:double-import, r=nrc
[rust.git] / mk / rustllvm.mk
1 # Copyright 2012 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 # rustc LLVM-extensions (C++) library variables and rules
13 ######################################################################
14
15 define DEF_RUSTLLVM_TARGETS
16
17 # FIXME: Lately, on windows, llvm-config --includedir is not enough
18 # to find the llvm includes (probably because we're not actually installing
19 # llvm, but using it straight out of the build directory)
20 ifdef CFG_WINDOWSY_$(1)
21 LLVM_EXTRA_INCDIRS_$(1)= -iquote $(S)src/llvm/include \
22                          -iquote $$(CFG_LLVM_BUILD_DIR_$(1))/include
23 endif
24
25 RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, \
26         ExecutionEngineWrapper.cpp RustWrapper.cpp PassWrapper.cpp)
27
28 RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
29                      -iquote $$(LLVM_INCDIR_$(1)) \
30                      -iquote $$(S)src/rustllvm/include
31 RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
32 ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
33
34 $$(RT_OUTPUT_DIR_$(1))/$$(call CFG_STATIC_LIB_NAME_$(1),rustllvm): \
35             $$(RUSTLLVM_OBJS_OBJS_$(1))
36         @$$(call E, link: $$@)
37         $$(Q)$$(AR_$(1)) rcs $$@ $$(RUSTLLVM_OBJS_OBJS_$(1))
38
39 $(1)/rustllvm/%.o: $(S)src/rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
40         @$$(call E, compile: $$@)
41         $$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@, $$(LLVM_CXXFLAGS_$(1)) $$(RUSTLLVM_INCS_$(1))) $$<
42 endef
43
44 # Instantiate template for all stages
45 $(foreach host,$(CFG_HOST), \
46  $(eval $(call DEF_RUSTLLVM_TARGETS,$(host))))