Automatically add a -L to the directory the binary is in.
This commit is contained in:
parent
982f51aa95
commit
1dbc0442cd
|
@ -109,13 +109,13 @@ STAGE0 := $(Q)$(call CFG_RUN_TARG,stage0,\
|
||||||
stage0/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage0)
|
stage0/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage0)
|
||||||
STAGE1 := $(Q)$(call CFG_RUN_TARG,stage0, \
|
STAGE1 := $(Q)$(call CFG_RUN_TARG,stage0, \
|
||||||
$(CFG_VALGRIND_COMPILE) stage1/rustc$(X) \
|
$(CFG_VALGRIND_COMPILE) stage1/rustc$(X) \
|
||||||
$(CFG_RUSTC_FLAGS) -L stage1)
|
$(CFG_RUSTC_FLAGS))
|
||||||
STAGE2 := $(Q)$(call CFG_RUN_TARG,stage1, \
|
STAGE2 := $(Q)$(call CFG_RUN_TARG,stage1, \
|
||||||
$(CFG_VALGRIND_COMPILE) stage2/rustc$(X) \
|
$(CFG_VALGRIND_COMPILE) stage2/rustc$(X) \
|
||||||
$(CFG_RUSTC_FLAGS) -L stage2)
|
$(CFG_RUSTC_FLAGS))
|
||||||
STAGE3 := $(Q)$(call CFG_RUN_TARG,stage2, \
|
STAGE3 := $(Q)$(call CFG_RUN_TARG,stage2, \
|
||||||
$(CFG_VALGRIND_COMPILE) stage3/rustc$(X) \
|
$(CFG_VALGRIND_COMPILE) stage3/rustc$(X) \
|
||||||
$(CFG_RUSTC_FLAGS) -L stage3)
|
$(CFG_RUSTC_FLAGS))
|
||||||
|
|
||||||
# "Source" files we generate in builddir along the way.
|
# "Source" files we generate in builddir along the way.
|
||||||
GENERATED :=
|
GENERATED :=
|
||||||
|
|
|
@ -202,10 +202,11 @@ fn build_target_config() -> @session::config {
|
||||||
ret target_cfg;
|
ret target_cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_session_options(str binary, getopts::match match) ->
|
fn build_session_options(str binary, getopts::match match, str binary_dir) ->
|
||||||
@session::options {
|
@session::options {
|
||||||
auto shared = opt_present(match, "shared");
|
auto shared = opt_present(match, "shared");
|
||||||
auto library_search_paths = getopts::opt_strs(match, "L");
|
auto library_search_paths = [binary_dir];
|
||||||
|
library_search_paths += getopts::opt_strs(match, "L");
|
||||||
auto output_type =
|
auto output_type =
|
||||||
if (opt_present(match, "parse-only")) {
|
if (opt_present(match, "parse-only")) {
|
||||||
link::output_type_none
|
link::output_type_none
|
||||||
|
@ -297,6 +298,7 @@ fn main(vec[str] args) {
|
||||||
optflag("time-llvm-passes"), optflag("no-typestate"),
|
optflag("time-llvm-passes"), optflag("no-typestate"),
|
||||||
optflag("noverify")];
|
optflag("noverify")];
|
||||||
auto binary = vec::shift[str](args);
|
auto binary = vec::shift[str](args);
|
||||||
|
auto binary_dir = fs::dirname(binary);
|
||||||
auto match =
|
auto match =
|
||||||
alt (getopts::getopts(args, opts)) {
|
alt (getopts::getopts(args, opts)) {
|
||||||
case (getopts::success(?m)) { m }
|
case (getopts::success(?m)) { m }
|
||||||
|
@ -313,7 +315,7 @@ fn main(vec[str] args) {
|
||||||
version(binary);
|
version(binary);
|
||||||
ret;
|
ret;
|
||||||
}
|
}
|
||||||
auto sopts = build_session_options(binary, match);
|
auto sopts = build_session_options(binary, match, binary_dir);
|
||||||
auto sess = build_session(sopts);
|
auto sess = build_session(sopts);
|
||||||
auto n_inputs = vec::len[str](match.free);
|
auto n_inputs = vec::len[str](match.free);
|
||||||
auto output_file = getopts::opt_maybe_str(match, "o");
|
auto output_file = getopts::opt_maybe_str(match, "o");
|
||||||
|
@ -391,7 +393,6 @@ fn main(vec[str] args) {
|
||||||
//
|
//
|
||||||
// TODO: Factor this out of main.
|
// TODO: Factor this out of main.
|
||||||
if (sopts.output_type == link::output_type_exe) {
|
if (sopts.output_type == link::output_type_exe) {
|
||||||
auto binary_dir = fs::dirname(binary);
|
|
||||||
let str glu = binary_dir + "/glue.o";
|
let str glu = binary_dir + "/glue.o";
|
||||||
let str main = "rt/main.o";
|
let str main = "rt/main.o";
|
||||||
let str stage = "-L" + binary_dir;
|
let str stage = "-L" + binary_dir;
|
||||||
|
|
Loading…
Reference in New Issue