Changeset 1021 for trunk/src/kmk/remake.c
- Timestamp:
- Jun 4, 2007, 2:58:37 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/remake.c
r1020 r1021 380 380 int running = 0; 381 381 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 382 struct file * dep_file;382 struct file *f2, *f3; 383 383 384 384 /* Always work on the primary multi target file. */ 385 385 386 if (file->multi_head != NULL && file->multi_head != file) 386 387 { 387 DBS (DB_VERBOSE, (_("Considering target file `%s' -> switching tomulti head `%s'.\n"),388 DBS (DB_VERBOSE, (_("Considering target file `%s' -> multi head `%s'.\n"), 388 389 file->name, file->multi_head->name)); 389 390 file = file->multi_head; 390 /* XXX: optimize dependencies. */391 391 } 392 392 else … … 442 442 not need an implicit rule. If this were not done, the file 443 443 might get implicit commands that apply to its initial name, only 444 to have that name replaced with another found by VPATH search. */ 445 444 to have that name replaced with another found by VPATH search. 445 446 For multi target files check the other files and use the time 447 of the oldest / non-existing file. */ 448 449 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 450 this_mtime = file_mtime (file); 451 f3 = file; 452 for (f2 = file->multi_next; 453 f2 != NULL && this_mtime != NONEXISTENT_MTIME; 454 f2 = f2->multi_next) 455 if (!f2->multi_maybe) 456 { 457 FILE_TIMESTAMP second_mtime = file_mtime (f2); 458 if (second_mtime < this_mtime) 459 { 460 this_mtime = second_mtime; 461 f3 = f2; 462 } 463 } 464 check_renamed (file); 465 noexist = this_mtime == NONEXISTENT_MTIME; 466 if (noexist) 467 DBS (DB_BASIC, (_("File `%s' does not exist.\n"), f3->name)); 468 #else /* !CONFIG_WITH_EXPLICIT_MULTITARGET */ 446 469 this_mtime = file_mtime (file); 447 470 check_renamed (file); … … 449 472 if (noexist) 450 473 DBF (DB_BASIC, _("File `%s' does not exist.\n")); 474 #endif /* !CONFIG_WITH_EXPLICIT_MULTITARGET */ 451 475 else if (ORDINARY_MTIME_MIN <= this_mtime && this_mtime <= ORDINARY_MTIME_MAX 452 476 && file->low_resolution_time) … … 483 507 and see whether any of them is more recent than this file. 484 508 For explicit multitarget rules we must iterate all the output 485 files to get the correct picture (this means re-evaluating 486 shared dependencies - bad). */ 509 files to get the correct picture. */ 487 510 488 511 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 489 for ( dep_file = file; dep_file; dep_file = dep_file->multi_next)512 for (f2 = file; f2; f2 = f2->multi_next) 490 513 { 491 514 lastd = 0; 492 d = dep_file->deps;515 d = f2->deps; 493 516 #else 494 517 lastd = 0; … … 510 533 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 511 534 /* silently ignore the order-only dep hack. */ 512 if ( dep_file->multi_maybe && d->file == file)535 if (f2->multi_maybe && d->file == file) 513 536 { 514 537 lastd = d; … … 520 543 error (NILF, _("Circular %s <- %s dependency dropped."), 521 544 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 522 dep_file->name, d->file->name);545 f2->name, d->file->name); 523 546 #else 524 547 file->name, d->file->name); … … 529 552 if (lastd == 0) 530 553 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 531 dep_file->deps = d->next;554 f2->deps = d->next; 532 555 #else 533 556 file->deps = d->next; … … 540 563 541 564 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 542 d->file->parent = dep_file;565 d->file->parent = f2; 543 566 #else 544 567 d->file->parent = file; … … 602 625 { 603 626 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 604 for ( dep_file = file; dep_file; dep_file = dep_file->multi_next)605 for (d = dep_file->deps; d != 0; d = d->next)627 for (f2 = file; f2; f2 = f2->multi_next) 628 for (d = f2->deps; d != 0; d = d->next) 606 629 #else 607 630 for (d = file->deps; d != 0; d = d->next) … … 614 637 check_renamed (d->file); 615 638 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 616 d->file->parent = dep_file;639 d->file->parent = f2; 617 640 #else 618 641 d->file->parent = file; … … 653 676 if (!running) 654 677 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 655 d->changed = (( dep_file->phony && dep_file->cmds != 0)678 d->changed = ((f2->phony && f2->cmds != 0) 656 679 #else 657 680 d->changed = ((file->phony && file->cmds != 0) … … 708 731 deps_changed = 0; 709 732 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 710 for ( dep_file = file; dep_file; dep_file = dep_file->multi_next)733 for (f2 = file; f2; f2 = f2->multi_next) 711 734 #endif 712 735 for (d = file->deps; d != 0; d = d->next) … … 714 737 FILE_TIMESTAMP d_mtime = file_mtime (d->file); 715 738 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 716 if (d->file == file && dep_file->multi_maybe)739 if (d->file == file && f2->multi_maybe) 717 740 continue; 718 741 #endif … … 819 842 } 820 843 821 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 822 if (ISDB(DB_BASIC) && file->multi_head && file->multi_head != file) 823 DBS (DB_BASIC, (_("Must remake target `%s' - primary target `%s'.\n"), file->name, file->multi_head->name)); 824 else 825 #endif 826 DBF (DB_BASIC, _("Must remake target `%s'.\n")); 844 DBF (DB_BASIC, _("Must remake target `%s'.\n")); 827 845 828 846 /* It needs to be remade. If it's VPATH and not reset via GPATH, toss the … … 1212 1230 { 1213 1231 #ifdef CONFIG_WITH_EXPLICIT_MULTITARGET 1214 /* Always operate on the primary file. */ 1215 if (file->multi_head && file->multi_head != file) 1216 file = file->multi_head; 1232 assert(file->multi_head == NULL || file->multi_head == file); 1217 1233 #endif 1218 1234
Note:
See TracChangeset
for help on using the changeset viewer.