From 7b3dd32797994fbe833653618125e479d2ad3fc4 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 4 Sep 2013 00:45:01 -0700 Subject: [PATCH] Move the `rt` build directory under $target Closes #2302 --- configure | 7 +++--- mk/clean.mk | 6 +++-- mk/rt.mk | 67 ++++++++++++++++++++++++++------------------------ mk/rustllvm.mk | 2 +- mk/target.mk | 4 +-- 5 files changed, 45 insertions(+), 41 deletions(-) diff --git a/configure b/configure index de6256057e0..fff961b734c 100755 --- a/configure +++ b/configure @@ -674,20 +674,19 @@ do 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 diff --git a/mk/clean.mk b/mk/clean.mk index 5eefa5395b4..f38396cafff 100644 --- a/mk/clean.mk +++ b/mk/clean.mk @@ -33,7 +33,9 @@ clean: clean-misc $(CLEAN_STAGE_RULES) clean-misc: @$(call E, cleaning) - $(Q)find $(CFG_BUILD_TRIPLE)/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) diff --git a/mk/rt.mk b/mk/rt.mk index c260945cbc9..cfa26b8e97c 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -92,61 +92,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)) \ @@ -172,7 +175,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) @@ -186,7 +189,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 @@ -197,59 +200,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 >> $$@ diff --git a/mk/rustllvm.mk b/mk/rustllvm.mk index d2f993855af..8c3bf4e05b9 100644 --- a/mk/rustllvm.mk +++ b/mk/rustllvm.mk @@ -24,7 +24,7 @@ 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)) \ diff --git a/mk/target.mk b/mk/target.mk index 7cd442ccb4d..e540d856ecd 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -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: $$@)