Print this page
make: unifdef for NSE (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 ↓ 363 lines elided ↑ open up ↑
 364  364           * The following flags are reset if we don't have the 
 365  365           * (.nse_depinfo or .make.state) files locked and only set 
 366  366           * AFTER the file has been locked. This ensures that if the user
 367  367           * interrupts the program while file_lock() is waiting to lock
 368  368           * the file, the interrupt handler doesn't remove a lock 
 369  369           * that doesn't belong to us.
 370  370           */
 371  371          make_state_lockfile = NULL;
 372  372          make_state_locked = false;
 373  373  
 374      -#ifdef NSE
 375      -        nse_depinfo_lockfile[0] = '\0';
 376      -        nse_depinfo_locked = false; 
 377      -#endif
 378  374  
 379  375          /*
 380  376           * look for last slash char in the path to look at the binary 
 381  377           * name. This is to resolve the hard link and invoke make
 382  378           * in svr4 mode.
 383  379           */
 384  380  
 385  381          /* Sun OS make standart */
 386  382          svr4 = false;  
 387  383          posix = false;
↓ open down ↓ 303 lines elided ↑ open up ↑
 691  687                  FILE    *report_file;
 692  688  
 693  689                  report_dependency("");
 694  690                  report_file = get_report_file();
 695  691                  if ((report_file != NULL) && (report_file != (FILE*)-1)) {
 696  692                          (void) fprintf(report_file, "\n");
 697  693                  }
 698  694          }
 699  695  
 700  696  /*
 701      - *      Make sure SUNPRO_DEPENDENCIES is exported (or not) properly
 702      - *      and NSE_DEP.
      697 + *      Make sure SUNPRO_DEPENDENCIES is exported (or not) properly.
 703  698   */
 704  699          if (keep_state) {
 705  700                  maybe_append_prop(sunpro_dependencies, macro_prop)->
 706  701                    body.macro.exported = true;
 707      -#ifdef NSE
 708      -                (void) setenv(NOCATGETS("NSE_DEP"), get_current_path());
 709      -#endif
 710  702          } else {
 711  703                  maybe_append_prop(sunpro_dependencies, macro_prop)->
 712  704                    body.macro.exported = false;
 713  705          }
 714  706  
 715  707          working_on_targets = true;
 716  708          if (trace_status) {
 717  709                  dump_make_state();
 718  710                  fclose(stdout);
 719  711                  fclose(stderr);
↓ open down ↓ 42 lines elided ↑ open up ↑
 762  754  #ifdef DISTRIBUTED
 763  755          building_serial = false;
 764  756  #endif
 765  757  
 766  758          report_dir_enter_leave(true);
 767  759  
 768  760          make_targets(argc, argv, parallel_flag);
 769  761  
 770  762          report_dir_enter_leave(false);
 771  763  
 772      -#ifdef NSE
 773      -        exit(nse_exit_status());
 774      -#else
 775  764          if (build_failed_ever_seen) {
 776  765                  if (posix) {
 777  766                          exit_status = 1;
 778  767                  }
 779  768                  exit(1);
 780  769          }
 781  770          exit_status = 0;
 782  771          exit(0);
 783      -#endif
 784  772          /* NOTREACHED */
 785  773  }
 786  774  
 787  775  /*
 788  776   *      cleanup_after_exit()
 789  777   *
 790  778   *      Called from exit(), performs cleanup actions.
 791  779   *
 792  780   *      Parameters:
 793  781   *              status          The argument exit() was called with
↓ open down ↓ 14 lines elided ↑ open up ↑
 808  796   *              running_list    List of parallel running processes
 809  797   *              temp_file_name  The temp file is removed, if any
 810  798   *              catd    the message catalog file
 811  799   *              usage_tracking  Should have been constructed in main()
 812  800   *                              should destroyed just before exiting
 813  801   */
 814  802  extern "C" void
 815  803  cleanup_after_exit(void)
 816  804  {
 817  805          Running         rp;
 818      -#ifdef NSE
 819      -        char            push_cmd[NSE_TFS_PUSH_LEN + 3 +
 820      -                                 (MAXPATHLEN * MB_LEN_MAX) + 12];
 821      -        char            *active;
 822      -#endif
 823  806  
 824  807  extern long     getname_bytes_count;
 825  808  extern long     getname_names_count;
 826  809  extern long     getname_struct_count;
 827  810  extern long     freename_bytes_count;
 828  811  extern long     freename_names_count;
 829  812  extern long     freename_struct_count;
 830  813  extern long     other_alloc;
 831  814  
 832  815  extern long     env_alloc_num;
↓ open down ↓ 120 lines elided ↑ open up ↑
 953  936          // Deleting the usage tracking object sends the usage mail 
 954  937  #ifdef USE_DMS_CCR
 955  938          //usageTracking->setExitStatus(exit_status, NULL);
 956  939          //delete usageTracking;
 957  940  #else
 958  941          cleanup->set_exit_status(exit_status);
 959  942          delete cleanup;
 960  943  #endif
 961  944  #endif
 962  945  
 963      -#ifdef NSE
 964      -        /* If running inside an activated environment, push the */
 965      -        /* .nse_depinfo file (if written) */
 966      -        active = getenv(NSE_VARIANT_ENV);
 967      -        if (keep_state &&
 968      -            (active != NULL) &&
 969      -            !IS_EQUAL(active, NSE_RT_SOURCE_NAME) &&
 970      -            !do_not_exec_rule &&
 971      -            (report_dependencies_level == 0)) {
 972      -                (void) sprintf(push_cmd,
 973      -                               "%s %s/%s",
 974      -                               NSE_TFS_PUSH,
 975      -                               get_current_path(),
 976      -                               NSE_DEPINFO);
 977      -                (void) system(push_cmd);
 978      -        }
 979      -#endif
 980      -
 981  946  /*
 982  947  #ifdef DISTRIBUTED
 983  948      }
 984  949  #endif
 985  950   */
 986  951  
 987  952  #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
 988  953          job_adjust_fini();
 989  954  #endif
 990  955  
↓ open down ↓ 164 lines elided ↑ open up ↑
1155 1120                  unlink(script_file);
1156 1121          }
1157 1122  #endif
1158 1123  
1159 1124          /* Have we locked .make.state or .nse_depinfo? */
1160 1125          if ((make_state_lockfile != NULL) && (make_state_locked)) {
1161 1126                  unlink(make_state_lockfile);
1162 1127                  make_state_lockfile = NULL;
1163 1128                  make_state_locked = false;
1164 1129          }
1165      -#ifdef NSE
1166      -        if ((nse_depinfo_lockfile[0] != '\0') && (nse_depinfo_locked)) {
1167      -                unlink(nse_depinfo_lockfile);
1168      -                nse_depinfo_lockfile[0] = '\0';
1169      -                nse_depinfo_locked = false;
1170      -        }
1171      -#endif
1172 1130          /*
1173 1131           * Re-read .make.state file (it might be changed by recursive make)
1174 1132           */
1175 1133          check_state(NULL);
1176 1134  
1177 1135          report_dir_enter_leave(false);
1178 1136  
1179 1137          exit_status = 2;
1180 1138          exit(2);
1181 1139  }
↓ open down ↓ 511 lines elided ↑ open up ↑
1693 1651                          read_trace_level++;
1694 1652                  }
1695 1653                  return 0;
1696 1654          case 'd':                        /* Debug flag */
1697 1655                  if (invert_this) {
1698 1656                          debug_level--;
1699 1657                  } else {
1700 1658                          debug_level++;
1701 1659                  }
1702 1660                  return 0;
1703      -#ifdef NSE
1704      -        case 'E':
1705      -                if (invert_this) {
1706      -                        nse = false;
1707      -                } else {
1708      -                        nse = true;
1709      -                }
1710      -                nse_init_source_suffixes();
1711      -                return 0;
1712      -#endif
1713 1661          case 'e':                        /* Environment override flag */
1714 1662                  if (invert_this) {
1715 1663                          env_wins = false;
1716 1664                  } else {
1717 1665                          env_wins = true;
1718 1666                  }
1719 1667                  return 0;
1720 1668          case 'f':                        /* Read alternative makefile(s) */
1721 1669                  return 1;
1722 1670          case 'g':                        /* Use alternative DMake group */
↓ open down ↓ 330 lines elided ↑ open up ↑
2053 2001   *      Global variables used:
2054 2002   *              default_target_to_build Set to first proper target from file
2055 2003   *              do_not_exec_rule Set to false when makfile is made
2056 2004   *              dot             The Name ".", used to read current dir
2057 2005   *              empty_name      The Name "", use as macro value
2058 2006   *              keep_state      Set if KEEP_STATE is in environment
2059 2007   *              make_state      The Name ".make.state", used to read file
2060 2008   *              makefile_type   Set to type of file being read
2061 2009   *              makeflags       The Name "MAKEFLAGS", used to set macro value
2062 2010   *              not_auto        dwight
2063      - *              nse             Set if NSE_ENV is in the environment
2064 2011   *              read_trace_level Checked to se if the reader should trace
2065 2012   *              report_dependencies If -P is on we do not read .make.state
2066 2013   *              trace_reader    Set if reader should trace
2067 2014   *              virtual_root    The Name "VIRTUAL_ROOT", used to check value
2068 2015   */
2069 2016  static void
2070 2017  read_files_and_state(int argc, char **argv)
2071 2018  {
2072 2019          wchar_t                 buffer[1000];
2073 2020          wchar_t                 buffer_posix[1000];
↓ open down ↓ 46 lines elided ↑ open up ↑
2120 2067          MBSTOWCS(wcs_buffer, NOCATGETS("makefile"));
2121 2068          makefile_name = GETNAME(wcs_buffer, FIND_LENGTH);
2122 2069          MBSTOWCS(wcs_buffer, NOCATGETS("s.makefile"));
2123 2070          sdotmakefile_name = GETNAME(wcs_buffer, FIND_LENGTH);
2124 2071          MBSTOWCS(wcs_buffer, NOCATGETS("s.Makefile"));
2125 2072          sdotMakefile = GETNAME(wcs_buffer, FIND_LENGTH);
2126 2073  
2127 2074  /*
2128 2075   *      Set flag if NSE is active
2129 2076   */
2130      -#ifdef NSE
2131      -        if (getenv(NOCATGETS("NSE_ENV")) != NULL) {
2132      -                nse = true;
2133      -        }
2134      -#endif
2135 2077  
2136 2078  /*
2137 2079   *      initialize global dependency entry for .NOT_AUTO
2138 2080   */
2139 2081          not_auto_depen->next = NULL;
2140 2082          not_auto_depen->name = not_auto;
2141 2083          not_auto_depen->automatic = not_auto_depen->stale = false;
2142 2084  
2143 2085  /*
2144 2086   *      Read internal definitions and rules.
↓ open down ↓ 84 lines elided ↑ open up ↑
2229 2171                  append_char('D', &makeflags_string_posix);
2230 2172          }
2231 2173          switch (debug_level) {
2232 2174          case 2:
2233 2175                  append_char('d', &makeflags_string);
2234 2176                  append_char('d', &makeflags_string_posix);
2235 2177          case 1:
2236 2178                  append_char('d', &makeflags_string);
2237 2179                  append_char('d', &makeflags_string_posix);
2238 2180          }
2239      -#ifdef NSE
2240      -        if (nse) {
2241      -                append_char('E', &makeflags_string);
2242      -        }
2243      -#endif
2244 2181          if (env_wins) {
2245 2182                  append_char('e', &makeflags_string);
2246 2183                  append_char('e', &makeflags_string_posix);
2247 2184          }
2248 2185          if (ignore_errors_all) {
2249 2186                  append_char('i', &makeflags_string);
2250 2187                  append_char('i', &makeflags_string_posix);
2251 2188          }
2252 2189          if (continue_after_error) {
2253 2190                  if (stop_after_error_ever_seen) {
↓ open down ↓ 783 lines elided ↑ open up ↑
3037 2974                           * it replaces the MAKEFLAGS variable currently found in the
3038 2975                           * environment.
3039 2976                           * See Assertion 50 in section 6.2.5.3 of standard P1003.3.2/D8.
3040 2977                           */
3041 2978                          if(posix) {
3042 2979                                  read_only_saved = false;
3043 2980                          }
3044 2981                  }
3045 2982  
3046 2983                  /*
3047      -                 * We ignore SUNPRO_DEPENDENCIES and NSE_DEP. Those
3048      -                 * environment variables are set by make and read by 
3049      -                 * cpp which then writes info to .make.dependency.xxx and 
3050      -                 * .nse_depinfo. When make is invoked by another make 
3051      -                 * (recursive make), we don't want to read this because 
3052      -                 * then the child make will end up writing to the parent 
3053      -                 * directory's .make.state and .nse_depinfo and clobbering
3054      -                 * them. 
     2984 +                 * We ignore SUNPRO_DEPENDENCIES. This environment variable is
     2985 +                 * set by make and read by cpp which then writes info to
     2986 +                 * .make.dependency.xxx.  When make is invoked by another make
     2987 +                 * (recursive make), we don't want to read this because then
     2988 +                 * the child make will end up writing to the parent
     2989 +                 * directory's .make.state and clobbering them.
3055 2990                   */
3056 2991                  MBSTOWCS(wcs_buffer2, NOCATGETS("SUNPRO_DEPENDENCIES"));
3057 2992                  if (IS_WEQUALN(name, wcs_buffer2, wslen(wcs_buffer2))) {
3058 2993                          continue;
3059 2994                  }
3060      -#ifdef NSE
3061      -                MBSTOWCS(wcs_buffer2, NOCATGETS("NSE_DEP"));
3062      -                if (IS_WEQUALN(name, wcs_buffer2, wslen(wcs_buffer2))) {
3063      -                        continue;
3064      -                }
3065      -#endif
3066 2995  
3067 2996                  macro = GETNAME(name, value - name);
3068 2997                  maybe_append_prop(macro, macro_prop)->body.macro.exported =
3069 2998                    true;
3070 2999                  if ((value == NULL) || ((value + 1)[0] == (int) nul_char)) {
3071 3000                          val = setvar_daemon(macro,
3072 3001                                              (Name) NULL,
3073 3002                                              false, no_daemon, false, debug_level);
3074 3003                  } else {
3075 3004                          val = setvar_daemon(macro,
3076 3005                                              GETNAME(value + 1, FIND_LENGTH),
3077 3006                                              false, no_daemon, false, debug_level);
3078 3007                  }
3079      -#ifdef NSE
3080      -                /*
3081      -                 * Must be after the call to setvar() as it sets
3082      -                 * imported to false.
3083      -                 */
3084      -                maybe_append_prop(macro, macro_prop)->body.macro.imported = true;
3085      -#endif
3086 3008                  val->body.macro.read_only = read_only_saved;
3087 3009                  if (alloced_tmp_wcs_buffer) {
3088 3010                          retmem(tmp_wcs_buffer);
3089 3011                          alloced_tmp_wcs_buffer = false;
3090 3012                  }
3091 3013          }
3092 3014          reading_environment = false;
3093 3015  }
3094 3016  
3095 3017  /*
↓ open down ↓ 14 lines elided ↑ open up ↑
3110 3032   *              makefile_type   Set to indicate we are reading main file
3111 3033   *              recursion_level Initialized
3112 3034   */
3113 3035  static Boolean
3114 3036  read_makefile(register Name makefile, Boolean complain, Boolean must_exist, Boolean report_file)
3115 3037  {
3116 3038          Boolean                 b;
3117 3039          
3118 3040          makefile_type = reading_makefile;
3119 3041          recursion_level = 0;
3120      -#ifdef NSE
3121      -        wscpy(current_makefile, makefile->string);
3122      -#endif
3123 3042          reading_dependencies = true;
3124 3043          b = read_simple_file(makefile, true, true, complain,
3125 3044                               must_exist, report_file, false);
3126 3045          reading_dependencies = false;
3127 3046          return b;
3128 3047  }
3129 3048  
3130 3049  /*
3131 3050   *      make_targets(argc, argv, parallel_flag)
3132 3051   *
↓ open down ↓ 270 lines elided ↑ open up ↑
3403 3322          register FILE           *report_file = get_report_file();
3404 3323  
3405 3324          if ((report_file == NULL) || (report_file == (FILE*)-1)) {
3406 3325                  return;
3407 3326          }
3408 3327          if (primary_makefile == NULL) {
3409 3328                  /*
3410 3329                   * This can happen when there is no makefile and
3411 3330                   * only implicit rules are being used.
3412 3331                   */
3413      -#ifdef NSE
3414      -                nse_no_makefile(target);
3415      -#endif
3416 3332                  return;
3417 3333          }
3418 3334          (void) fprintf(report_file,
3419 3335                         "%s: %s ",
3420 3336                         get_target_being_reported_for(),
3421 3337                         recursive_name->string_mb);
3422 3338          report_dependency(get_current_path());
3423 3339          report_dependency(target->string_mb);
3424 3340          report_dependency(primary_makefile->string_mb);
3425 3341          (void) fprintf(report_file, "\n");
↓ open down ↓ 280 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX