1
1
// -*- rust -*-
2
2
3
+ import front.creader;
3
4
import front.parser;
4
5
import front.token;
5
6
import front.eval;
@@ -53,10 +54,12 @@ impure fn parse_input(session.session sess,
53
54
impure fn compile_input(session.session sess,
54
55
eval.env env,
55
56
str input, str output,
56
- bool shared) {
57
+ bool shared,
58
+ vec[str] library_search_paths) {
57
59
auto def = tup(0, 0);
58
60
auto p = parser.new_parser(sess, env, def, input);
59
61
auto crate = parse_input(sess, p, input);
62
+ crate = creader.read_crates(sess, crate);
60
63
crate = resolve.resolve_crate(sess, crate);
61
64
crate = typeck.check_crate(sess, crate);
62
65
trans.trans_crate(sess, crate, output, shared);
@@ -87,6 +90,7 @@ fn usage(session.session sess, str argv0) {
87
90
log " -glue generate glue.bc file";
88
91
log " -shared compile a shared-library crate";
89
92
log " -pp pretty-print the input instead of compiling";
93
+ log " -L <path> add a directory to the library search path";
90
94
log " -h display this message";
91
95
log "";
92
96
log "";
@@ -111,6 +115,7 @@ impure fn main(vec[str] args) {
111
115
auto sess = session.session(target_cfg);
112
116
let option.t[str] input_file = none[str];
113
117
let option.t[str] output_file = none[str];
118
+ let vec[str] library_search_paths = vec();
114
119
let bool do_warn = true;
115
120
let bool shared = false;
116
121
let bool pretty = false;
@@ -139,6 +144,14 @@ impure fn main(vec[str] args) {
139
144
usage(sess, args.(0));
140
145
sess.err("-o requires an argument");
141
146
}
147
+ } else if (_str.eq(arg, "-L")) {
148
+ if (i+1u < len) {
149
+ library_search_paths += vec(args.(i+1u));
150
+ i += 1u;
151
+ } else {
152
+ usage(sess, args.(0));
153
+ sess.err("-L requires an argument");
154
+ }
142
155
} else if (_str.eq(arg, "-h")) {
143
156
usage(sess, args.(0));
144
157
} else {
@@ -193,10 +206,12 @@ impure fn main(vec[str] args) {
193
206
parts = _vec.pop[str](parts);
194
207
parts += ".bc";
195
208
auto ofile = _str.concat(parts);
196
- compile_input(sess, env, ifile, ofile, shared);
209
+ compile_input(sess, env, ifile, ofile, shared,
210
+ library_search_paths);
197
211
}
198
212
case (some[str](?ofile)) {
199
- compile_input(sess, env, ifile, ofile, shared);
213
+ compile_input(sess, env, ifile, ofile, shared,
214
+ library_search_paths);
200
215
}
201
216
}
202
217
}
0 commit comments