Print this page
make: unifdef SUN5_0 (defined)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/main.cc
          +++ new/usr/src/cmd/make/bin/main.cc
↓ open down ↓ 75 lines elided ↑ open up ↑
  76   76  #endif
  77   77  
  78   78  #include <pwd.h>                /* getpwnam() */
  79   79  #include <setjmp.h>
  80   80  #include <signal.h>
  81   81  #include <stdlib.h>
  82   82  #include <sys/errno.h>          /* ENOENT */
  83   83  #include <sys/stat.h>           /* fstat() */
  84   84  #include <fcntl.h>              /* open() */
  85   85  
  86      -#ifdef SUN5_0
  87   86  #       include <sys/systeminfo.h>      /* sysinfo() */
  88      -#endif
  89   87  
  90   88  #include <sys/types.h>          /* stat() */
  91   89  #include <sys/wait.h>           /* wait() */
  92   90  #include <unistd.h>             /* execv(), unlink(), access() */
  93   91  #include <vroot/report.h>       /* report_dependency(), get_report_file() */
  94   92  
  95   93  // From read2.cc
  96   94  extern  Name            normalize_name(register wchar_t *name_string, register int length);
  97   95  
  98   96  // From parallel.cc
↓ open down ↓ 56 lines elided ↑ open up ↑
 155  153  #ifdef USE_DMS_CCR
 156  154          static  Avo_usage_tracking *usageTracking = NULL;
 157  155  #else
 158  156          static  Avo_cleanup     *cleanup = NULL;
 159  157  #endif
 160  158  #endif
 161  159  
 162  160  /*
 163  161   * File table of contents
 164  162   */
 165      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 166  163          extern "C" void         cleanup_after_exit(void);
 167      -#else
 168      -        extern  void            cleanup_after_exit(int, ...);
 169      -#endif
 170  164  
 171  165  #ifdef TEAMWARE_MAKE_CMN
 172  166  extern "C" {
 173  167          extern  void            dmake_exit_callback(void);
 174  168          extern  void            dmake_message_callback(char *);
 175  169  }
 176  170  #endif
 177  171  
 178  172  extern  Name            normalize_name(register wchar_t *name_string, register int length);
 179  173  
↓ open down ↓ 302 lines elided ↑ open up ↑
 482  476          set_path_style(0);
 483  477  
 484  478          setup_char_semantics();
 485  479  
 486  480          setup_for_projectdir();
 487  481  
 488  482          /*
 489  483           * If running with .KEEP_STATE, curdir will be set with
 490  484           * the connected directory.
 491  485           */
 492      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 493  486          (void) atexit(cleanup_after_exit);
 494      -#else
 495      -        (void) on_exit(cleanup_after_exit, (char *) NULL);
 496      -#endif
 497  487  
 498  488          load_cached_names();
 499  489  
 500  490  /*
 501  491   *      Set command line flags
 502  492   */
 503  493          setup_makeflags_argv();
 504  494          read_command_options(mf_argc, mf_argv);
 505  495          read_command_options(argc, argv);
 506  496          if (debug_level > 0) {
↓ open down ↓ 228 lines elided ↑ open up ↑
 735  725                  (void) setenv(NOCATGETS("NSE_DEP"), get_current_path());
 736  726  #endif
 737  727          } else {
 738  728                  maybe_append_prop(sunpro_dependencies, macro_prop)->
 739  729                    body.macro.exported = false;
 740  730          }
 741  731  
 742  732          working_on_targets = true;
 743  733          if (trace_status) {
 744  734                  dump_make_state();
 745      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 746  735                  fclose(stdout);
 747  736                  fclose(stderr);
 748  737                  exit_status = 0;
 749      -#endif
 750  738                  exit(0);
 751  739          }
 752  740          if (list_all_targets) {
 753  741                  dump_target_list();
 754      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 755  742                  fclose(stdout);
 756  743                  fclose(stderr);
 757  744                  exit_status = 0;
 758      -#endif
 759  745                  exit(0);
 760  746          }
 761  747          trace_reader = false;
 762  748  
 763  749          /*
 764  750           * Set temp_file_directory to the directory the .make.state
 765  751           * file is written to.
 766  752           */
 767  753          if ((slash_ptr = strrchr(make_state->string_mb, (int) slash_char)) == NULL) {
 768  754                  temp_file_directory = strdup(get_current_path());
↓ open down ↓ 28 lines elided ↑ open up ↑
 797  783          report_dir_enter_leave(true);
 798  784  
 799  785          make_targets(argc, argv, parallel_flag);
 800  786  
 801  787          report_dir_enter_leave(false);
 802  788  
 803  789  #ifdef NSE
 804  790          exit(nse_exit_status());
 805  791  #else
 806  792          if (build_failed_ever_seen) {
 807      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 808  793                  if (posix) {
 809  794                          exit_status = 1;
 810  795                  }
 811      -#endif
 812  796                  exit(1);
 813  797          }
 814      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 815  798          exit_status = 0;
 816      -#endif
 817  799          exit(0);
 818  800  #endif
 819  801          /* NOTREACHED */
 820  802  }
 821  803  
 822  804  /*
 823  805   *      cleanup_after_exit()
 824  806   *
 825  807   *      Called from exit(), performs cleanup actions.
 826  808   *
↓ open down ↓ 12 lines elided ↑ open up ↑
 839  821   *              parallel        True if building in parallel
 840  822   *              quest           If -q is on we do not run .DONE
 841  823   *              report_dependencies
 842  824   *                              True if -P flag on
 843  825   *              running_list    List of parallel running processes
 844  826   *              temp_file_name  The temp file is removed, if any
 845  827   *              catd    the message catalog file
 846  828   *              usage_tracking  Should have been constructed in main()
 847  829   *                              should destroyed just before exiting
 848  830   */
 849      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 850  831  extern "C" void
 851  832  cleanup_after_exit(void)
 852      -#else
 853      -void cleanup_after_exit(int status, ...)
 854      -#endif
 855  833  {
 856  834          Running         rp;
 857  835  #ifdef NSE
 858  836          char            push_cmd[NSE_TFS_PUSH_LEN + 3 +
 859  837                                   (MAXPATHLEN * MB_LEN_MAX) + 12];
 860  838          char            *active;
 861  839  #endif
 862  840  
 863  841  extern long     getname_bytes_count;
 864  842  extern long     getname_names_count;
↓ open down ↓ 35 lines elided ↑ open up ↑
 900  878  }
 901  879  #endif
 902  880  
 903  881  /*
 904  882  #ifdef DISTRIBUTED
 905  883      if (get_parent() == TRUE) {
 906  884  #endif
 907  885   */
 908  886  
 909  887          parallel = false;
 910      -#ifdef SUN5_0
 911  888          /* If we used the SVR4_MAKE, don't build .DONE or .FAILED */
 912  889          if (!getenv(USE_SVR4_MAKE)){
 913      -#endif
 914  890              /* Build the target .DONE or .FAILED if we caught an error */
 915  891              if (!quest && !list_all_targets) {
 916  892                  Name            failed_name;
 917  893  
 918  894                  MBSTOWCS(wcs_buffer, NOCATGETS(".FAILED"));
 919  895                  failed_name = GETNAME(wcs_buffer, FIND_LENGTH);
 920      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
 921  896                  if ((exit_status != 0) && (failed_name->prop != NULL)) {
 922      -#else
 923      -                if ((status != 0) && (failed_name->prop != NULL)) {
 924      -#endif
 925  897  #ifdef TEAMWARE_MAKE_CMN
 926  898                          /*
 927  899                           * [tolik] switch DMake to serial mode
 928  900                           */
 929  901                          dmake_mode_type = serial_mode;
 930  902                          no_parallel = true;
 931  903  #endif
 932  904                          (void) doname(failed_name, false, true);
 933  905                  } else {
 934  906                      if (!trace_status) {
↓ open down ↓ 1 lines elided ↑ open up ↑
 936  908                          /*
 937  909                           * Switch DMake to serial mode
 938  910                           */
 939  911                          dmake_mode_type = serial_mode;
 940  912                          no_parallel = true;
 941  913  #endif
 942  914                          (void) doname(done, false, true);
 943  915                      }
 944  916                  }
 945  917              }
 946      -#ifdef SUN5_0
 947  918          }
 948      -#endif
 949  919          /*
 950  920           * Remove the temp file utilities report dependencies thru if it
 951  921           * is still around
 952  922           */
 953  923          if (temp_file_name != NULL) {
 954  924                  (void) unlink(temp_file_name->string_mb);
 955  925          }
 956  926          /*
 957  927           * Do not save the current command in .make.state if make
 958  928           * was interrupted.
↓ open down ↓ 156 lines elided ↑ open up ↑
1115 1085                  bsd_signal(SIGTERM, SIG_IGN);
1116 1086                  kill (-getpid(), SIGTERM);
1117 1087          }
1118 1088  #ifdef TEAMWARE_MAKE_CMN
1119 1089          /* Clean up all parallel/distributed children already finished */
1120 1090          finish_children(false);
1121 1091  #endif
1122 1092  
1123 1093          /* Make sure the processes running under us terminate first */
1124 1094  
1125      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
1126 1095          while (wait((int *) NULL) != -1);
1127      -#else
1128      -        while (wait((union wait*) NULL) != -1);
1129      -#endif
1130 1096          /* Delete the current targets unless they are precious */
1131 1097          if ((current_target != NULL) &&
1132 1098              current_target->is_member &&
1133 1099              ((member = get_prop(current_target->prop, member_prop)) != NULL)) {
1134 1100                  current_target = member->body.member.library;
1135 1101          }
1136 1102          if (!do_not_exec_rule &&
1137 1103              !touch &&
1138 1104              !quest &&
1139 1105              (current_target != NULL) &&
↓ open down ↓ 80 lines elided ↑ open up ↑
1220 1186                  nse_depinfo_locked = false;
1221 1187          }
1222 1188  #endif
1223 1189          /*
1224 1190           * Re-read .make.state file (it might be changed by recursive make)
1225 1191           */
1226 1192          check_state(NULL);
1227 1193  
1228 1194          report_dir_enter_leave(false);
1229 1195  
1230      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
1231 1196          exit_status = 2;
1232      -#endif
1233 1197          exit(2);
1234 1198  }
1235 1199  
1236 1200  /*
1237 1201   *      doalarm(sig, ...)
1238 1202   *
1239 1203   *      Handle the alarm interrupt but do nothing.  Side effect is to
1240 1204   *      cause return from wait3.
1241 1205   *
1242 1206   *      Parameters:
↓ open down ↓ 714 lines elided ↑ open up ↑
1957 1921                  }
1958 1922                  return 0;
1959 1923          case 'V':                       /* SVR4 mode */
1960 1924                  svr4 = true;
1961 1925                  return 0;
1962 1926          case 'v':                       /* Version flag */
1963 1927                  if (invert_this) {
1964 1928                  } else {
1965 1929  #ifdef TEAMWARE_MAKE_CMN
1966 1930                          fprintf(stdout, NOCATGETS("dmake: %s\n"), verstring);
1967      -#ifdef SUN5_0
1968 1931                          exit_status = 0;
1969      -#endif
1970 1932                          exit(0);
1971 1933  #else
1972 1934                          warning(catgets(catd, 1, 324, "Ignoring DistributedMake -v option"));
1973 1935  #endif
1974 1936                  }
1975 1937                  return 0;
1976 1938          case 'w':                        /* Unconditional flag */
1977 1939                  if (invert_this) {
1978 1940                          report_cwd = false;
1979 1941                  } else {
↓ open down ↓ 231 lines elided ↑ open up ↑
2211 2173          not_auto_depen->name = not_auto;
2212 2174          not_auto_depen->automatic = not_auto_depen->stale = false;
2213 2175  
2214 2176  /*
2215 2177   *      Read internal definitions and rules.
2216 2178   */
2217 2179          if (read_trace_level > 1) {
2218 2180                  trace_reader = true;
2219 2181          }
2220 2182          if (!ignore_default_mk) {
2221      -#if defined(SUN5_0) || defined(HP_UX) || defined(linux)
2222 2183                  if (svr4) {
2223 2184                          MBSTOWCS(wcs_buffer, NOCATGETS("svr4.make.rules"));
2224 2185                          default_makefile = GETNAME(wcs_buffer, FIND_LENGTH);
2225 2186                  } else {
2226 2187                          MBSTOWCS(wcs_buffer, NOCATGETS("make.rules"));
2227 2188                          default_makefile = GETNAME(wcs_buffer, FIND_LENGTH);
2228 2189                  }
2229      -#else           
2230      -                MBSTOWCS(wcs_buffer, NOCATGETS("default.mk"));
2231      -                default_makefile = GETNAME(wcs_buffer, FIND_LENGTH);
2232      -#endif
2233 2190                  default_makefile->stat.is_file = true;
2234 2191  
2235 2192                  (void) read_makefile(default_makefile,
2236 2193                                       true,
2237 2194                                       false,
2238 2195                                       true);
2239 2196          }
2240 2197  
2241 2198          /*
2242 2199           * If the user did not redefine the MAKE macro in the
↓ open down ↓ 1539 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX