diff options
| author | Graydon Hoare <[email protected]> | 2011-05-01 20:18:52 +0000 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-05-01 20:20:25 +0000 |
| commit | 40624e35d74e5d200ae689c02753f0d60924e668 (patch) | |
| tree | e1e259098d5c49cd49844b40abd46ec35219d94a /mk/rustllvm.mk | |
| parent | rustc: Preserve dots in input path when using an implicit output path (diff) | |
| download | rust-40624e35d74e5d200ae689c02753f0d60924e668.tar.xz rust-40624e35d74e5d200ae689c02753f0d60924e668.zip | |
Start splitting up Makefile.in
Diffstat (limited to 'mk/rustllvm.mk')
| -rw-r--r-- | mk/rustllvm.mk | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mk/rustllvm.mk b/mk/rustllvm.mk new file mode 100644 index 00000000..5940bf5e --- /dev/null +++ b/mk/rustllvm.mk @@ -0,0 +1,41 @@ +###################################################################### +# rustc LLVM-extensions (C++) library variables and rules +###################################################################### + +RUSTLLVM_LIB_CS := $(addprefix rustllvm/, \ + MachOObjectFile.cpp Passes.cpp) + +RUSTLLVM_OBJS_CS := $(addprefix rustllvm/, RustWrapper.cpp) + +RUSTLLVM_HDR := rustllvm/include/llvm-c/Object.h +RUSTLLVM_DEF := rustllvm/rustllvm$(CFG_DEF_SUFFIX) + +RUSTLLVM_INCS := -iquote $(CFG_LLVM_INCDIR) \ + -iquote $(S)src/rustllvm/include +RUSTLLVM_LIB_OBJS := $(RUSTLLVM_LIB_CS:.cpp=.o) +RUSTLLVM_OBJS_OBJS := $(RUSTLLVM_OBJS_CS:.cpp=.o) + + +# FIXME: Building a .a is a hack so that we build with both older and newer +# versions of LLVM. In newer versions some of the bits of this library are +# already in LLVM itself, so they are skipped. +rustllvm/rustllvmbits.a: $(RUSTLLVM_LIB_OBJS) + rm -f $@ + ar crs $@ $^ + +# Note: We pass $(CFG_LLVM_LIBS) twice to fix the windows link since +# it has no -whole-archive. +rustllvm/$(CFG_RUSTLLVM): rustllvm/rustllvmbits.a $(RUSTLLVM_OBJS_OBJS) \ + $(MKFILES) $(RUSTLLVM_HDR) $(RUSTLLVM_DEF) + @$(call E, link: $@) + $(Q)$(call CFG_LINK_C,$@,$(RUSTLLVM_OBJS_OBJS) \ + $(CFG_GCC_PRE_LIB_FLAGS) $(CFG_LLVM_LIBS) \ + $(CFG_GCC_POST_LIB_FLAGS) rustllvm/rustllvmbits.a \ + $(CFG_LLVM_LIBS) \ + $(CFG_LLVM_LDFLAGS),$(RUSTLLVM_DEF)) + + +rustllvm/%.o: rustllvm/%.cpp $(MKFILES) + @$(call E, compile: $@) + $(Q)$(call CFG_COMPILE_C, $@, $(CFG_LLVM_CXXFLAGS) $(RUSTLLVM_INCS)) $< + |