@@ -8,16 +8,18 @@ use std::process::Command;
8
8
9
9
fn main ( ) {
10
10
// Read environment variables set by cargo
11
- let out_dir_path = env:: var ( "OUT_DIR" ) . expect ( "Missing OUT_DIR environment variable" ) ;
12
- let out_dir = Path :: new ( & out_dir_path) ;
13
-
14
11
let cargo_path = env:: var ( "CARGO" ) . expect ( "Missing CARGO environment variable" ) ;
15
12
let cargo = Path :: new ( & cargo_path) ;
16
13
17
14
let manifest_dir_path =
18
15
env:: var ( "CARGO_MANIFEST_DIR" ) . expect ( "Missing CARGO_MANIFEST_DIR environment variable" ) ;
19
16
let manifest_dir = Path :: new ( & manifest_dir_path) ;
20
17
18
+ // Find the root project target dir
19
+ let current_dir = env:: current_dir ( ) . expect ( "Couldn't get current directory" ) ;
20
+ let target_dir_rel = manifest_dir. join ( "target" ) ;
21
+ let target_dir = current_dir. join ( target_dir_rel) ;
22
+
21
23
// Find the objcopy binary
22
24
let llvm_tools = LlvmTools :: new ( ) . expect ( "LLVM tools not found" ) ;
23
25
let objcopy = llvm_tools
@@ -34,7 +36,7 @@ fn main() {
34
36
"dap_load_failed" ,
35
37
] ,
36
38
"../i8086-real_mode.json" ,
37
- & out_dir ,
39
+ & target_dir ,
38
40
& objcopy,
39
41
& cargo,
40
42
) ;
@@ -44,7 +46,7 @@ fn main() {
44
46
Path :: new ( "src/real/stage_2" ) ,
45
47
& [ "second_stage" ] ,
46
48
"../i8086-real_mode.json" ,
47
- & out_dir ,
49
+ & target_dir ,
48
50
& objcopy,
49
51
& cargo,
50
52
) ;
@@ -54,7 +56,7 @@ fn build_subproject(
54
56
subproject_dir : & Path ,
55
57
global_symbols : & [ & str ] ,
56
58
target_file_path : & str ,
57
- root_out_dir : & Path ,
59
+ root_target_dir : & Path ,
58
60
objcopy : & Path ,
59
61
cargo : & Path ,
60
62
) {
@@ -66,7 +68,8 @@ fn build_subproject(
66
68
let target_file = Path :: new ( & target_file_path)
67
69
. file_stem ( )
68
70
. expect ( "Couldn't get target file stem" ) ;
69
- let target_dir = root_out_dir. join ( "target" ) . join ( & subproject_name) ;
71
+
72
+ let target_dir = root_target_dir. join ( & subproject_name) ;
70
73
71
74
// We have to export at least 1 symbol
72
75
assert ! (
@@ -83,6 +86,9 @@ fn build_subproject(
83
86
// Build in release mode
84
87
build_cmd. arg ( "build" ) . arg ( "--release" ) ;
85
88
89
+ // Very verbose (build script output only shows if you use `-vv` or it fails anyway)
90
+ build_cmd. arg ( "-vv" ) ;
91
+
86
92
// Cross-compile core (cargo-xbuild no longer needed)
87
93
build_cmd. arg ( "-Zbuild-std=core" ) ;
88
94
0 commit comments