Print this page
make: unifdef for TEAMWARE_MAKE_CMN (defined)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/doname.cc
          +++ new/usr/src/cmd/make/bin/doname.cc
↓ open down ↓ 281 lines elided ↑ open up ↑
 282  282   *              keep_state      Indicates that .KEEP_STATE is on
 283  283   *              parallel        True if building in parallel
 284  284   *              recursion_level Used for tracing
 285  285   *              report_dependencies make -P is on
 286  286   */
 287  287  Doname
 288  288  doname(register Name target, register Boolean do_get, register Boolean implicit, register Boolean automatic)
 289  289  {
 290  290          Doname                  result = build_dont_know;
 291  291          Chain                   out_of_date_list = NULL;
 292      -#ifdef TEAMWARE_MAKE_CMN
 293  292          Chain                   target_group;
 294      -#endif
 295  293          Property                old_locals = NULL;
 296  294          register Property       line;
 297  295          Property                command = NULL;
 298  296          register Dependency     dependency;
 299  297          Name                    less = NULL;
 300  298          Name                    true_target = target;
 301  299          Name                    *automatics = NULL;
 302  300          register int            auto_count;
 303  301          Boolean                 rechecking_target = false;
 304  302          Boolean                 saved_commands_done;
 305  303          Boolean                 restart = false;
 306  304          Boolean                 save_parallel = parallel;
 307  305          Boolean                 doing_subtree = false;
 308  306  
 309  307          Boolean                 recheck_conditionals = false;
 310  308  
 311  309          if (target->state == build_running) {
 312  310                  return build_running;
 313  311          }
 314  312          line = get_prop(target->prop, line_prop);
 315      -#ifdef TEAMWARE_MAKE_CMN
 316  313          if (line != NULL) {
 317  314                  /*
 318  315                   * If this target is a member of target group and one of the
 319  316                   * other members of the group is running, mark this target
 320  317                   * as running.
 321  318                   */
 322  319                  for (target_group = line->body.line.target_group;
 323  320                       target_group != NULL;
 324  321                       target_group = target_group->next) {
 325  322                          if (is_running(target_group->name)) {
 326  323                                  target->state = build_running;
 327  324                                  add_pending(target,
 328  325                                              recursion_level,
 329  326                                              do_get,
 330  327                                              implicit,
 331  328                                              false);
 332  329                                  return build_running;
 333  330                          }
 334  331                  }
 335  332          }
 336      -#endif
 337  333          /*
 338  334           * If the target is a constructed one for a "::" target,
 339  335           * we need to consider that.
 340  336           */
 341  337          if (target->has_target_prop) {
 342  338                  true_target = get_prop(target->prop,
 343  339                                         target_prop)->body.target.target;
 344  340                  if (true_target->colon_splits > 0) {
 345  341                          /* Make sure we have a valid time for :: targets */
 346  342                          Property        time;
↓ open down ↓ 25 lines elided ↑ open up ↑
 372  368                          /*
 373  369                           * This target has been started before and therefore
 374  370                           * not all dependencies have to be built.
 375  371                           */
 376  372                          restart = true;
 377  373                  }
 378  374          } else if (target->state == build_pending) {
 379  375                  target->state = build_dont_know;
 380  376                  restart = true;
 381  377  /*
 382      -#ifdef TEAMWARE_MAKE_CMN
 383  378          } else if (parallel &&
 384  379                     keep_state &&
 385  380                     (target->conditional_cnt > 0)) {
 386  381              if (!parallel_ok(target, false)) {
 387  382                  add_subtree(target, recursion_level, do_get, implicit);
 388  383                  target->state = build_running;
 389  384                  return build_running;
 390  385              }
 391      -#endif
 392  386   */
 393  387          }
 394  388          /*
 395  389           * If KEEP_STATE is on, we have to rebuild the target if the
 396  390           * building of it caused new automatic dependencies to be reported.
 397  391           * This is where we restart the build.
 398  392           */
 399  393          if (line != NULL) {
 400  394                  line->body.line.percent = NULL;
 401  395          }
↓ open down ↓ 123 lines elided ↑ open up ↑
 525  519                  /* Look for percent matched rule */
 526  520                  if ((result == build_dont_know) &&
 527  521                      (command == NULL)) {
 528  522                          switch (find_percent_rule(
 529  523                                          target,
 530  524                                          &command,
 531  525                                          recheck_conditionals)) {
 532  526                          case build_failed:
 533  527                                  result = build_failed;
 534  528                                  break;
 535      -#ifdef TEAMWARE_MAKE_CMN
 536  529                          case build_running:
 537  530                                  target->state = build_running;
 538  531                                  add_pending(target,
 539  532                                              --recursion_level,
 540  533                                              do_get,
 541  534                                              implicit,
 542  535                                              false);
 543  536                                  if (target->conditional_cnt > 0) {
 544  537                                          reset_locals(target,
 545  538                                                       old_locals,
 546  539                                                       get_prop(target->prop,
 547  540                                                               conditional_prop),
 548  541                                                       0);
 549  542                                  }
 550  543                                  return build_running;
 551      -#endif
 552  544                          case build_ok:
 553  545                                  result = build_ok;
 554  546                                  break;
 555  547                          }
 556  548                  }
 557  549                  /* Look for double suffix rule */
 558  550                  if (result == build_dont_know) {
 559  551                          Property member;
 560  552  
 561  553                          if (target->is_member &&
 562  554                              ((member = get_prop(target->prop, member_prop)) !=
 563  555                               NULL)) {
 564  556                                  switch (find_ar_suffix_rule(target,
 565  557                                                  member->body.
 566  558                                                  member.member,
 567  559                                                  &command,
 568  560                                                  recheck_conditionals)) {
 569  561                                  case build_failed:
 570  562                                          result = build_failed;
 571  563                                          break;
 572      -#ifdef TEAMWARE_MAKE_CMN
 573  564                                  case build_running:
 574  565                                          target->state = build_running;
 575  566                                          add_pending(target,
 576  567                                                      --recursion_level,
 577  568                                                      do_get,
 578  569                                                      implicit,
 579  570                                                      false);
 580  571                                      if (target->conditional_cnt > 0) {
 581  572                                              reset_locals(target,
 582  573                                                           old_locals,
 583  574                                                           get_prop(target->prop,
 584  575                                                               conditional_prop),
 585  576                                                           0);
 586  577                                      }
 587  578                                          return build_running;
 588      -#endif
 589  579                                  default:
 590  580                                          /* ALWAYS bind $% for old style */
 591  581                                          /* ar rules */
 592  582                                          if (line == NULL) {
 593  583                                                  line =
 594  584                                                    maybe_append_prop(target,
 595  585                                                                      line_prop);
 596  586                                          }
 597  587                                          line->body.line.percent =
 598  588                                            member->body.member.member;
 599  589                                          break;
 600  590                                  }
 601  591                          } else {
 602  592                                  switch (find_double_suffix_rule(target,
 603  593                                                  &command,
 604  594                                                  recheck_conditionals)) {
 605  595                                  case build_failed:
 606  596                                          result = build_failed;
 607  597                                          break;
 608      -#ifdef TEAMWARE_MAKE_CMN
 609  598                                  case build_running:
 610  599                                          target->state = build_running;
 611  600                                          add_pending(target,
 612  601                                                      --recursion_level,
 613  602                                                      do_get,
 614  603                                                      implicit,
 615  604                                                      false);
 616  605                                          if (target->conditional_cnt > 0) {
 617  606                                                  reset_locals(target,
 618  607                                                               old_locals,
 619  608                                                               get_prop(target->
 620  609                                                                        prop,
 621  610                                                                        conditional_prop),
 622  611                                                               0);
 623  612                                          }
 624  613                                          return build_running;
 625      -#endif
 626  614                                  }
 627  615                          }
 628  616                  }
 629  617                  /* Look for single suffix rule */
 630  618  
 631  619  /* /tolik/
 632  620   * I commented !implicit to fix bug 1247448: Suffix Rules failed when combine with Pattern Matching Rules.
 633  621   * This caused problem with SVR4 tilde rules (infinite recursion). So I made some changes in "implicit.cc"
 634  622   */
 635  623  /* /tolik, 06.21.96/
↓ open down ↓ 12 lines elided ↑ open up ↑
 648  636                       ((line->body.line.target != NULL) &&
 649  637                        !line->body.line.target->has_regular_dependency))) {
 650  638                          switch (find_suffix_rule(target,
 651  639                                                   target,
 652  640                                                   empty_name,
 653  641                                                   &command,
 654  642                                                   recheck_conditionals)) {
 655  643                          case build_failed:
 656  644                                  result = build_failed;
 657  645                                  break;
 658      -#ifdef TEAMWARE_MAKE_CMN
 659  646                          case build_running:
 660  647                                  target->state = build_running;
 661  648                                  add_pending(target,
 662  649                                              --recursion_level,
 663  650                                              do_get,
 664  651                                              implicit,
 665  652                                              false);
 666  653                                  if (target->conditional_cnt > 0) {
 667  654                                          reset_locals(target,
 668  655                                                       old_locals,
 669  656                                                       get_prop(target->prop,
 670  657                                                               conditional_prop),
 671  658                                                       0);
 672  659                                  }
 673  660                                  return build_running;
 674      -#endif
 675  661                          }
 676  662                  }
 677  663                  /* Try to sccs get */
 678  664                  if ((command == NULL) &&
 679  665                      (result == build_dont_know) &&
 680  666                      do_get) {
 681  667                          result = sccs_get(target, &command);
 682  668                  }
 683  669  
 684  670                  /* Use .DEFAULT rule if it is defined. */
↓ open down ↓ 53 lines elided ↑ open up ↑
 738  724          int doname_dyntarget = 0;
 739  725  r_command:
 740  726          /* Run commands if any. */
 741  727          if ((command != NULL) &&
 742  728              (command->body.line.command_template != NULL)) {
 743  729                  if (result != build_failed) {
 744  730                          result = run_command(command, 
 745  731                                               (Boolean) ((parallel || save_parallel) && !silent));
 746  732                  }
 747  733                  switch (result) {
 748      -#ifdef TEAMWARE_MAKE_CMN
 749  734                  case build_running:
 750  735                          add_running(target,
 751  736                                      true_target,
 752  737                                      command,
 753  738                                      --recursion_level,
 754  739                                      auto_count,
 755  740                                      automatics,
 756  741                                      do_get,
 757  742                                      implicit);
 758  743                          target->state = build_running;
↓ open down ↓ 26 lines elided ↑ open up ↑
 785  770                                  line->body.line.query = NULL;
 786  771                          }
 787  772                          if (target->conditional_cnt > 0) {
 788  773                                  reset_locals(target,
 789  774                                               old_locals,
 790  775                                               get_prop(target->prop,
 791  776                                                       conditional_prop),
 792  777                                               0);
 793  778                          }
 794  779                          return build_running;
 795      -#endif
 796  780                  case build_ok:
 797  781                          /* If all went OK set a nice timestamp */
 798  782                          if (true_target->stat.time == file_doesnt_exist) {
 799  783                                  true_target->stat.time = file_max_time;
 800  784                          }
 801  785                          break;
 802  786                  }
 803  787          } else {
 804  788                  /*
 805  789                   * If no command was found for the target, and it doesn't
↓ open down ↓ 133 lines elided ↑ open up ↑
 939  923   *
 940  924   *      Global variables used:
 941  925   *              command_changed Set if we suspect .make.state needs rewrite
 942  926   *              debug_level     Should we trace actions?
 943  927   *              force           The Name " FORCE", compared against
 944  928   *              recursion_level Used for tracing
 945  929   *              rewrite_statefile Set if .make.state needs rewriting
 946  930   *              wait_name       The Name ".WAIT", compared against
 947  931   */
 948  932  static Boolean
 949      -#ifdef TEAMWARE_MAKE_CMN
 950  933  check_dependencies(Doname *result, Property line, Boolean do_get, Name target, Name true_target, Boolean doing_subtree, Chain *out_of_date_tail, Property old_locals, Boolean implicit, Property *command, Name less, Boolean rechecking_target, Boolean recheck_conditionals)
 951      -#else
 952      -check_dependencies(Doname *result, Property line, Boolean do_get, Name target, Name true_target, Boolean, Chain *out_of_date_tail, Property, Boolean, Property *command, Name less, Boolean rechecking_target, Boolean recheck_conditionals)
 953      -#endif
 954  934  {
 955  935          Boolean                 dependencies_running;
 956  936          register Dependency     dependency;
 957  937          Doname                  dep_result;
 958  938          Boolean                 dependency_changed = false;
 959  939  
 960  940          line->body.line.dependency_time = file_doesnt_exist;
 961  941          if (line->body.line.query != NULL) {
 962  942                  delete_query_chain(line->body.line.query);
 963  943          }
↓ open down ↓ 192 lines elided ↑ open up ↑
1156 1136                                          }
1157 1137                                  }
1158 1138                          }
1159 1139                          if (dependency->name == force) {
1160 1140                                  force->stat.time =
1161 1141                                    file_max_time;
1162 1142                                  force->state = build_dont_know;
1163 1143                          }
1164 1144                  }
1165 1145          }
1166      -#ifdef TEAMWARE_MAKE_CMN
1167 1146          if (dependencies_running) {
1168 1147                  if (doing_subtree) {
1169 1148                          if (target->conditional_cnt > 0) {
1170 1149                                  reset_locals(target,
1171 1150                                               old_locals,
1172 1151                                               get_prop(target->prop,
1173 1152                                                        conditional_prop),
1174 1153                                               0);
1175 1154                          }
1176 1155                          return true;
↓ open down ↓ 7 lines elided ↑ open up ↑
1184 1163                          if (target->conditional_cnt > 0) {
1185 1164                                  reset_locals(target,
1186 1165                                               old_locals,
1187 1166                                               get_prop(target->prop,
1188 1167                                                        conditional_prop),
1189 1168                                               0);
1190 1169                          }
1191 1170                          return true;
1192 1171                  }
1193 1172          }
1194      -#endif
1195 1173          /*
1196 1174           * Collect the timestamp of the youngest double colon target
1197 1175           * dependency.
1198 1176           */
1199 1177          if (target->is_double_colon_parent) {
1200 1178                  for (dependency = line->body.line.dependencies;
1201 1179                       dependency != NULL;
1202 1180                       dependency = dependency->next) {
1203 1181                          Property        tmp_line;
1204 1182  
↓ open down ↓ 403 lines elided ↑ open up ↑
1608 1586                          build_command_strings(target, line);
1609 1587                  }
1610 1588          }
1611 1589          /* Never mind */
1612 1590          if (!line->body.line.is_out_of_date) {
1613 1591                  return build_ok;
1614 1592          }
1615 1593          /* If quest, then exit(1) because the target is out of date */
1616 1594          if (quest) {
1617 1595                  if (posix) {
1618      -#ifdef TEAMWARE_MAKE_CMN
1619 1596                          result = execute_parallel(line, true);
1620      -#else
1621      -                        result = execute_serial(line);
1622      -#endif
1623 1597                  }
1624 1598                  exit_status = 1;
1625 1599                  exit(1);
1626 1600          }
1627 1601          /* We actually had to do something this time */
1628 1602          rewrite_statefile = commands_done = true;
1629 1603          /*
1630 1604           * If this is an sccs command, we have to do some extra checking
1631 1605           * and possibly complain. If the file can't be gotten because it's
1632 1606           * checked out, we complain and behave as if the command was
↓ open down ↓ 59 lines elided ↑ open up ↑
1692 1666          /*
1693 1667           * We also need to be able to save an empty command instead of the
1694 1668           * interrupted one in .make.state.
1695 1669           */
1696 1670          current_line = line;
1697 1671          if (remember_only) {
1698 1672                  /* Empty block!!! */
1699 1673          } else if (touch) {
1700 1674                  result = touch_command(line, target, result);
1701 1675                  if (posix) {
1702      -#ifdef TEAMWARE_MAKE_CMN
1703 1676                          result = execute_parallel(line, true);
1704      -#else
1705      -                        result = execute_serial(line);
1706      -#endif
1707 1677                  }
1708 1678          } else {
1709 1679                  /*
1710 1680                   * If this is not a touch run, we need to execute the
1711 1681                   * proper command(s) for the target.
1712 1682                   */
1713      -#ifdef TEAMWARE_MAKE_CMN
1714 1683                  if (parallel) {
1715 1684                          if (!parallel_ok(target, true)) {
1716 1685                                  /*
1717 1686                                   * We are building in parallel, but
1718 1687                                   * this target must be built in serial.
1719 1688                                   */
1720 1689                                  /*
1721 1690                                   * If nothing else is building,
1722 1691                                   * do this one, else wait.
1723 1692                                   */
1724 1693                                  if (parallel_process_cnt == 0) {
1725      -#ifdef TEAMWARE_MAKE_CMN
1726 1694                                          result = execute_parallel(line, true, target->localhost);
1727      -#else
1728      -                                        result = execute_serial(line);
1729      -#endif
1730 1695                                  } else {
1731 1696                                          current_target = NULL;
1732 1697                                          current_line = NULL;
1733 1698  /*
1734 1699                                          line->body.line.command_used = NULL;
1735 1700   */
1736 1701                                          line->body.line.dont_rebuild_command_used = true;
1737 1702                                          return build_serial;
1738 1703                                  }
1739 1704                          } else {
1740 1705                                  result = execute_parallel(line, false);
1741 1706                                  switch (result) {
1742 1707                                  case build_running:
1743 1708                                          return build_running;
1744 1709                                  case build_serial:
1745 1710                                          if (parallel_process_cnt == 0) {
1746      -#ifdef TEAMWARE_MAKE_CMN
1747 1711                                                  result = execute_parallel(line, true, target->localhost);
1748      -#else
1749      -                                                result = execute_serial(line);
1750      -#endif
1751 1712                                          } else {
1752 1713                                                  current_target = NULL;
1753 1714                                                  current_line = NULL;
1754 1715                                                  target->parallel = false;
1755 1716                                                  line->body.line.command_used =
1756 1717                                                                          NULL;
1757 1718                                                  return build_serial;
1758 1719                                          }
1759 1720                                  }
1760 1721                          }
1761 1722                  } else {
1762      -#endif
1763      -#ifdef TEAMWARE_MAKE_CMN
1764 1723                          result = execute_parallel(line, true, target->localhost);
1765      -#else
1766      -                        result = execute_serial(line);
1767      -#endif
1768      -#ifdef TEAMWARE_MAKE_CMN
1769 1724                  }
1770      -#endif
1771 1725          }
1772 1726          temp_file_name = NULL;
1773 1727          if (report_dependencies_level == 0){
1774 1728                  update_target(line, result);
1775 1729          }
1776 1730          current_target = NULL;
1777 1731          current_line = NULL;
1778 1732          return result;
1779 1733  }
1780 1734  
↓ open down ↓ 1597 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX