enable building with different target arch

This commit is contained in:
Niko Matsakis 2011-10-14 12:22:20 -07:00 committed by Brian Anderson
parent f05761ddb3
commit 93781297bf
6 changed files with 15 additions and 32 deletions

View File

@ -325,7 +325,6 @@ config.mk: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
# Primary-target makefiles
######################################################################
include $(CFG_SRC_DIR)/mk/intrinsics.mk
include $(CFG_SRC_DIR)/mk/target.mk
include $(CFG_SRC_DIR)/mk/host.mk
include $(CFG_SRC_DIR)/mk/stage0.mk

7
configure vendored
View File

@ -229,6 +229,7 @@ then
printf " %-32s %s\n" "CFG_LLVM_ROOT" "The host LLVM install"
printf " %-32s %s\n" "CFG_PREFIX" "The installation prefix"
printf " %-32s %s\n" "CFG_ONLY_GCC" "Prefer gcc to clang for building the runtime"
printf " %-32s %s\n" "CFG_TARGET_TRIPLES" "LLVM target triples"
echo ""
exit 0
fi
@ -363,8 +364,10 @@ then
fi
fi
# FIXME: add support for extending the target-triples list
CFG_TARGET_TRIPLES="${CFG_HOST_TRIPLE}"
if [ -z "$CFG_TARGET_TRIPLES" ]
then
CFG_TARGET_TRIPLES="${CFG_HOST_TRIPLE}"
fi
putvar CFG_HOST_TRIPLE
putvar CFG_TARGET_TRIPLES

View File

@ -1,19 +0,0 @@
######################################################################
# intrinsics.bc rules
######################################################################
# TODO: Use clang to compile the C++.
INTRINSICS_LL_IN := $(S)src/rt/intrinsics/intrinsics.ll.in
INTRINSICS_LL := intrinsics/intrinsics.ll
INTRINSICS_BC := intrinsics/intrinsics.bc
$(INTRINSICS_LL): $(INTRINSICS_LL_IN) $(MKFILES)
@$(call E, mkdir: intrinsics)
$(Q)mkdir -p intrinsics
@$(call E, sed: $@)
$(Q)sed s/@CFG_TARGET_TRIPLE@/$(CFG_LLVM_TRIPLE)/g $< > $@
$(INTRINSICS_BC): $(INTRINSICS_LL) $(MKFILES)
@$(call E, llvm-as: $@)
$(Q)$(LLVM_AS) -o $@ $<

View File

@ -15,17 +15,17 @@ INTR_HOST := $$(subst i686,i386,$$(TARGET_HOST))
$$(TARGET_LIB$(1)$(2))/intrinsics.ll: \
$$(S)src/rt/intrinsics/intrinsics.$$(INTR_HOST).ll.in
@$$(call E, sed: $$@)
sed s/@CFG_TARGET_TRIPLE@/$(2)/ $$< > $$@
$$(Q)sed s/@CFG_TARGET_TRIPLE@/$(2)/ $$< > $$@
$$(TARGET_LIB$(1)$(2))/intrinsics.bc: $$(TARGET_LIB$(1)$(2))/intrinsics.ll
@$$(call E, llvms-as: $$@)
$$(LLVM_AS) -o $$@ $$<
$$(Q)$$(LLVM_AS) -o $$@ $$<
$$(TARGET_LIB$(1)$(2))/$$(CFG_STDLIB): \
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
$$(TARGET_SREQ$(1)$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) --lib -o $$@ $$<
$$(STAGE$(1)_$(2)) --lib -o $$@ $$<
ifeq ($(1), 0)
# FIXME: temporary
@ -38,7 +38,7 @@ $$(TARGET_LIB$(1)$(2))/libstd.rlib: \
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
$$(TARGET_SREQ$(1)$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) --lib --static -o $$@ $$<
$$(STAGE$(1)_$(2)) --lib --static -o $$@ $$<
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUNTIME): rt/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
@ -54,7 +54,7 @@ $$(TARGET_BIN$(1)$(2))/rustc$$(X): \
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM) \
$$(TARGET_STDLIB_DEFAULT$(1)$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -o $$@ $$<
$$(STAGE$(1)_$(2)) -o $$@ $$<
$$(TARGET_LIB$(1)$(2))/$$(CFG_LIBRUSTC): \
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
@ -62,7 +62,7 @@ $$(TARGET_LIB$(1)$(2))/$$(CFG_LIBRUSTC): \
$$(TARGET_LIB$(1)$(2))/$$(CFG_RUSTLLVM) \
$$(TARGET_STDLIB_DEFAULT$(1)$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) --lib -o $$@ $$<
$$(STAGE$(1)_$(2)) --lib -o $$@ $$<
endef

View File

@ -150,7 +150,7 @@ check-stage$(1)-pretty-pretty: check-stage$(1)-pretty-pretty-dummy
test/stdtest.stage$(1)$$(X): $$(STDTEST_CRATE) $$(STDTEST_INPUTS) \
$$(SREQ$(1)$$(CFG_HOST_TRIPLE))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -o $$@ $$< --test
$$(STAGE$(1)_$$(CFG_HOST_TRIPLE)) -o $$@ $$< --test
check-stage$(1)-std-dummy: test/stdtest.stage$(1)$$(X)
@$$(call E, run: $$<)
@ -166,7 +166,7 @@ test/rustctest.stage$(1)$$(X): \
$$(TARGET_LIB$(1)$$(CFG_HOST_TRIPLE))/$$(CFG_RUSTLLVM) \
$$(TARGET_LIB$(1)$$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -o $$@ $$< --test
$$(STAGE$(1)_$$(CFG_HOST_TRIPLE)) -o $$@ $$< --test
check-stage$(1)-rustc-dummy: test/rustctest.stage$(1)$$(X)
@$$(call E, run: $$<)

View File

@ -18,7 +18,7 @@ $$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X): \
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB) \
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_LIBRUSTC)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -o $$@ $$<
$$(STAGE$(1)_$(CFG_HOST_TRIPLE)) -o $$@ $$<
# Promote the stageN target to stageN+1 host
# FIXME: Shouldn't need to depend on host/librustc.so once
@ -35,7 +35,7 @@ $$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/compiletest$$(X): \
$$(TARGET_SREQ$(1)$(CFG_HOST_TRIPLE)) \
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -o $$@ $$<
$$(STAGE$(1)_$(CFG_HOST_TRIPLE)) -o $$@ $$<
$$(HOST_BIN$(2))/compiletest$$(X): \
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/compiletest$$(X) \