Print this page
make: unifdef SUN5_0 (defined)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/lib/vroot/report.cc
          +++ new/usr/src/cmd/make/lib/vroot/report.cc
↓ open down ↓ 51 lines elided ↑ open up ↑
  52   52  {
  53   53          return(report_file);
  54   54  }
  55   55  
  56   56  char *
  57   57  get_target_being_reported_for(void)
  58   58  {
  59   59          return(target_being_reported_for);
  60   60  }
  61   61  
  62      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
  63   62  extern "C" {
  64   63  static void
  65   64  close_report_file(void)
  66   65  {
  67   66          (void)fputs("\n", report_file);
  68   67          (void)fclose(report_file);
  69   68  }
  70   69  } // extern "C"
  71      -#else
  72      -static void
  73      -close_report_file(int, ...)
  74      -{
  75      -        (void)fputs("\n", report_file);
  76      -        (void)fclose(report_file);
  77      -}
  78      -#endif
  79   70  
  80   71  static void
  81   72  clean_up(FILE *nse_depinfo_fp, FILE *merge_fp, char *nse_depinfo_file, char *merge_file, int unlinkf)
  82   73  {
  83   74          fclose(nse_depinfo_fp);
  84   75          fclose(merge_fp);
  85   76          fclose(command_output_fp);
  86   77          unlink(command_output_tmpfile);
  87   78          if (unlinkf)
  88   79                  unlink(merge_file);
↓ open down ↓ 1 lines elided ↑ open up ↑
  90   81                  rename(merge_file, nse_depinfo_file);
  91   82  }
  92   83  
  93   84  
  94   85  /*
  95   86   *  Update the file, if necessary.  We don't want to rewrite
  96   87   *  the file if we don't have to because we don't want the time of the file
  97   88   *  to change in that case.
  98   89   */
  99   90  
 100      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 101   91  extern "C" {
 102   92  static void
 103   93  close_file(void)
 104      -#else
 105      -static void
 106      -close_file(int, ...)
 107      -#endif
 108   94  {
 109   95          char            line[MAXPATHLEN+2];
 110   96          char            buf[MAXPATHLEN+2];
 111   97          FILE            *nse_depinfo_fp;
 112   98          FILE            *merge_fp;
 113   99          char            nse_depinfo_file[MAXPATHLEN];
 114  100          char            merge_file[MAXPATHLEN];
 115  101          char            lock_file[MAXPATHLEN];
 116  102          int             err;
 117  103          int             len;
↓ open down ↓ 89 lines elided ↑ open up ↑
 207  193                  while (fgets(line, MAXPATHLEN+2, command_output_fp) != NULL) {
 208  194                          fprintf(nse_depinfo_fp, "%s", line);
 209  195                  }
 210  196          }
 211  197          clean_up(nse_depinfo_fp, merge_fp, nse_depinfo_file, merge_file, 1);
 212  198          if (file_locked) {
 213  199                  unlink(lock_file);
 214  200          }
 215  201  }
 216  202  
 217      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 218  203  } // extern "C"
 219      -#endif
 220  204  
 221  205  static void
 222  206  report_dep(char *iflag, char *filename)
 223  207  {
 224  208  
 225  209          if (command_output_fp == NULL) {
 226  210                  sprintf(command_output_tmpfile, 
 227  211                          NOCATGETS("%s/%s.%d.XXXXXX"), tmpdir, NSE_DEPINFO, getpid());
 228  212                  int fd = mkstemp(command_output_tmpfile);
 229  213                  if ((fd < 0) || (command_output_fp = fdopen(fd, "w")) == NULL) {
 230  214                          return;
 231  215                  }
 232  216                  if ((search_dir = getenv(NOCATGETS("NSE_DEP"))) == NULL) {
 233  217                          return;
 234  218                  }
 235      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 236  219                  atexit(close_file);
 237      -#else
 238      -                on_exit(close_file, 0);
 239      -#endif
 240  220                  strcpy(sfile, filename);
 241  221                  if (iflag == NULL || *iflag == '\0') {
 242  222                          return;
 243  223                  }
 244  224                  fprintf(command_output_fp, "%s:", sfile);
 245  225          }
 246  226          fprintf(command_output_fp, " ");
 247  227          fprintf(command_output_fp, iflag);
 248  228          if (iflag != NULL) {
 249  229                  is_path = 1;
↓ open down ↓ 31 lines elided ↑ open up ↑
 281  261                  return;
 282  262          }
 283  263          if ((p= getenv(SUNPRO_DEPENDENCIES)) == NULL) {
 284  264                  return;
 285  265          }
 286  266          ptr = strchr(p, ' ');
 287  267          if( ! ptr ) {
 288  268                  return;
 289  269          }
 290  270          sprintf(filename, NOCATGETS("%s-CPP"), ptr+1);
 291      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 292  271          getcwd(curdir, sizeof(curdir));
 293      -#else
 294      -        getwd(curdir);
 295      -#endif
 296  272          if (strcmp(curdir, sdir) != 0 && strlen(iflag) > 2 && 
 297  273              iflag[2] != '/') {
 298  274                  /* Makefile must have had an "cd xx; cc ..." */
 299  275                  /* Modify the -I path to be relative to the cd */
 300  276                  newiflag = (char *)malloc(strlen(iflag) + strlen(curdir) + 2);
 301  277                  sprintf(newiflag, "-%c%s/%s", iflag[1], curdir, &iflag[2]);
 302  278                  report_dep(newiflag, filename);
 303  279          } else {
 304  280                  report_dep(iflag, filename);
 305  281          }
↓ open down ↓ 25 lines elided ↑ open up ↑
 331  307                  } else {
 332  308                          report_file = (FILE *)-1;
 333  309                          return;
 334  310                  }
 335  311                  if ((report_file= fopen(filename, "a")) == NULL) {
 336  312                          if ((report_file= fopen(filename, "w")) == NULL) {
 337  313                                  report_file= (FILE *)-1;
 338  314                                  return;
 339  315                          }
 340  316                  }
 341      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 342  317                  atexit(close_report_file);
 343      -#else
 344      -                (void)on_exit(close_report_file, (char *)report_file);
 345      -#endif
 346  318                  if ((p2= strchr(p+1, ' ')) != NULL)
 347  319                          *p2= 0;
 348  320                  target_being_reported_for= (char *)malloc((unsigned)(strlen(p+1)+1));
 349  321                  (void)strcpy(target_being_reported_for, p+1);
 350  322                  (void)fputs(p+1, report_file);
 351  323                  (void)fputs(":", report_file);
 352  324                  *p= ' ';
 353  325                  if (p2 != NULL)
 354  326                          *p2= ' ';
 355  327          }
↓ open down ↓ 36 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX