Skip to content

Commit 3a1241a

Browse files
committed
---
yaml --- r: 65269 b: refs/heads/master c: 264c84b h: refs/heads/master i: 65267: df1c772 v: v3
1 parent 297a028 commit 3a1241a

File tree

5 files changed

+69
-75
lines changed

5 files changed

+69
-75
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9a40c5c8ddb9055124cb12a710dc23b24276c9ac
2+
refs/heads/master: 264c84b892f531f968b1ab9c9b8e15f2c66cf524
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/configure

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -665,16 +665,12 @@ make_dir rt
665665
for t in $CFG_TARGET_TRIPLES
666666
do
667667
make_dir rt/$t
668-
for s in 0 1 2 3
668+
for i in \
669+
isaac linenoise sync test \
670+
arch/i386 arch/x86_64 arch/arm arch/mips \
671+
libuv libuv/src/ares libuv/src/eio libuv/src/ev
669672
do
670-
make_dir rt/$t/stage$s
671-
for i in \
672-
isaac linenoise sync test \
673-
arch/i386 arch/x86_64 arch/arm arch/mips \
674-
libuv libuv/src/ares libuv/src/eio libuv/src/ev
675-
do
676-
make_dir rt/$t/stage$s/$i
677-
done
673+
make_dir rt/$t/$i
678674
done
679675
done
680676

trunk/mk/rt.mk

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,14 @@ ifneq ($(strip $(findstring snap,$(MAKECMDGOALS))),)
4141
SNAP_DEFINES=-DRUST_SNAPSHOT
4242
endif
4343

44+
4445
define DEF_RUNTIME_TARGETS
4546

4647
######################################################################
4748
# Runtime (C++) library variables
4849
######################################################################
4950

50-
# $(1) is the target triple
51-
# $(2) is the stage number
52-
53-
RUNTIME_CFLAGS_$(1)_$(2) = -D_RUST_STAGE$(2)
54-
RUNTIME_CXXFLAGS_$(1)_$(2) = -D_RUST_STAGE$(2)
55-
56-
RUNTIME_CXXS_$(1)_$(2) := \
51+
RUNTIME_CXXS_$(1) := \
5752
rt/sync/timer.cpp \
5853
rt/sync/lock_and_signal.cpp \
5954
rt/sync/rust_thread.cpp \
@@ -88,70 +83,70 @@ RUNTIME_CXXS_$(1)_$(2) := \
8883
rt/rust_android_dummy.cpp \
8984
rt/rust_test_helpers.cpp
9085

91-
RUNTIME_CS_$(1)_$(2) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
86+
RUNTIME_CS_$(1) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
9287

93-
RUNTIME_S_$(1)_$(2) := rt/arch/$$(HOST_$(1))/_context.S \
94-
rt/arch/$$(HOST_$(1))/ccall.S \
95-
rt/arch/$$(HOST_$(1))/record_sp.S
88+
RUNTIME_S_$(1) := rt/arch/$$(HOST_$(1))/_context.S \
89+
rt/arch/$$(HOST_$(1))/ccall.S \
90+
rt/arch/$$(HOST_$(1))/record_sp.S
9691

9792
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
98-
LIBUV_OSTYPE_$(1)_$(2) := win
99-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
93+
LIBUV_OSTYPE_$(1) := win
94+
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
10095
else ifeq ($(OSTYPE_$(1)), apple-darwin)
101-
LIBUV_OSTYPE_$(1)_$(2) := mac
102-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
96+
LIBUV_OSTYPE_$(1) := mac
97+
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
10398
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
104-
LIBUV_OSTYPE_$(1)_$(2) := unix/freebsd
105-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
99+
LIBUV_OSTYPE_$(1) := unix/freebsd
100+
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
106101
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
107-
LIBUV_OSTYPE_$(1)_$(2) := unix/android
108-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
102+
LIBUV_OSTYPE_$(1) := unix/android
103+
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
109104
else
110-
LIBUV_OSTYPE_$(1)_$(2) := unix/linux
111-
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
105+
LIBUV_OSTYPE_$(1) := unix/linux
106+
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
112107
endif
113108

114-
RUNTIME_DEF_$(1)_$(2) := rt/rustrt$(CFG_DEF_SUFFIX_$(1))
115-
RUNTIME_INCS_$(1)_$(2) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \
109+
RUNTIME_DEF_$(1) := rt/rustrt$(CFG_DEF_SUFFIX_$(1))
110+
RUNTIME_INCS_$(1) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \
116111
-I $$(S)src/rt/arch/$$(HOST_$(1)) \
117112
-I $$(S)src/rt/linenoise \
118113
-I $$(S)src/libuv/include
119-
RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=rt/$(1)/stage$(2)/%.o) \
120-
$$(RUNTIME_CS_$(1)_$(2):rt/%.c=rt/$(1)/stage$(2)/%.o) \
121-
$$(RUNTIME_S_$(1)_$(2):rt/%.S=rt/$(1)/stage$(2)/%.o)
122-
ALL_OBJ_FILES += $$(RUNTIME_OBJS_$(1)_$(2))
114+
RUNTIME_OBJS_$(1) := $$(RUNTIME_CXXS_$(1):rt/%.cpp=rt/$(1)/%.o) \
115+
$$(RUNTIME_CS_$(1):rt/%.c=rt/$(1)/%.o) \
116+
$$(RUNTIME_S_$(1):rt/%.S=rt/$(1)/%.o)
117+
ALL_OBJ_FILES += $$(RUNTIME_OBJS_$(1))
123118

124-
MORESTACK_OBJ_$(1)_$(2) := rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/morestack.o
125-
ALL_OBJ_FILES += $$(MORESTACK_OBJS_$(1)_$(2))
119+
MORESTACK_OBJ_$(1) := rt/$(1)/arch/$$(HOST_$(1))/morestack.o
120+
ALL_OBJ_FILES += $$(MORESTACK_OBJS_$(1))
126121

127-
RUNTIME_LIBS_$(1)_$(2) := $$(LIBUV_LIB_$(1)_$(2))
122+
RUNTIME_LIBS_$(1) := $$(LIBUV_LIB_$(1))
128123

129-
rt/$(1)/stage$(2)/%.o: rt/%.cpp $$(MKFILE_DEPS)
124+
rt/$(1)/%.o: rt/%.cpp $$(MKFILE_DEPS)
130125
@$$(call E, compile: $$@)
131-
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@, $$(RUNTIME_INCS_$(1)_$(2)) \
132-
$$(SNAP_DEFINES) $$(RUNTIME_CXXFLAGS_$(1)_$(2))) $$<
126+
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@, $$(RUNTIME_INCS_$(1)) \
127+
$$(SNAP_DEFINES)) $$<
133128

134-
rt/$(1)/stage$(2)/%.o: rt/%.c $$(MKFILE_DEPS)
129+
rt/$(1)/%.o: rt/%.c $$(MKFILE_DEPS)
135130
@$$(call E, compile: $$@)
136-
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1)_$(2)) \
137-
$$(SNAP_DEFINES) $$(RUNTIME_CFLAGS_$(1)_$(2))) $$<
131+
$$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(RUNTIME_INCS_$(1)) \
132+
$$(SNAP_DEFINES)) $$<
138133

139-
rt/$(1)/stage$(2)/%.o: rt/%.S $$(MKFILE_DEPS) \
134+
rt/$(1)/%.o: rt/%.S $$(MKFILE_DEPS) \
140135
$$(LLVM_CONFIG_$$(CFG_BUILD_TRIPLE))
141136
@$$(call E, compile: $$@)
142137
$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)
143138

144-
rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1)_$(2))
139+
rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1))
145140
@$$(call E, link: $$@)
146141
$$(Q)$(AR_$(1)) rcs $$@ $$<
147142

148-
rt/$(1)/stage$(2)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
149-
$$(RUNTIME_DEF_$(1)_$(2)) \
150-
$$(RUNTIME_LIBS_$(1)_$(2))
143+
rt/$(1)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \
144+
$$(RUNTIME_DEF_$(1)) \
145+
$$(RUNTIME_LIBS_$(1))
151146
@$$(call E, link: $$@)
152-
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
153-
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(RUNTIME_LIBS_$(1)_$(2)) \
154-
$$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)_$(2)),$$(CFG_RUNTIME_$(1)))
147+
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)) \
148+
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(RUNTIME_LIBS_$(1)) \
149+
$$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)),$$(CFG_RUNTIME_$(1)))
155150

156151
# FIXME: For some reason libuv's makefiles can't figure out the
157152
# correct definition of CC on the mingw I'm using, so we are
@@ -170,32 +165,32 @@ endif
170165

171166
# XXX: Shouldn't need platform-specific conditions here
172167
ifdef CFG_WINDOWSY_$(1)
173-
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
168+
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
174169
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
175-
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
170+
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
176171
OS=mingw \
177172
V=$$(VERBOSE)
178173
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
179-
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
174+
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
180175
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
181176
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
182177
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
183178
CC="$$(CC_$(1))" \
184179
CXX="$$(CXX_$(1))" \
185180
AR="$$(AR_$(1))" \
186181
BUILDTYPE=Release \
187-
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
182+
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
188183
host=android OS=linux \
189184
V=$$(VERBOSE)
190185
else
191-
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
186+
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
192187
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
193188
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
194189
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
195190
CC="$$(CC_$(1))" \
196191
CXX="$$(CXX_$(1))" \
197192
AR="$$(AR_$(1))" \
198-
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
193+
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
199194
V=$$(VERBOSE)
200195
endif
201196

@@ -234,6 +229,5 @@ endif
234229
endef
235230

236231
# Instantiate template for all stages
237-
$(foreach stage,$(STAGES), \
238-
$(foreach target,$(CFG_TARGET_TRIPLES), \
239-
$(eval $(call DEF_RUNTIME_TARGETS,$(target),$(stage)))))
232+
$(foreach target,$(CFG_TARGET_TRIPLES), \
233+
$(eval $(call DEF_RUNTIME_TARGETS,$(target))))

trunk/mk/target.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
define TARGET_STAGE_N
1919

2020
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
21-
rt/$(2)/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \
21+
rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a \
2222
| $$(TLIB$(1)_T_$(2)_H_$(3))/
2323
@$$(call E, cp: $$@)
2424
$$(Q)cp $$< $$@
2525

2626
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
27-
rt/$(2)/stage$(1)/$(CFG_RUNTIME_$(2)) \
27+
rt/$(2)/$(CFG_RUNTIME_$(2)) \
2828
| $$(TLIB$(1)_T_$(2)_H_$(3))/
2929
@$$(call E, cp: $$@)
3030
$$(Q)cp $$< $$@

trunk/src/librust/rust.rc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ extern mod rustc;
3232
use core::prelude::*;
3333

3434
use core::run;
35+
use core::libc::exit;
3536

3637
enum ValidUsage {
37-
Valid, Invalid
38+
Valid(int), Invalid
3839
}
3940

4041
impl ValidUsage {
4142
fn is_valid(&self) -> bool {
4243
match *self {
43-
Valid => true,
44-
Invalid => false
44+
Valid(_) => true,
45+
Invalid => false
4546
}
4647
}
4748
}
@@ -144,7 +145,7 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
144145
UsgStr(msg) => io::println(fmt!("%s\n", msg)),
145146
UsgCall(f) => f(),
146147
}
147-
Valid
148+
Valid(0)
148149
},
149150
None => Invalid
150151
}
@@ -162,8 +163,8 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
162163
let test_exec = Path(filename).filestem().unwrap() + "test~";
163164
invoke("rustc", &[~"--test", filename.to_owned(),
164165
~"-o", test_exec.to_owned()], rustc::main);
165-
run::run_program(~"./" + test_exec, []);
166-
Valid
166+
let exit_code = run::run_program(~"./" + test_exec, []);
167+
Valid(exit_code)
167168
}
168169
_ => Invalid
169170
}
@@ -175,8 +176,8 @@ fn cmd_run(args: &[~str]) -> ValidUsage {
175176
let exec = Path(filename).filestem().unwrap() + "~";
176177
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
177178
rustc::main);
178-
run::run_program(~"./"+exec, prog_args);
179-
Valid
179+
let exit_code = run::run_program(~"./"+exec, prog_args);
180+
Valid(exit_code)
180181
}
181182
_ => Invalid
182183
}
@@ -194,7 +195,7 @@ fn do_command(command: &Command, args: &[~str]) -> ValidUsage {
194195
Call(f) => f(args),
195196
CallMain(prog, f) => {
196197
invoke(prog, args, f);
197-
Valid
198+
Valid(0)
198199
}
199200
}
200201
}
@@ -233,7 +234,10 @@ pub fn main() {
233234
if !args.is_empty() {
234235
for find_cmd(*args.head()).each |command| {
235236
let result = do_command(command, args.tail());
236-
if result.is_valid() { return; }
237+
match result {
238+
Valid(exit_code) => unsafe { exit(exit_code.to_i32()) },
239+
_ => loop
240+
}
237241
}
238242
}
239243

0 commit comments

Comments
 (0)