Print this page
make: unifdef for MAKETOOL and DISTRIBUTED (undefined)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/main.cc
          +++ new/usr/src/cmd/make/bin/main.cc
↓ open down ↓ 30 lines elided ↑ open up ↑
  31   31   
  32   32  /*
  33   33   * Included files
  34   34   */
  35   35  #if defined(TEAMWARE_MAKE_CMN)
  36   36  #       include <avo/intl.h>
  37   37  #endif
  38   38  
  39   39  #include <bsd/bsd.h>            /* bsd_signal() */
  40   40  
  41      -#ifdef DISTRIBUTED
  42      -#       include <dm/Avo_AcknowledgeMsg.h>
  43      -#       include <rw/xdrstrea.h>
  44      -#       include <dmrc/dmrc.h> /* dmakerc file processing */
  45      -#endif
  46   41  
  47   42  #include <locale.h>             /* setlocale() */
  48   43  #include <mk/defs.h>
  49   44  #include <mksdmsi18n/mksdmsi18n.h>      /* libmksdmsi18n_init() */
  50   45  #include <mksh/macro.h>         /* getvar() */
  51   46  #include <mksh/misc.h>          /* getmem(), setup_char_semantics() */
  52   47  
  53   48  #if defined(TEAMWARE_MAKE_CMN)
  54   49  #endif
  55   50  
↓ open down ↓ 102 lines elided ↑ open up ↑
 158  153  static  void            read_files_and_state(int, char **);
 159  154  static  Boolean         read_makefile(Name, Boolean, Boolean, Boolean);
 160  155  static  void            report_recursion(Name);
 161  156  static  void            set_sgs_support(void);
 162  157  static  void            setup_for_projectdir(void);
 163  158  static  void            setup_makeflags_argv(void);
 164  159  static  void            report_dir_enter_leave(Boolean entering);
 165  160  
 166  161  extern void expand_value(Name, register String , Boolean);
 167  162  
 168      -#ifdef DISTRIBUTED
 169      -        extern  int             dmake_ofd;
 170      -        extern  FILE*           dmake_ofp;
 171      -        extern  int             rxmPid;
 172      -        extern  XDR             xdrs_out;
 173      -#endif
 174  163  #ifdef TEAMWARE_MAKE_CMN
 175  164          static const char       verstring[] = "illumos make";
 176  165  #endif
 177  166  
 178  167  jmp_buf jmpbuffer;
 179  168  extern nl_catd catd;
 180  169  
 181  170  /*
 182  171   *      main(argc, argv)
 183  172   *
↓ open down ↓ 54 lines elided ↑ open up ↑
 238  227          }
 239  228  #endif
 240  229  
 241  230  #if defined(TEAMWARE_MAKE_CMN)
 242  231          catd = catopen(AVO_DOMAIN_DMAKE, NL_CAT_LOCALE);
 243  232  #endif
 244  233  
 245  234  // ---> fprintf(stderr, catgets(catd, 15, 666, "--- SUN make ---\n"));
 246  235  
 247  236  
 248      -#if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL)
      237 +#if defined(TEAMWARE_MAKE_CMN)
 249  238  /*
 250  239   * I put libmksdmsi18n_init() under #ifdef because it requires avo_i18n_init()
 251  240   * from avo_util library. 
 252  241   */
 253  242          libmksdmsi18n_init();
 254  243  #endif
 255  244  
 256  245  
 257  246  #ifndef TEAMWARE_MAKE_CMN
 258  247          textdomain(NOCATGETS("SUNW_SPRO_MAKE"));
↓ open down ↓ 210 lines elided ↑ open up ↑
 469  458  
 470  459          if ((!list_all_targets) &&
 471  460              (report_dependencies_level == 0)) {
 472  461                  /*
 473  462                   * Check to see if either DMAKE_RCFILE or DMAKE_MODE is defined.
 474  463                   * They could be defined in the env, in the makefile, or on the
 475  464                   * command line.
 476  465                   * If neither is defined, and $(HOME)/.dmakerc does not exists,
 477  466                   * then print a message, and default to parallel mode.
 478  467                   */
 479      -#ifdef DISTRIBUTED
 480      -                MBSTOWCS(wcs_buffer, NOCATGETS("DMAKE_RCFILE"));
 481      -                dmake_name = GETNAME(wcs_buffer, FIND_LENGTH);
 482      -                MBSTOWCS(wcs_buffer, NOCATGETS("DMAKE_MODE"));
 483      -                dmake_name2 = GETNAME(wcs_buffer, FIND_LENGTH);
 484      -                if ((((prop = get_prop(dmake_name->prop, macro_prop)) == NULL) ||
 485      -                     ((dmake_value = prop->body.macro.value) == NULL)) &&
 486      -                    (((prop2 = get_prop(dmake_name2->prop, macro_prop)) == NULL) ||
 487      -                     ((dmake_value2 = prop2->body.macro.value) == NULL))) {
 488      -                        Boolean empty_dmakerc = true;
 489      -                        char *homedir = getenv(NOCATGETS("HOME"));
 490      -                        if ((homedir != NULL) && (strlen(homedir) < (sizeof(def_dmakerc_path) - 16))) {
 491      -                                sprintf(def_dmakerc_path, NOCATGETS("%s/.dmakerc"), homedir);
 492      -                                if ((((statval = stat(def_dmakerc_path, &statbuf)) != 0) && (errno == ENOENT)) ||
 493      -                                        ((statval == 0) && (statbuf.st_size == 0))) {
 494      -                                } else {
 495      -                                        Avo_dmakerc     *rcfile = new Avo_dmakerc();
 496      -                                        Avo_err         *err = rcfile->read(def_dmakerc_path, NULL, TRUE);
 497      -                                        if (err) {
 498      -                                                fatal(err->str);
 499      -                                        }
 500      -                                        empty_dmakerc = rcfile->was_empty();
 501      -                                        delete rcfile;
 502      -                                }
 503      -                        }
 504      -                        if (empty_dmakerc) {
 505      -                                if (getenv(NOCATGETS("DMAKE_DEF_PRINTED")) == NULL) {
 506      -                                        putenv(NOCATGETS("DMAKE_DEF_PRINTED=TRUE"));
 507      -                                        (void) fprintf(stdout, catgets(catd, 1, 302, "dmake: defaulting to parallel mode.\n"));
 508      -                                        (void) fprintf(stdout, catgets(catd, 1, 303, "See the man page dmake(1) for more information on setting up the .dmakerc file.\n"));
 509      -                                }
 510      -                                dmake_mode_type = parallel_mode;
 511      -                                no_parallel = false;
 512      -                        }
 513      -                }
 514      -#else
 515  468                  if(dmake_mode_type == distributed_mode) {
 516  469                          dmake_mode_type = parallel_mode;
 517  470                          no_parallel = false;
 518  471                  }
 519      -#endif  /* DISTRIBUTED */
 520  472          }
 521  473      }
 522  474  #endif
 523  475  
 524  476  #ifdef TEAMWARE_MAKE_CMN
 525  477          parallel_flag = true;
 526  478          putenv(strdup(NOCATGETS("DMAKE_CHILD=TRUE")));
 527  479  
 528  480  //
 529  481  // If dmake is running with -t option, set dmake_mode_type to serial.
↓ open down ↓ 27 lines elided ↑ open up ↑
 557  509                  {
 558  510                          if( (stdout_stat.st_dev != stderr_stat.st_dev)
 559  511                           || (stdout_stat.st_ino != stderr_stat.st_ino) )
 560  512                          {
 561  513                                  out_err_same = false;
 562  514                          }
 563  515                  }
 564  516          }
 565  517  #endif
 566  518  
 567      -#ifdef DISTRIBUTED
 568      -        /*
 569      -         * At this point, DMake should startup an rxm with any and all
 570      -         * DMake command line options. Rxm will, among other things,
 571      -         * read the rc file.
 572      -         */
 573      -        if ((!list_all_targets) &&
 574      -            (report_dependencies_level == 0) &&
 575      -            (dmake_mode_type == distributed_mode)) {
 576      -                startup_rxm();
 577      -        }
 578      -#endif
 579  519                  
 580  520  /*
 581  521   *      Enable interrupt handler for alarms
 582  522   */
 583  523          (void) bsd_signal(SIGALRM, (SIG_PF)doalarm);
 584  524  
 585  525  /*
 586  526   *      Check if make should report
 587  527   */
 588  528          if (getenv(sunpro_dependencies->string_mb) != NULL) {
↓ open down ↓ 57 lines elided ↑ open up ↑
 646  586                          char    tmp_current_path2[MAXPATHLEN];
 647  587   
 648  588                          (void) sprintf(tmp_current_path2,
 649  589                                         "%s/%s",
 650  590                                         get_current_path(),
 651  591                                         make_state_dir);
 652  592                          temp_file_directory = strdup(tmp_current_path2);
 653  593                  }
 654  594          }
 655  595  
 656      -#ifdef DISTRIBUTED
 657      -        building_serial = false;
 658      -#endif
 659  596  
 660  597          report_dir_enter_leave(true);
 661  598  
 662  599          make_targets(argc, argv, parallel_flag);
 663  600  
 664  601          report_dir_enter_leave(false);
 665  602  
 666  603          if (build_failed_ever_seen) {
 667  604                  if (posix) {
 668  605                          exit_status = 1;
↓ open down ↓ 68 lines elided ↑ open up ↑
 737  674          printf(
 738  675                  NOCATGETS("       Env (%ld): %ld Kb (%ld bytes)\n"),
 739  676                  env_alloc_num,
 740  677                  env_alloc_bytes/1000,
 741  678                  env_alloc_bytes
 742  679          );
 743  680  
 744  681  }
 745  682  #endif
 746  683  
 747      -/*
 748      -#ifdef DISTRIBUTED
 749      -    if (get_parent() == TRUE) {
 750      -#endif
 751      - */
 752      -
 753  684          parallel = false;
 754  685          /* If we used the SVR4_MAKE, don't build .DONE or .FAILED */
 755  686          if (!getenv(USE_SVR4_MAKE)){
 756  687              /* Build the target .DONE or .FAILED if we caught an error */
 757  688              if (!quest && !list_all_targets) {
 758  689                  Name            failed_name;
 759  690  
 760  691                  MBSTOWCS(wcs_buffer, NOCATGETS(".FAILED"));
 761  692                  failed_name = GETNAME(wcs_buffer, FIND_LENGTH);
 762  693                  if ((exit_status != 0) && (failed_name->prop != NULL)) {
↓ open down ↓ 61 lines elided ↑ open up ↑
 824  755   */
 825  756          }
 826  757          /* Remove the statefile lock file if the file has been locked */
 827  758          if ((make_state_lockfile != NULL) && (make_state_locked)) {
 828  759                  (void) unlink(make_state_lockfile);
 829  760                  make_state_lockfile = NULL;
 830  761                  make_state_locked = false;
 831  762          }
 832  763          /* Write .make.state */
 833  764          write_state_file(1, (Boolean) 1);
 834      -/*
 835      -#ifdef DISTRIBUTED
 836      -    }
 837      -#endif
 838      - */
 839  765  
 840  766  #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
 841  767          job_adjust_fini();
 842  768  #endif
 843  769  
 844  770  #ifdef TEAMWARE_MAKE_CMN
 845  771          catclose(catd);
 846  772  #endif
 847      -#ifdef DISTRIBUTED
 848      -        if (rxmPid > 0) {
 849      -                // Tell rxm to exit by sending it an Avo_AcknowledgeMsg
 850      -                Avo_AcknowledgeMsg acknowledgeMsg;
 851      -                RWCollectable *msg = (RWCollectable *)&acknowledgeMsg;
 852      -
 853      -                int xdrResult = xdr(&xdrs_out, msg);
 854      -
 855      -                if (xdrResult) {
 856      -                        fflush(dmake_ofp);
 857      -                } else {
 858      -/*
 859      -                        fatal(catgets(catd, 1, 266, "couldn't tell rxm to exit"));
 860      - */
 861      -                        kill(rxmPid, SIGTERM);
 862      -                }
 863      -
 864      -                waitpid(rxmPid, NULL, 0);
 865      -                rxmPid = 0;
 866      -        }
 867      -#endif
 868  773  }
 869  774  
 870  775  /*
 871  776   *      handle_interrupt()
 872  777   *
 873  778   *      This is where C-C traps are caught.
 874  779   *
 875  780   *      Parameters:
 876  781   *
 877  782   *      Global variables used (except DMake 1.0):
↓ open down ↓ 3 lines elided ↑ open up ↑
 881  786   *              running_list            List of parallel running processes
 882  787   *              touch                   Current target is not removed if -t on
 883  788   */
 884  789  void
 885  790  handle_interrupt(int)
 886  791  {
 887  792          Property                member;
 888  793          Running                 rp;
 889  794  
 890  795          (void) fflush(stdout);
 891      -#ifdef DISTRIBUTED
 892      -        if (rxmPid > 0) {
 893      -                // Tell rxm to exit by sending it an Avo_AcknowledgeMsg
 894      -                Avo_AcknowledgeMsg acknowledgeMsg;
 895      -                RWCollectable *msg = (RWCollectable *)&acknowledgeMsg;
 896      -
 897      -                int xdrResult = xdr(&xdrs_out, msg);
 898      -
 899      -                if (xdrResult) {
 900      -                        fflush(dmake_ofp);
 901      -                } else {
 902      -                        kill(rxmPid, SIGTERM);
 903      -                        rxmPid = 0;
 904      -                }
 905      -        }
 906      -#endif
 907  796          if (childPid > 0) {
 908  797                  kill(childPid, SIGTERM);
 909  798                  childPid = -1;
 910  799          }
 911  800          for (rp = running_list; rp != NULL; rp = rp->next) {
 912  801                  if (rp->state != build_running) {
 913  802                          continue;
 914  803                  }
 915  804                  if (rp->pid > 0) {
 916  805                          kill(rp->pid, SIGTERM);
↓ open down ↓ 695 lines elided ↑ open up ↑
1612 1501                  if (invert_this) {
1613 1502                          do_not_exec_rule = false;
1614 1503                  } else {
1615 1504                          do_not_exec_rule = true;
1616 1505                  }
1617 1506                  return 0;
1618 1507          case 'O':                        /* Send job start & result msgs */
1619 1508                  if (invert_this) {
1620 1509                          send_mtool_msgs = false;
1621 1510                  } else {
1622      -#ifdef DISTRIBUTED
1623      -                        send_mtool_msgs = true;
1624      -#endif
1625 1511                  }
1626 1512                  return 128;
1627 1513          case 'o':                        /* Use alternative dmake output dir */
1628 1514                  if (invert_this) {
1629 1515                          dmake_odir_specified = false;
1630 1516                  } else {
1631 1517                          dmake_odir_specified = true;
1632 1518                  }
1633 1519                  return 512;
1634 1520          case 'P':                        /* Print for selected targets */
↓ open down ↓ 1767 lines elided ↑ open up ↑
3402 3288          }
3403 3289          first = false;
3404 3290          if ((!list_all_targets) &&
3405 3291              (report_dependencies_level == 0) &&
3406 3292              (dmake_mode_type != serial_mode)) {
3407 3293                  warning(catgets(catd, 1, 313, "can not get a TeamWare license, defaulting to serial mode..."));
3408 3294          }
3409 3295  }
3410 3296  #endif
3411 3297  
3412      -#ifdef DISTRIBUTED
3413      -/*
3414      - * Returns whether -c is set or not.
3415      - */
3416      -Boolean
3417      -get_dmake_rcfile_specified(void)
3418      -{
3419      -        return(dmake_rcfile_specified);
3420      -}
3421      -
3422      -/*
3423      - * Returns whether -g is set or not.
3424      - */
3425      -Boolean
3426      -get_dmake_group_specified(void)
3427      -{
3428      -        return(dmake_group_specified);
3429      -}
3430      -
3431      -/*
3432      - * Returns whether -j is set or not.
3433      - */
3434      -Boolean
3435      -get_dmake_max_jobs_specified(void)
3436      -{
3437      -        return(dmake_max_jobs_specified);
3438      -}
3439      -
3440      -/*
3441      - * Returns whether -m is set or not.
3442      - */
3443      -Boolean
3444      -get_dmake_mode_specified(void)
3445      -{
3446      -        return(dmake_mode_specified);
3447      -}
3448      -
3449      -/*
3450      - * Returns whether -o is set or not.
3451      - */
3452      -Boolean
3453      -get_dmake_odir_specified(void)
3454      -{
3455      -        return(dmake_odir_specified);
3456      -}
3457      -
3458      -#endif
3459 3298  
3460 3299  static void
3461 3300  report_dir_enter_leave(Boolean entering)
3462 3301  {
3463 3302          char    rcwd[MAXPATHLEN];
3464 3303  static  char *  mlev = NULL;
3465 3304          char *  make_level_str = NULL;
3466 3305          int     make_level_val = 0;
3467 3306  
3468 3307          make_level_str = getenv(NOCATGETS("MAKELEVEL"));
↓ open down ↓ 63 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX