Skip to content

Commit 7b3dd32

Browse files
committed
Move the rt build directory under $target
Closes #2302
1 parent 6b3c7cb commit 7b3dd32

File tree

5 files changed

+45
-41
lines changed

5 files changed

+45
-41
lines changed

configure

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,20 +674,19 @@ do
674674
make_dir $t/rustllvm
675675
done
676676

677-
make_dir rt
678677
for t in $CFG_TARGET_TRIPLES
679678
do
680-
make_dir rt/$t
679+
make_dir $t/rt
681680
for s in 0 1 2 3
682681
do
683-
make_dir rt/$t/stage$s
682+
make_dir $t/rt/stage$s
684683
for i in \
685684
isaac linenoise sync test \
686685
arch/i386 arch/x86_64 arch/arm arch/mips \
687686
libuv libuv/src/ares libuv/src/eio libuv/src/ev \
688687
jemalloc
689688
do
690-
make_dir rt/$t/stage$s/$i
689+
make_dir $t/rt/stage$s/$i
691690
done
692691
done
693692
done

mk/clean.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ clean: clean-misc $(CLEAN_STAGE_RULES)
3333

3434
clean-misc:
3535
@$(call E, cleaning)
36-
$(Q)find $(CFG_BUILD_TRIPLE)/rustllvm rt $(CFG_BUILD_TRIPLE)/test \
36+
$(Q)find $(CFG_BUILD_TRIPLE)/rustllvm \
37+
$(CFG_BUILD_TRIPLE)/rt \
38+
$(CFG_BUILD_TRIPLE)/test \
3739
-name '*.[odasS]' -o \
3840
-name '*.so' -o \
3941
-name '*.dylib' -o \
4042
-name '*.dll' -o \
4143
-name '*.def' -o \
4244
-name '*.bc' \
4345
| xargs rm -f
44-
$(Q)find rustllvm rt $(CFG_BUILD_TRIPLE)\
46+
$(Q)find $(CFG_BUILD_TRIPLE)\
4547
-name '*.dSYM' \
4648
| xargs rm -Rf
4749
$(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF)

mk/rt.mk

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -92,61 +92,64 @@ RUNTIME_S_$(1)_$(2) := rt/arch/$$(HOST_$(1))/_context.S \
9292
rt/arch/$$(HOST_$(1))/ccall.S \
9393
rt/arch/$$(HOST_$(1))/record_sp.S
9494

95+
RT_OUTPUT_DIR_$(1) := $(1)/rt
96+
RT_BUILD_DIR_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/stage$(2)
97+
9598
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
9699
LIBUV_OSTYPE_$(1)_$(2) := win
97-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
98-
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/jemalloc.lib
100+
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
101+
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/jemalloc.lib
99102
else ifeq ($(OSTYPE_$(1)), apple-darwin)
100103
LIBUV_OSTYPE_$(1)_$(2) := mac
101-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
102-
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
104+
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
105+
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/libjemalloc_pic.a
103106
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
104107
LIBUV_OSTYPE_$(1)_$(2) := unix/freebsd
105-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
106-
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
108+
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
109+
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/libjemalloc_pic.a
107110
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
108111
LIBUV_OSTYPE_$(1)_$(2) := unix/android
109-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
110-
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
112+
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
113+
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/libjemalloc_pic.a
111114
else
112115
LIBUV_OSTYPE_$(1)_$(2) := unix/linux
113-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
114-
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
116+
LIBUV_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/libuv/libuv.a
117+
JEMALLOC_LIB_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc/lib/libjemalloc_pic.a
115118
endif
116119

117-
RUNTIME_DEF_$(1)_$(2) := rt/rustrt$(CFG_DEF_SUFFIX_$(1))
120+
RUNTIME_DEF_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/rustrt$$(CFG_DEF_SUFFIX_$(1))
118121
RUNTIME_INCS_$(1)_$(2) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \
119122
-I $$(S)src/rt/arch/$$(HOST_$(1)) \
120123
-I $$(S)src/rt/linenoise \
121124
-I $$(S)src/libuv/include
122-
RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=rt/$(1)/stage$(2)/%.o) \
123-
$$(RUNTIME_CS_$(1)_$(2):rt/%.c=rt/$(1)/stage$(2)/%.o) \
124-
$$(RUNTIME_S_$(1)_$(2):rt/%.S=rt/$(1)/stage$(2)/%.o)
125+
RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \
126+
$$(RUNTIME_CS_$(1)_$(2):rt/%.c=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \
127+
$$(RUNTIME_S_$(1)_$(2):rt/%.S=$$(RT_BUILD_DIR_$(1)_$(2))/%.o)
125128
ALL_OBJ_FILES += $$(RUNTIME_OBJS_$(1)_$(2))
126129

127-
MORESTACK_OBJ_$(1)_$(2) := rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/morestack.o
130+
MORESTACK_OBJ_$(1)_$(2) := $$(RT_BUILD_DIR_$(1)_$(2))/arch/$$(HOST_$(1))/morestack.o
128131
ALL_OBJ_FILES += $$(MORESTACK_OBJS_$(1)_$(2))
129132

130-
rt/$(1)/stage$(2)/%.o: rt/%.cpp $$(MKFILE_DEPS)
133+
$$(RT_BUILD_DIR_$(1)_$(2))/%.o: rt/%.cpp $$(MKFILE_DEPS)
131134
@$$(call E, compile: $$@)
132135
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@, $$(RUNTIME_INCS_$(1)_$(2)) \
133136
$$(SNAP_DEFINES) $$(RUNTIME_CXXFLAGS_$(1)_$(2))) $$<
134137

135-
rt/$(1)/stage$(2)/%.o: rt/%.c $$(MKFILE_DEPS)
138+
$$(RT_BUILD_DIR_$(1)_$(2))/%.o: rt/%.c $$(MKFILE_DEPS)
136139
@$$(call E, compile: $$@)
137140
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1)_$(2)) \
138141
$$(SNAP_DEFINES) $$(RUNTIME_CFLAGS_$(1)_$(2))) $$<
139142

140-
rt/$(1)/stage$(2)/%.o: rt/%.S $$(MKFILE_DEPS) \
143+
$$(RT_BUILD_DIR_$(1)_$(2))/%.o: rt/%.S $$(MKFILE_DEPS) \
141144
$$(LLVM_CONFIG_$$(CFG_BUILD_TRIPLE))
142145
@$$(call E, compile: $$@)
143146
$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
144147

145-
rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1)_$(2))
148+
$$(RT_BUILD_DIR_$(1)_$(2))/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1)_$(2))
146149
@$$(call E, link: $$@)
147150
$$(Q)$(AR_$(1)) rcs $$@ $$<
148151

149-
rt/$(1)/stage$(2)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
152+
$$(RT_BUILD_DIR_$(1)_$(2))/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
150153
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1)_$(2)) $$(JEMALLOC_LIB_$(1)_$(2))
151154
@$$(call E, link: $$@)
152155
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
@@ -172,7 +175,7 @@ endif
172175
ifdef CFG_WINDOWSY_$(1)
173176
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
174177
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
175-
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
178+
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
176179
OS=mingw \
177180
V=$$(VERBOSE)
178181
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
@@ -186,7 +189,7 @@ $$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
186189
AR="$$(AR_$(1))" \
187190
PLATFORM=android \
188191
BUILDTYPE=Release \
189-
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
192+
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
190193
host=android OS=linux \
191194
V=$$(VERBOSE)
192195
else
@@ -197,59 +200,59 @@ $$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
197200
CC="$$(CC_$(1))" \
198201
CXX="$$(CXX_$(1))" \
199202
AR="$$(AR_$(1))" \
200-
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
203+
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
201204
V=$$(VERBOSE)
202205
endif
203206

204207
ifeq ($(OSTYPE_$(1)), linux-androideabi)
205208
$$(JEMALLOC_LIB_$(1)_$(2)):
206-
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure \
209+
cd $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc; $(S)src/rt/jemalloc/configure \
207210
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) --disable-tls \
208211
EXTRA_CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
209212
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
210213
CC="$$(CC_$(1))" \
211214
CXX="$$(CXX_$(1))" \
212215
AR="$$(AR_$(1))"
213-
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
216+
$$(Q)$$(MAKE) -C $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc
214217
else
215218
$$(JEMALLOC_LIB_$(1)_$(2)):
216-
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure \
219+
cd $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc; $(S)src/rt/jemalloc/configure \
217220
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) \
218221
EXTRA_CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
219222
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
220223
CC="$$(CC_$(1))" \
221224
CXX="$$(CXX_$(1))" \
222225
AR="$$(AR_$(1))"
223-
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
226+
$$(Q)$$(MAKE) -C $$(RT_BUILD_DIR_$(1)_$(2))/jemalloc
224227
endif
225228

226229

227230
# These could go in rt.mk or rustllvm.mk, they're needed for both.
228231

229232
# This regexp has a single $, escaped twice
230-
%.bsd.def: %.def.in $$(MKFILE_DEPS)
233+
$(1)/%.bsd.def: %.def.in $$(MKFILE_DEPS)
231234
@$$(call E, def: $$@)
232235
$$(Q)echo "{" > $$@
233236
$$(Q)sed 's/.$$$$/&;/' $$< >> $$@
234237
$$(Q)echo "};" >> $$@
235238

236-
%.linux.def: %.def.in $$(MKFILE_DEPS)
239+
$(1)/%.linux.def: %.def.in $$(MKFILE_DEPS)
237240
@$$(call E, def: $$@)
238241
$$(Q)echo "{" > $$@
239242
$$(Q)sed 's/.$$$$/&;/' $$< >> $$@
240243
$$(Q)echo "};" >> $$@
241244

242-
%.darwin.def: %.def.in $$(MKFILE_DEPS)
245+
$(1)/%.darwin.def: %.def.in $$(MKFILE_DEPS)
243246
@$$(call E, def: $$@)
244247
$$(Q)sed 's/^./_&/' $$< > $$@
245248

246-
%.android.def: %.def.in $$(MKFILE_DEPS)
249+
$(1)/%.android.def: %.def.in $$(MKFILE_DEPS)
247250
@$$(call E, def: $$@)
248251
$$(Q)echo "{" > $$@
249252
$$(Q)sed 's/.$$$$/&;/' $$< >> $$@
250253
$$(Q)echo "};" >> $$@
251254

252-
%.mingw32.def: %.def.in $$(MKFILE_DEPS)
255+
$(1)/%.mingw32.def: %.def.in $$(MKFILE_DEPS)
253256
@$$(call E, def: $$@)
254257
$$(Q)echo LIBRARY $$* > $$@
255258
$$(Q)echo EXPORTS >> $$@

mk/rustllvm.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif
2424

2525
RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, RustWrapper.cpp PassWrapper.cpp)
2626

27-
RUSTLLVM_DEF_$(1) := rustllvm/rustllvm$(CFG_DEF_SUFFIX_$(1))
27+
RUSTLLVM_DEF_$(1) := $(1)/rustllvm/rustllvm$(CFG_DEF_SUFFIX_$(1))
2828

2929
RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
3030
-iquote $$(LLVM_INCDIR_$(1)) \

mk/target.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ WFLAGS_ST2 = -D warnings
3939
define TARGET_STAGE_N
4040

4141
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
42-
rt/$(2)/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \
42+
$(2)/rt/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \
4343
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
4444
$(SNAPSHOT_RUSTC_POST_CLEANUP)
4545
@$$(call E, cp: $$@)
4646
$$(Q)cp $$< $$@
4747

4848
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
49-
rt/$(2)/stage$(1)/$(CFG_RUNTIME_$(2)) \
49+
$(2)/rt/stage$(1)/$(CFG_RUNTIME_$(2)) \
5050
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
5151
$(SNAPSHOT_RUSTC_POST_CLEANUP)
5252
@$$(call E, cp: $$@)

0 commit comments

Comments
 (0)