PageRenderTime 16ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/mk/rustllvm.mk

http://github.com/jruderman/rust
Makefile | 40 lines | 25 code | 8 blank | 7 comment | 0 complexity | c329bf8f7fb17a4fb72c556f01c28d7b MD5 | raw file
 1######################################################################
 2# rustc LLVM-extensions (C++) library variables and rules
 3######################################################################
 4
 5define DEF_RUSTLLVM_TARGETS
 6
 7# FIXME: Lately, on windows, llvm-config --includedir is not enough
 8# to find the llvm includes (probably because we're not actually installing
 9# llvm, but using it straight out of the build directory)
10ifdef CFG_WINDOWSY
11LLVM_EXTRA_INCDIRS_$(1)= -iquote $(S)src/llvm/include \
12                         -iquote llvm/$(1)/include
13endif
14
15RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, RustWrapper.cpp)
16
17RUSTLLVM_DEF_$(1) := rustllvm/rustllvm$$(CFG_DEF_SUFFIX)
18
19RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
20                     -iquote $$(LLVM_INCDIR_$(1)) \
21                     -iquote $$(S)src/rustllvm/include
22RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=rustllvm/$(1)/%.o)
23ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
24
25rustllvm/$(1)/$(CFG_RUSTLLVM): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
26                          $$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1))
27	@$$(call E, link: $$@)
28	$$(Q)$$(call CFG_LINK_C_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
29	  $$(CFG_GCCISH_PRE_LIB_FLAGS) $$(LLVM_LIBS_$(1)) \
30          $$(CFG_GCCISH_POST_LIB_FLAGS) \
31          $$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM))
32
33rustllvm/$(1)/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
34	@$$(call E, compile: $$@)
35	$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(LLVM_CXXFLAGS_$(1)) $$(RUSTLLVM_INCS_$(1))) $$<
36endef
37
38# Instantiate template for all stages
39$(foreach target,$(CFG_TARGET_TRIPLES), \
40 $(eval $(call DEF_RUSTLLVM_TARGETS,$(target))))