Print this page
make: unifdef for NSE (undefined)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/lib/mksh/macro.cc
          +++ new/usr/src/cmd/make/lib/mksh/macro.cc
↓ open down ↓ 38 lines elided ↑ open up ↑
  39   39  #include <mksh/misc.h>          /* retmem() */
  40   40  #include <mksh/read.h>          /* get_next_block_fn() */
  41   41  #include <mksdmsi18n/mksdmsi18n.h>      /* libmksdmsi18n_init() */
  42   42  
  43   43  #include <widec.h>
  44   44  
  45   45  /*
  46   46   * File table of contents
  47   47   */
  48   48  static void     add_macro_to_global_list(Name macro_to_add);
  49      -#ifdef NSE
  50      -static void     expand_value_with_daemon(Name name, register Property macro, register String destination, Boolean cmd);
  51      -#else
  52   49  static void     expand_value_with_daemon(Name, register Property macro, register String destination, Boolean cmd);
  53      -#endif
  54   50  
  55   51  static void     init_arch_macros(void);
  56   52  static void     init_mach_macros(void);
  57   53  static Boolean  init_arch_done = false;
  58   54  static Boolean  init_mach_done = false;
  59   55  
  60   56  
  61   57  long env_alloc_num = 0;
  62   58  long env_alloc_bytes = 0;
  63   59  
