@@ -13,12 +13,13 @@ import std.option.none;
13
13
import std. _str ;
14
14
import std. _vec ;
15
15
16
- impure fn compile_input ( session. session sess, str input, str output) {
16
+ impure fn compile_input ( session. session sess, str input, str output,
17
+ bool shared) {
17
18
auto p = parser. new_parser ( sess, 0 , input) ;
18
19
auto crate = parser. parse_crate ( p) ;
19
20
crate = resolve. resolve_crate ( sess, crate ) ;
20
21
crate = typeck. check_crate ( sess, crate ) ;
21
- trans. trans_crate ( sess, crate , output) ;
22
+ trans. trans_crate ( sess, crate , output, shared ) ;
22
23
}
23
24
24
25
fn warn_wrong_compiler ( ) {
@@ -34,6 +35,7 @@ fn usage(session.session sess, str argv0) {
34
35
log "" ;
35
36
log " -o <filename> write output to <filename>" ;
36
37
log " -nowarn suppress wrong-compiler warning" ;
38
+ log " -shared compile a shared-library crate" ;
37
39
log " -h display this message" ;
38
40
log "" ;
39
41
log "" ;
@@ -59,6 +61,7 @@ impure fn main(vec[str] args) {
59
61
let option. t[ str] input_file = none[ str] ;
60
62
let option. t[ str] output_file = none[ str] ;
61
63
let bool do_warn = true ;
64
+ let bool shared = false ;
62
65
63
66
auto i = 1 u;
64
67
auto len = _vec. len [ str] ( args) ;
@@ -69,6 +72,8 @@ impure fn main(vec[str] args) {
69
72
if ( _str. byte_len ( arg) > 0 u && arg. ( 0 ) == '-' as u8 ) {
70
73
if ( _str. eq ( arg, "-nowarn" ) ) {
71
74
do_warn = false ;
75
+ } else if ( _str. eq ( arg, "-shared" ) ) {
76
+ shared = true ;
72
77
} else {
73
78
// FIXME: rust could use an elif construct.
74
79
if ( _str. eq ( arg, "-o" ) ) {
@@ -120,10 +125,10 @@ impure fn main(vec[str] args) {
120
125
parts = _vec. pop [ str] ( parts) ;
121
126
parts += ".bc" ;
122
127
auto ofile = _str. concat ( parts) ;
123
- compile_input ( sess, ifile, ofile) ;
128
+ compile_input ( sess, ifile, ofile, shared ) ;
124
129
}
125
130
case ( some[ str] ( ?ofile) ) {
126
- compile_input ( sess, ifile, ofile) ;
131
+ compile_input ( sess, ifile, ofile, shared ) ;
127
132
}
128
133
}
129
134
}
0 commit comments