| @@ -247,7 +247,6 @@ int main(int argc, char **argv) · 246 unmodified lines |
| 247 | 247 | TCCState *s; |
| 248 | 248 | int ret, optind, i, bench; |
| 249 | 249 | int64_t start_time = 0; |
| 250 | | − const char *first_file = NULL; |
| 251 | 250 | |
| 252 | 251 | s = tcc_new(); |
| 253 | 252 | |
| @@ -286,7 +285,7 @@ int main(int argc, char **argv) · 32 unmodified lines |
| 286 | 285 | tcc_error("cannot specify multiple files with -c and -o"); |
| 287 | 286 | } |
| 288 | 287 | } |
| 289 | | − |
| 288 | + |
| 290 | 289 | if (s->output_type == TCC_OUTPUT_PREPROCESS) { |
| 291 | 290 | if (!s->outfile) { |
| 292 | 291 | s->ppfp = stdout; |
| @@ -315,17 +314,16 @@ int main(int argc, char **argv) · 22 unmodified lines |
| 315 | 314 | } else { |
| 316 | 315 | if (1 == s->verbose) |
| 317 | 316 | printf("-> %s\n", filename); |
| 317 | + if (!s->outfile) |
| 318 | + s->outfile = default_outputfile(s, filename); |
| 318 | 319 | if (tcc_add_file(s, filename, filetype) < 0) |
| 319 | 320 | ret = 1; |
| 320 | 321 | else |
| 321 | 322 | if (s->output_type == TCC_OUTPUT_OBJ) { |
| 322 | | − if (!s->outfile) |
| 323 | | − s->outfile = default_outputfile(s, filename); |
| 324 | 323 | ret = !!tcc_output_file(s, s->outfile); |
| 324 | + if (s->gen_deps && !ret) |
| 325 | + gen_makedeps(s, s->outfile, s->deps_outfile); |
| 325 | 326 | if (!ret) { |
| 326 | | − /* dump collected dependencies */ |
| 327 | | − if (s->gen_deps) |
| 328 | | − gen_makedeps(s, s->outfile, s->deps_outfile); |
| 329 | 327 | if ((i+1) < s->nb_files) { |
| 330 | 328 | tcc_delete(s); |
| 331 | 329 | s = tcc_new(); |
| @@ -337,9 +335,6 @@ int main(int argc, char **argv) · 5 unmodified lines |
| 337 | 335 | } |
| 338 | 336 | } |
| 339 | 337 | } |
| 340 | | − else |
| 341 | | − if (!first_file) |
| 342 | | − first_file = filename; |
| 343 | 338 | } |
| 344 | 339 | } |
| 345 | 340 | |
| @@ -354,14 +349,11 @@ int main(int argc, char **argv) · 8 unmodified lines |
| 354 | 349 | tcc_error_noabort("-run is not available in a cross compiler"); |
| 355 | 350 | ret = 1; |
| 356 | 351 | #endif |
| 357 | | − } else if (s->output_type == TCC_OUTPUT_PREPROCESS) { |
| 358 | | − if (s->outfile) |
| 359 | | − fclose(s->ppfp); |
| 360 | | − } else if (s->output_type != TCC_OUTPUT_OBJ) { |
| 361 | | − if (!s->outfile) |
| 362 | | − s->outfile = default_outputfile(s, first_file); |
| 352 | + } else |
| 353 | + if (s->output_type == TCC_OUTPUT_EXE || |
| 354 | + s->output_type == TCC_OUTPUT_DLL) |
| 355 | + { |
| 363 | 356 | ret = !!tcc_output_file(s, s->outfile); |
| 364 | | − /* dump collected dependencies */ |
| 365 | 357 | if (s->gen_deps && !ret) |
| 366 | 358 | gen_makedeps(s, s->outfile, s->deps_outfile); |
| 367 | 359 | } |