↓ open down ↓ 558 lines elided ↑ open up ↑
 622  618                  }
 623  619          }
 624  620          if ((name == host_mach) || (name == target_mach)) {
 625  621                  if (!init_mach_done) {
 626  622                          init_mach_done = true;
 627  623                          init_mach_macros();
 628  624                  }
 629  625          }
 630  626          /* Get the macro value. */
 631  627          macro = get_prop(name->prop, macro_prop);
 632      -#ifdef NSE
 633      -        if (nse_watch_vars && nse && macro != NULL) {
 634      -                if (macro->body.macro.imported) {
 635      -                        nse_shell_var_used= name;
 636      -                }
 637      -                if (macro->body.macro.value != NULL){
 638      -                      if (nse_backquotes(macro->body.macro.value->string)) {
 639      -                               nse_backquote_seen= name;
 640      -                      }
 641      -               }
 642      -        }
 643      -#endif
 644  628          if ((macro != NULL) && macro->body.macro.is_conditional) {
 645  629                  conditional_macro_used = true;
 646  630                  /*
 647  631                   * Add this conditional macro to the beginning of the
 648  632                   * global list.
 649  633                   */
 650  634                  add_macro_to_global_list(name);
 651  635                  if (makefile_type == reading_makefile) {
 652  636                          warning_mksh(catgets(libmksdmsi18n_catd, 1, 164, "Conditional macro `%s' referenced in file `%ws', line %d"),
 653  637                                          name->string_mb, file_being_read, line_number);
↓ open down ↓ 260 lines elided ↑ open up ↑
 914  898   */
 915  899  static void
 916  900  init_arch_macros(void)
 917  901  {
 918  902          String_rec      result_string;
 919  903          wchar_t         wc_buf[STRING_BUFFER_LENGTH];
 920  904          char            mb_buf[STRING_BUFFER_LENGTH];
 921  905          FILE            *pipe;
 922  906          Name            value;
 923  907          int             set_host, set_target;
 924      -#ifdef NSE
 925      -        Property        macro;
 926      -#endif
 927  908          const char      *mach_command = NOCATGETS("/bin/mach");
 928  909  
 929  910          set_host = (get_prop(host_arch->prop, macro_prop) == NULL);
 930  911          set_target = (get_prop(target_arch->prop, macro_prop) == NULL);
 931  912  
 932  913          if (set_host || set_target) {
 933  914                  INIT_STRING_FROM_STACK(result_string, wc_buf);
 934  915                  append_char((int) hyphen_char, &result_string);
 935  916  
 936  917                  if ((pipe = popen(mach_command, "r")) == NULL) {
↓ open down ↓ 2 lines elided ↑ open up ↑
 939  920                  while (fgets(mb_buf, sizeof(mb_buf), pipe) != NULL) {
 940  921                          MBSTOWCS(wcs_buffer, mb_buf);
 941  922                          append_string(wcs_buffer, &result_string, wslen(wcs_buffer));
 942  923                  }
 943  924                  if (pclose(pipe) != 0) {
 944  925                          fatal_mksh(catgets(libmksdmsi18n_catd, 1, 186, "Execute of %s failed"), mach_command);
 945  926                  }
 946  927  
 947  928                  value = GETNAME(result_string.buffer.start, wslen(result_string.buffer.start));
 948  929  
 949      -#ifdef NSE
 950      -                macro = setvar_daemon(host_arch, value, false, no_daemon, true, 0);
 951      -                macro->body.macro.imported= true;
 952      -                macro = setvar_daemon(target_arch, value, false, no_daemon, true, 0);
 953      -                macro->body.macro.imported= true;
 954      -#else
 955  930                  if (set_host) {
 956  931                          (void) setvar_daemon(host_arch, value, false, no_daemon, true, 0);
 957  932                  }
 958  933                  if (set_target) {
 959  934                          (void) setvar_daemon(target_arch, value, false, no_daemon, true, 0);
 960  935                  }
 961      -#endif
 962  936          }
 963  937  }
 964  938  
 965  939  /*
 966  940   *      init_mach_macros(void)
 967  941   *
 968  942   *      Set the magic macros TARGET_MACH, HOST_MACH,
 969  943   *
 970  944   *      Parameters: 
 971  945   *
↓ open down ↓ 53 lines elided ↑ open up ↑
1025  999   *      Parameters:
1026 1000   *              name            Name of the macro  (Added by the NSE)
1027 1001   *              macro           The property block with the value to expand
1028 1002   *              destination     Where the result should be deposited
1029 1003   *              cmd             If we are evaluating a command line we
1030 1004   *                              turn \ quoting off
1031 1005   *
1032 1006   *      Global variables used:
1033 1007   */
1034 1008  static void
1035      -#ifdef NSE
1036      -expand_value_with_daemon(Name name, register Property macro, register String destination, Boolean cmd)
1037      -#else
1038 1009  expand_value_with_daemon(Name, register Property macro, register String destination, Boolean cmd)
1039      -#endif
1040 1010  {
1041 1011          register Chain          chain;
1042 1012  
1043      -#ifdef NSE
1044      -        if (reading_dependencies) {
1045      -                /*
1046      -                 * Processing the dependencies themselves
1047      -                 */
1048      -                depvar_dep_macro_used(name);
1049      -        } else {
1050      -                /*
1051      -                 * Processing the rules for the targets
1052      -                 * the nse_watch_vars flags chokes off most
1053      -                 * checks.  it is true only when processing
1054      -                 * the output from a recursive make run
1055      -                 * which is all we are interested in here.
1056      -                 */
1057      -                 if (nse_watch_vars) {
1058      -                        depvar_rule_macro_used(name);
1059      -                }
1060      -         }
1061      -#endif
1062 1013  
1063 1014          switch (macro->body.macro.daemon) {
1064 1015          case no_daemon:
1065 1016                  if (!svr4 && !posix) {
1066 1017                          expand_value(macro->body.macro.value, destination, cmd);
1067 1018                  } else {
1068 1019                          if (dollarless_flag && tilde_rule) {
1069 1020                                  expand_value(dollarless_value, destination, cmd);
1070 1021                                  dollarless_flag = false;
1071 1022                                  tilde_rule = false;
↓ open down ↓ 57 lines elided ↑ open up ↑
1129 1080          register Property       macro = maybe_append_prop(name, macro_prop);
1130 1081          register Property       macro_apx = get_prop(name->prop, macro_append_prop);
1131 1082          int                     length = 0;
1132 1083          String_rec              destination;
1133 1084          wchar_t                 buffer[STRING_BUFFER_LENGTH];
1134 1085          register Chain          chain;
1135 1086          Name                    val;
1136 1087          wchar_t                 *val_string = (wchar_t*)NULL;
1137 1088          Wstring                 wcb;
1138 1089  
1139      -#ifdef NSE
1140      -        macro->body.macro.imported = false;
1141      -#endif
1142 1090  
1143 1091          if ((makefile_type != reading_nothing) &&
1144 1092              macro->body.macro.read_only) {
1145 1093                  return macro;
1146 1094          }
1147 1095          /* Strip spaces from the end of the value */
1148 1096          if (daemon == no_daemon) {
1149 1097                  if(value != NULL) {
1150 1098                          wcb.init(value);
1151 1099                          length = wcb.length();
↓ open down ↓ 246 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX