auto merge of #8975 : alexcrichton/rust/reorganize, r=pnkfelix

Closes #2302
This commit is contained in:
bors 2013-09-05 01:05:47 -07:00
commit 422dcbd56d
7 changed files with 64 additions and 61 deletions

View File

@ -574,19 +574,10 @@ ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
all-target-$(target)-host-$(host)))
all: rustllvm/llvm-auto-clean-stamp \
$(ALL_TARGET_RULES) $(GENERATED) docs
all: $(ALL_TARGET_RULES) $(GENERATED) docs
endif
# This is used to independently force an LLVM clean rebuild
# when we changed something not otherwise captured by builtin
# dependencies. In these cases, commit a change that touches
# the stamp in the source dir.
rustllvm/llvm-auto-clean-stamp: $(S)src/rustllvm/llvm-auto-clean-trigger
$(Q)$(MAKE) clean-llvm
touch $@
######################################################################
# Re-configuration

15
configure vendored
View File

@ -664,32 +664,29 @@ do
make_dir $i
done
make_dir llvm
for t in $CFG_HOST_TRIPLES
do
make_dir llvm/$t
make_dir $t/llvm
done
make_dir rustllvm
for t in $CFG_HOST_TRIPLES
do
make_dir rustllvm/$t
make_dir $t/rustllvm
done
make_dir rt
for t in $CFG_TARGET_TRIPLES
do
make_dir rt/$t
make_dir $t/rt
for s in 0 1 2 3
do
make_dir rt/$t/stage$s
make_dir $t/rt/stage$s
for i in \
isaac linenoise sync test \
arch/i386 arch/x86_64 arch/arm arch/mips \
libuv libuv/src/ares libuv/src/eio libuv/src/ev \
jemalloc
do
make_dir rt/$t/stage$s/$i
make_dir $t/rt/stage$s/$i
done
done
done
@ -791,7 +788,7 @@ do
if [ -z $CFG_LLVM_ROOT ]
then
LLVM_BUILD_DIR=${CFG_BUILD_DIR}llvm/$t
LLVM_BUILD_DIR=${CFG_BUILD_DIR}$t/llvm
if [ ! -z "$CFG_DISABLE_OPTIMIZE_LLVM" ]
then
LLVM_DBG_OPTS="--enable-debug-symbols --disable-optimized"

View File

@ -33,7 +33,9 @@ clean: clean-misc $(CLEAN_STAGE_RULES)
clean-misc:
@$(call E, cleaning)
$(Q)find rustllvm rt $(CFG_BUILD_TRIPLE)/test \
$(Q)find $(CFG_BUILD_TRIPLE)/rustllvm \
$(CFG_BUILD_TRIPLE)/rt \
$(CFG_BUILD_TRIPLE)/test \
-name '*.[odasS]' -o \
-name '*.so' -o \
-name '*.dylib' -o \
@ -41,7 +43,7 @@ clean-misc:
-name '*.def' -o \
-name '*.bc' \
| xargs rm -f
$(Q)find rustllvm rt $(CFG_BUILD_TRIPLE)\
$(Q)find $(CFG_BUILD_TRIPLE)\
-name '*.dSYM' \
| xargs rm -Rf
$(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF)

View File

@ -24,12 +24,22 @@ define DEF_LLVM_RULES
# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
ifeq ($(CFG_LLVM_ROOT),)
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS)
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS) $$(LLVM_STAMP_$(1))
@$$(call E, make: llvm)
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV)
$$(Q)touch $$(LLVM_CONFIG_$(1))
endif
# This is used to independently force an LLVM clean rebuild
# when we changed something not otherwise captured by builtin
# dependencies. In these cases, commit a change that touches
# the stamp in the source dir.
$$(LLVM_STAMP_$(1)): $(S)src/rustllvm/llvm-auto-clean-trigger
$(Q)$(MAKE) clean-llvm
touch $$@
endef
$(foreach host,$(CFG_HOST_TRIPLES), \

View File

@ -91,61 +91,64 @@ RUNTIME_S_$(1)_$(2) := rt/arch/$$(HOST_$(1))/_context.S \
rt/arch/$$(HOST_$(1))/ccall.S \
rt/arch/$$(HOST_$(1))/record_sp.S
RT_OUTPUT_DIR_$(1) := $(1)/rt
RT_BUILD_DIR_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/stage$(2)
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
LIBUV_OSTYPE_$(1)_$(2) := win
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/jemalloc.lib
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/jemalloc.lib
else ifeq ($(OSTYPE_$(1)), apple-darwin)
LIBUV_OSTYPE_$(1)_$(2) := mac
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/libjemalloc_pic.a
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
LIBUV_OSTYPE_$(1)_$(2) := unix/freebsd
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/libjemalloc_pic.a
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
LIBUV_OSTYPE_$(1)_$(2) := unix/android
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/libjemalloc_pic.a
else
LIBUV_OSTYPE_$(1)_$(2) := unix/linux
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/libjemalloc_pic.a
endif
RUNTIME_DEF_$(1)_$(2) := rt/rustrt$(CFG_DEF_SUFFIX_$(1))
RUNTIME_DEF_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/rustrt$$(CFG_DEF_SUFFIX_$(1))
RUNTIME_INCS_$(1)_$(2) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \
-I $$(S)src/rt/arch/$$(HOST_$(1)) \
-I $$(S)src/rt/linenoise \
-I $$(S)src/libuv/include
RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=rt/$(1)/stage$(2)/%.o) \
$$(RUNTIME_CS_$(1)_$(2):rt/%.c=rt/$(1)/stage$(2)/%.o) \
$$(RUNTIME_S_$(1)_$(2):rt/%.S=rt/$(1)/stage$(2)/%.o)
RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \
$$(RUNTIME_CS_$(1)_$(2):rt/%.c=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \
$$(RUNTIME_S_$(1)_$(2):rt/%.S=$$(RT_BUILD_DIR_$(1)_$(2))/%.o)
ALL_OBJ_FILES += $$(RUNTIME_OBJS_$(1)_$(2))
MORESTACK_OBJ_$(1)_$(2) := rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/morestack.o
MORESTACK_OBJ_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/arch/$$(HOST_$(1))/morestack.o
ALL_OBJ_FILES += $$(MORESTACK_OBJS_$(1)_$(2))
rt/$(1)/stage$(2)/%.o: rt/%.cpp $$(MKFILE_DEPS)
$$(RT_BUILD_DIR_$(1)_$(2))/%.o: rt/%.cpp $$(MKFILE_DEPS)
@$$(call E, compile: $$@)
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@, $$(RUNTIME_INCS_$(1)_$(2)) \
$$(SNAP_DEFINES) $$(RUNTIME_CXXFLAGS_$(1)_$(2))) $$<
rt/$(1)/stage$(2)/%.o: rt/%.c $$(MKFILE_DEPS)
$$(RT_BUILD_DIR_$(1)_$(2))/%.o: rt/%.c $$(MKFILE_DEPS)
@$$(call E, compile: $$@)
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1)_$(2)) \
$$(SNAP_DEFINES) $$(RUNTIME_CFLAGS_$(1)_$(2))) $$<
rt/$(1)/stage$(2)/%.o: rt/%.S $$(MKFILE_DEPS) \
$$(RT_BUILD_DIR_$(1)_$(2))/%.o: rt/%.S $$(MKFILE_DEPS) \
$$(LLVM_CONFIG_$$(CFG_BUILD_TRIPLE))
@$$(call E, compile: $$@)
$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1)_$(2))
$$(RT_BUILD_DIR_$(1)_$(2))/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1)_$(2))
@$$(call E, link: $$@)
$$(Q)$(AR_$(1)) rcs $$@ $$<
rt/$(1)/stage$(2)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
$$(RT_BUILD_DIR_$(1)_$(2))/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1)_$(2)) $$(JEMALLOC_LIB_$(1)_$(2))
@$$(call E, link: $$@)
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
@ -171,7 +174,7 @@ endif
ifdef CFG_WINDOWSY_$(1)
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
OS=mingw \
V=$$(VERBOSE)
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
@ -185,7 +188,7 @@ $$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
AR="$$(AR_$(1))" \
PLATFORM=android \
BUILDTYPE=Release \
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
host=android OS=linux \
V=$$(VERBOSE)
else
@ -196,59 +199,59 @@ $$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
CC="$$(CC_$(1))" \
CXX="$$(CXX_$(1))" \
AR="$$(AR_$(1))" \
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
V=$$(VERBOSE)
endif
ifeq ($(OSTYPE_$(1)), linux-androideabi)
$$(JEMALLOC_LIB_$(1)_$(2)):
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure \
cd $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc; $(S)src/rt/jemalloc/configure \
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) --disable-tls \
EXTRA_CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
CC="$$(CC_$(1))" \
CXX="$$(CXX_$(1))" \
AR="$$(AR_$(1))"
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
$$(Q)$$(MAKE) -C $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc
else
$$(JEMALLOC_LIB_$(1)_$(2)):
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure \
cd $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc; $(S)src/rt/jemalloc/configure \
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) \
EXTRA_CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
CC="$$(CC_$(1))" \
CXX="$$(CXX_$(1))" \
AR="$$(AR_$(1))"
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
$$(Q)$$(MAKE) -C $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc
endif
# These could go in rt.mk or rustllvm.mk, they're needed for both.
# This regexp has a single $, escaped twice
%.bsd.def: %.def.in $$(MKFILE_DEPS)
$(1)/%.bsd.def: %.def.in $$(MKFILE_DEPS)
@$$(call E, def: $$@)
$$(Q)echo "{" > $$@
$$(Q)sed 's/.$$$$/&;/' $$< >> $$@
$$(Q)echo "};" >> $$@
%.linux.def: %.def.in $$(MKFILE_DEPS)
$(1)/%.linux.def: %.def.in $$(MKFILE_DEPS)
@$$(call E, def: $$@)
$$(Q)echo "{" > $$@
$$(Q)sed 's/.$$$$/&;/' $$< >> $$@
$$(Q)echo "};" >> $$@
%.darwin.def: %.def.in $$(MKFILE_DEPS)
$(1)/%.darwin.def: %.def.in $$(MKFILE_DEPS)
@$$(call E, def: $$@)
$$(Q)sed 's/^./_&/' $$< > $$@
%.android.def: %.def.in $$(MKFILE_DEPS)
$(1)/%.android.def: %.def.in $$(MKFILE_DEPS)
@$$(call E, def: $$@)
$$(Q)echo "{" > $$@
$$(Q)sed 's/.$$$$/&;/' $$< >> $$@
$$(Q)echo "};" >> $$@
%.mingw32.def: %.def.in $$(MKFILE_DEPS)
$(1)/%.mingw32.def: %.def.in $$(MKFILE_DEPS)
@$$(call E, def: $$@)
$$(Q)echo LIBRARY $$* > $$@
$$(Q)echo EXPORTS >> $$@

View File

@ -24,15 +24,15 @@ endif
RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, RustWrapper.cpp PassWrapper.cpp)
RUSTLLVM_DEF_$(1) := rustllvm/rustllvm$(CFG_DEF_SUFFIX_$(1))
RUSTLLVM_DEF_$(1) := $(1)/rustllvm/rustllvm$(CFG_DEF_SUFFIX_$(1))
RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
-iquote $$(LLVM_INCDIR_$(1)) \
-iquote $$(S)src/rustllvm/include
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=rustllvm/$(1)/%.o)
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
rustllvm/$(1)/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
$$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1))
@$$(call E, link: $$@)
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
@ -40,7 +40,7 @@ rustllvm/$(1)/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) \
$$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM_$(1)))
rustllvm/$(1)/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
$(1)/rustllvm/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
@$$(call E, compile: $$@)
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@, $$(LLVM_CXXFLAGS_$(1)) $$(RUSTLLVM_INCS_$(1))) $$<
endef

View File

@ -39,14 +39,14 @@ WFLAGS_ST2 = -D warnings
define TARGET_STAGE_N
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
rt/$(2)/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \
$(2)/rt/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
$(SNAPSHOT_RUSTC_POST_CLEANUP)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
rt/$(2)/stage$(1)/$(CFG_RUNTIME_$(2)) \
$(2)/rt/stage$(1)/$(CFG_RUNTIME_$(2)) \
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
$(SNAPSHOT_RUSTC_POST_CLEANUP)
@$$(call E, cp: $$@)
@ -86,7 +86,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
rustllvm/$(2)/$(CFG_RUSTLLVM_$(3)) \
$(2)/rustllvm/$(CFG_RUSTLLVM_$(3)) \
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
$(SNAPSHOT_RUSTC_POST_CLEANUP)
@$$(call E, cp: $$@)