virtualize rustllvm construction per target triple

This commit is contained in:
Niko Matsakis 2011-11-01 17:28:41 -07:00 committed by Brian Anderson
parent 54af489e6f
commit 2bfa72ea42
3 changed files with 32 additions and 19 deletions

8
configure vendored
View File

@ -394,13 +394,19 @@ step_msg "making directories"
for i in \
doc doc/std \
nd nd/std \
rustllvm dl \
dl \
test/run-pass test/run-fail test/compile-fail \
test/bench test/perf test/pretty
do
make_dir $i
done
make_dir rustllvm
for t in $CFG_TARGET_TRIPLES
do
make_dir rustllvm/$t
done
make_dir rt
for t in $CFG_TARGET_TRIPLES
do

View File

@ -2,29 +2,36 @@
# rustc LLVM-extensions (C++) library variables and rules
######################################################################
RUSTLLVM_OBJS_CS := $(addprefix rustllvm/, RustGCMetadataPrinter.cpp \
define DEF_RUSTLLVM_TARGETS
RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, RustGCMetadataPrinter.cpp \
RustGCStrategy.cpp RustWrapper.cpp)
# Behind an ifdef for now since this requires a patched LLVM.
ifdef CFG_STACK_GROWTH
RUSTLLVM_OBJS_CS += rustllvm/RustPrologHook.cpp
RUSTLLVM_OBJS_CS_$(1) += rustllvm/RustPrologHook.cpp
endif
RUSTLLVM_DEF := rustllvm/rustllvm$(CFG_DEF_SUFFIX)
RUSTLLVM_DEF_$(1) := rustllvm/rustllvm$$(CFG_DEF_SUFFIX)
RUSTLLVM_INCS := -iquote $(CFG_LLVM_INCDIR) \
-iquote $(S)src/rustllvm/include
RUSTLLVM_OBJS_OBJS := $(RUSTLLVM_OBJS_CS:.cpp=.o)
RUSTLLVM_INCS_$(1) := -iquote $$(CFG_LLVM_INCDIR) \
-iquote $$(S)src/rustllvm/include
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=rustllvm/$(1)/%.o)
rustllvm/$(CFG_RUSTLLVM): $(RUSTLLVM_OBJS_OBJS) \
$(MKFILES) $(RUSTLLVM_DEF)
@$(call E, link: $@)
$(Q)$(call CFG_LINK_C,$@,$(RUSTLLVM_OBJS_OBJS) \
$(CFG_GCCISH_PRE_LIB_FLAGS) $(CFG_LLVM_LIBS) \
$(CFG_GCCISH_POST_LIB_FLAGS) \
$(CFG_LLVM_LDFLAGS),$(RUSTLLVM_DEF),$(CFG_RUSTLLVM))
rustllvm/$(1)/$(CFG_RUSTLLVM): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
$$(MKFILES) $$(RUSTLLVM_DEF_$(1))
@$$(call E, link: $$@)
$$(Q)$$(call CFG_LINK_C_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
$$(CFG_GCCISH_PRE_LIB_FLAGS) $$(CFG_LLVM_LIBS) \
$$(CFG_GCCISH_POST_LIB_FLAGS) \
$$(CFG_LLVM_LDFLAGS),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM))
rustllvm/%.o: rustllvm/%.cpp $(MKFILES)
@$(call E, compile: $@)
$(Q)$(call CFG_COMPILE_C, $@, $(CFG_LLVM_CXXFLAGS) $(RUSTLLVM_INCS)) $<
rustllvm/$(1)/%.o: rustllvm/%.cpp $$(MKFILES)
@$$(call E, compile: $$@)
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(CFG_LLVM_CXXFLAGS) $$(RUSTLLVM_INCS_$(1))) $$<
endef
# Instantiate template for all stages
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_RUSTLLVM_TARGETS,$(target))))

View File

@ -35,11 +35,11 @@ $$(TARGET_LIB$(1)$(2))/libstd.rlib: \
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_$(2)) --lib --static -o $$@ $$<
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUNTIME): rt/$(2)/$(CFG_RUNTIME)
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUNTIME): rt/$(2)/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM): rustllvm/$$(CFG_RUSTLLVM)
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM): rustllvm/$(2)/$$(CFG_RUSTLLVM)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@