Print this page
make: unifdef for USE_DMS_CCR (undefined)


  22  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  *      main.cc
  28  *
  29  *      make program main routine plus some helper routines
  30  */
  31  
  32 /*
  33  * Included files
  34  */
  35 #if defined(TEAMWARE_MAKE_CMN)
  36 #       include <avo/intl.h>
  37 #       include <avo/libcli.h>          /* libcli_init() */
  38 #       include <avo/cli_license.h>       /* avo_cli_get_license() */
  39 #       include <avo/find_dir.h>  /* avo_find_run_dir() */
  40 #       include <avo/version_string.h>
  41 #       include <avo/util.h>              /* avo_init() */
  42 #ifdef USE_DMS_CCR
  43 #       include <avo/usage_tracking.h>
  44 #else
  45 #       include <avo/cleanup.h>
  46 #endif
  47 #endif
  48 
  49 #if defined(TEAMWARE_MAKE_CMN)
  50 /* This is for dmake only (not for Solaris make).
  51  * Include code to check updates (dmake patches)
  52  */
  53 #ifdef _CHECK_UPDATE_H
  54 #include <libAU.h>
  55 #endif
  56 #endif
  57 
  58 #include <bsd/bsd.h>              /* bsd_signal() */
  59 
  60 #ifdef DISTRIBUTED
  61 #       include <dm/Avo_AcknowledgeMsg.h>
  62 #       include <rw/xdrstrea.h>
  63 #       include <dmrc/dmrc.h> /* dmakerc file processing */
  64 #endif
  65 
  66 #include <locale.h>               /* setlocale() */
  67 #include <mk/defs.h>
  68 #include <mksdmsi18n/mksdmsi18n.h>        /* libmksdmsi18n_init() */
  69 #include <mksh/macro.h>           /* getvar() */
  70 #include <mksh/misc.h>            /* getmem(), setup_char_semantics() */
  71 
  72 #if defined(TEAMWARE_MAKE_CMN)
  73 #ifdef USE_DMS_CCR
  74 #       include <pubdmsi18n/pubdmsi18n.h> /* libpubdmsi18n_init() */
  75 #endif
  76 #endif
  77 
  78 #include <pwd.h>          /* getpwnam() */
  79 #include <setjmp.h>
  80 #include <signal.h>
  81 #include <stdlib.h>
  82 #include <sys/errno.h>            /* ENOENT */
  83 #include <sys/stat.h>             /* fstat() */
  84 #include <fcntl.h>                /* open() */
  85 
  86 #       include <sys/systeminfo.h>        /* sysinfo() */
  87 
  88 #include <sys/types.h>            /* stat() */
  89 #include <sys/wait.h>             /* wait() */
  90 #include <unistd.h>               /* execv(), unlink(), access() */
  91 #include <vroot/report.h> /* report_dependency(), get_report_file() */
  92 
  93 // From read2.cc
  94 extern  Name            normalize_name(register wchar_t *name_string, register int length);
  95 


 130 static  Boolean         env_wins;                       /* `-e' */
 131 static  Boolean         ignore_default_mk;              /* `-r' */
 132 static  Boolean         list_all_targets;               /* `-T' */
 133 static  int             mf_argc;
 134 static  char            **mf_argv;
 135 static  Dependency_rec  not_auto_depen_struct;
 136 static  Dependency      not_auto_depen = &not_auto_depen_struct;
 137 static  Boolean         pmake_cap_r_specified;          /* `-R' */
 138 static  Boolean         pmake_machinesfile_specified;   /* `-M' */
 139 static  Boolean         stop_after_error_ever_seen;     /* `-S' */
 140 static  Boolean         trace_status;                   /* `-p' */
 141 
 142 #ifdef DMAKE_STATISTICS
 143 static  Boolean         getname_stat = false;
 144 #endif
 145 
 146 #if defined(TEAMWARE_MAKE_CMN)
 147         static  time_t          start_time;
 148         static  int             g_argc;
 149         static  char            **g_argv;
 150 #ifdef USE_DMS_CCR
 151         static  Avo_usage_tracking *usageTracking = NULL;
 152 #else
 153         static  Avo_cleanup     *cleanup = NULL;
 154 #endif
 155 #endif
 156 
 157 /*
 158  * File table of contents
 159  */
 160         extern "C" void         cleanup_after_exit(void);
 161 
 162 #ifdef TEAMWARE_MAKE_CMN
 163 extern "C" {
 164         extern  void            dmake_exit_callback(void);
 165         extern  void            dmake_message_callback(char *);
 166 }
 167 #endif
 168 
 169 extern  Name            normalize_name(register wchar_t *name_string, register int length);
 170 
 171 extern  int             main(int, char * []);
 172 
 173 static  void            append_makeflags_string(Name, String);
 174 static  void            doalarm(int);
 175 static  void            enter_argv_values(int , char **, ASCII_Dyn_Array *);


 258 
 259         (void) setlocale(LC_ALL, "");
 260 
 261 
 262 #ifdef DMAKE_STATISTICS
 263         if (getenv(NOCATGETS("DMAKE_STATISTICS"))) {
 264                 getname_stat = true;
 265         }
 266 #endif
 267 
 268 
 269         /*
 270          * avo_init() sets the umask to 0.  Save it here and restore
 271          * it after the avo_init() call.
 272          */
 273 #if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL)
 274         um = umask(0);
 275         avo_init(argv[0]);
 276         umask(um);
 277 
 278 #ifdef USE_DMS_CCR
 279         usageTracking = new Avo_usage_tracking(NOCATGETS("dmake"), argc, argv);
 280 #else
 281         cleanup = new Avo_cleanup(NOCATGETS("dmake"), argc, argv);
 282 #endif
 283 #endif
 284 
 285 #if defined(TEAMWARE_MAKE_CMN)
 286         catd = catopen(AVO_DOMAIN_DMAKE, NL_CAT_LOCALE);
 287         libcli_init();
 288 
 289 #ifdef _CHECK_UPDATE_H
 290         /* This is for dmake only (not for Solaris make).
 291          * Check (in background) if there is an update (dmake patch)
 292          * and inform user
 293          */
 294         {
 295                 Avo_err         *err;
 296                 char            *dir;
 297                 err = avo_find_run_dir(&dir);
 298                 if (AVO_OK == err) {
 299                         AU_check_update_service(NOCATGETS("Dmake"), dir);
 300                 }
 301         }
 302 #endif /* _CHECK_UPDATE_H */
 303 #endif
 304 
 305 // ---> fprintf(stderr, catgets(catd, 15, 666, "--- SUN make ---\n"));
 306 
 307 
 308 #if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL)
 309 /*
 310  * I put libmksdmsi18n_init() under #ifdef because it requires avo_i18n_init()
 311  * from avo_util library. 
 312  */
 313         libmksdmsi18n_init();
 314 #ifdef USE_DMS_CCR
 315         libpubdmsi18n_init();
 316 #endif
 317 #endif
 318 
 319 
 320 #ifndef TEAMWARE_MAKE_CMN
 321         textdomain(NOCATGETS("SUNW_SPRO_MAKE"));
 322 #endif /* TEAMWARE_MAKE_CMN */
 323 
 324 #ifdef TEAMWARE_MAKE_CMN
 325         g_argc = argc;
 326         g_argv = (char **) malloc((g_argc + 1) * sizeof(char *));
 327         for (i = 0; i < argc; i++) {
 328                 g_argv[i] = argv[i];
 329         }
 330         g_argv[i] = NULL;
 331 #endif /* TEAMWARE_MAKE_CMN */
 332 
 333         /*
 334          * Set argv_zero_string to some form of argv[0] for
 335          * recursive MAKE builds.
 336          */


 779  *
 780  *      Parameters:
 781  *              status          The argument exit() was called with
 782  *              arg             Address of an argument vector to
 783  *                              cleanup_after_exit()
 784  *
 785  *      Global variables used:
 786  *              command_changed Set if we think .make.state should be rewritten
 787  *              current_line    Is set we set commands_changed
 788  *              do_not_exec_rule
 789  *                              True if -n flag on
 790  *              done            The Name ".DONE", rule we run
 791  *              keep_state      Set if .KEEP_STATE seen
 792  *              parallel        True if building in parallel
 793  *              quest           If -q is on we do not run .DONE
 794  *              report_dependencies
 795  *                              True if -P flag on
 796  *              running_list    List of parallel running processes
 797  *              temp_file_name  The temp file is removed, if any
 798  *              catd    the message catalog file
 799  *              usage_tracking  Should have been constructed in main()
 800  *                              should destroyed just before exiting
 801  */
 802 extern "C" void
 803 cleanup_after_exit(void)
 804 {
 805         Running         rp;
 806 
 807 extern long     getname_bytes_count;
 808 extern long     getname_names_count;
 809 extern long     getname_struct_count;
 810 extern long     freename_bytes_count;
 811 extern long     freename_names_count;
 812 extern long     freename_struct_count;
 813 extern long     other_alloc;
 814 
 815 extern long     env_alloc_num;
 816 extern long     env_alloc_bytes;
 817 
 818 
 819 #ifdef DMAKE_STATISTICS
 820 if(getname_stat) {


 917                 }
 918                 command_changed = true;
 919 /*
 920                 line = get_prop(rp->target->prop, line_prop);
 921                 if (line != NULL) {
 922                         line->body.line.command_used = NULL;
 923                 }
 924  */
 925         }
 926         /* Remove the statefile lock file if the file has been locked */
 927         if ((make_state_lockfile != NULL) && (make_state_locked)) {
 928                 (void) unlink(make_state_lockfile);
 929                 make_state_lockfile = NULL;
 930                 make_state_locked = false;
 931         }
 932         /* Write .make.state */
 933         write_state_file(1, (Boolean) 1);
 934 
 935 #ifdef TEAMWARE_MAKE_CMN
 936         // Deleting the usage tracking object sends the usage mail 
 937 #ifdef USE_DMS_CCR
 938         //usageTracking->setExitStatus(exit_status, NULL);
 939         //delete usageTracking;
 940 #else
 941         cleanup->set_exit_status(exit_status);
 942         delete cleanup;
 943 #endif
 944 #endif
 945 
 946 /*
 947 #ifdef DISTRIBUTED
 948     }
 949 #endif
 950  */
 951 
 952 #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
 953         job_adjust_fini();
 954 #endif
 955 
 956 #ifdef TEAMWARE_MAKE_CMN
 957         catclose(catd);
 958 #endif
 959 #ifdef DISTRIBUTED
 960         if (rxmPid > 0) {
 961                 // Tell rxm to exit by sending it an Avo_AcknowledgeMsg
 962                 Avo_AcknowledgeMsg acknowledgeMsg;
 963                 RWCollectable *msg = (RWCollectable *)&acknowledgeMsg;
 964 




  22  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  *      main.cc
  28  *
  29  *      make program main routine plus some helper routines
  30  */
  31  
  32 /*
  33  * Included files
  34  */
  35 #if defined(TEAMWARE_MAKE_CMN)
  36 #       include <avo/intl.h>
  37 #       include <avo/libcli.h>          /* libcli_init() */
  38 #       include <avo/cli_license.h>       /* avo_cli_get_license() */
  39 #       include <avo/find_dir.h>  /* avo_find_run_dir() */
  40 #       include <avo/version_string.h>
  41 #       include <avo/util.h>              /* avo_init() */



  42 #       include <avo/cleanup.h>
  43 #endif

  44 
  45 #if defined(TEAMWARE_MAKE_CMN)
  46 /* This is for dmake only (not for Solaris make).
  47  * Include code to check updates (dmake patches)
  48  */
  49 #ifdef _CHECK_UPDATE_H
  50 #include <libAU.h>
  51 #endif
  52 #endif
  53 
  54 #include <bsd/bsd.h>              /* bsd_signal() */
  55 
  56 #ifdef DISTRIBUTED
  57 #       include <dm/Avo_AcknowledgeMsg.h>
  58 #       include <rw/xdrstrea.h>
  59 #       include <dmrc/dmrc.h> /* dmakerc file processing */
  60 #endif
  61 
  62 #include <locale.h>               /* setlocale() */
  63 #include <mk/defs.h>
  64 #include <mksdmsi18n/mksdmsi18n.h>        /* libmksdmsi18n_init() */
  65 #include <mksh/macro.h>           /* getvar() */
  66 #include <mksh/misc.h>            /* getmem(), setup_char_semantics() */
  67 
  68 #if defined(TEAMWARE_MAKE_CMN)



  69 #endif
  70 
  71 #include <pwd.h>          /* getpwnam() */
  72 #include <setjmp.h>
  73 #include <signal.h>
  74 #include <stdlib.h>
  75 #include <sys/errno.h>            /* ENOENT */
  76 #include <sys/stat.h>             /* fstat() */
  77 #include <fcntl.h>                /* open() */
  78 
  79 #       include <sys/systeminfo.h>        /* sysinfo() */
  80 
  81 #include <sys/types.h>            /* stat() */
  82 #include <sys/wait.h>             /* wait() */
  83 #include <unistd.h>               /* execv(), unlink(), access() */
  84 #include <vroot/report.h> /* report_dependency(), get_report_file() */
  85 
  86 // From read2.cc
  87 extern  Name            normalize_name(register wchar_t *name_string, register int length);
  88 


 123 static  Boolean         env_wins;                       /* `-e' */
 124 static  Boolean         ignore_default_mk;              /* `-r' */
 125 static  Boolean         list_all_targets;               /* `-T' */
 126 static  int             mf_argc;
 127 static  char            **mf_argv;
 128 static  Dependency_rec  not_auto_depen_struct;
 129 static  Dependency      not_auto_depen = &not_auto_depen_struct;
 130 static  Boolean         pmake_cap_r_specified;          /* `-R' */
 131 static  Boolean         pmake_machinesfile_specified;   /* `-M' */
 132 static  Boolean         stop_after_error_ever_seen;     /* `-S' */
 133 static  Boolean         trace_status;                   /* `-p' */
 134 
 135 #ifdef DMAKE_STATISTICS
 136 static  Boolean         getname_stat = false;
 137 #endif
 138 
 139 #if defined(TEAMWARE_MAKE_CMN)
 140         static  time_t          start_time;
 141         static  int             g_argc;
 142         static  char            **g_argv;



 143         static  Avo_cleanup     *cleanup = NULL;
 144 #endif

 145 
 146 /*
 147  * File table of contents
 148  */
 149         extern "C" void         cleanup_after_exit(void);
 150 
 151 #ifdef TEAMWARE_MAKE_CMN
 152 extern "C" {
 153         extern  void            dmake_exit_callback(void);
 154         extern  void            dmake_message_callback(char *);
 155 }
 156 #endif
 157 
 158 extern  Name            normalize_name(register wchar_t *name_string, register int length);
 159 
 160 extern  int             main(int, char * []);
 161 
 162 static  void            append_makeflags_string(Name, String);
 163 static  void            doalarm(int);
 164 static  void            enter_argv_values(int , char **, ASCII_Dyn_Array *);


 247 
 248         (void) setlocale(LC_ALL, "");
 249 
 250 
 251 #ifdef DMAKE_STATISTICS
 252         if (getenv(NOCATGETS("DMAKE_STATISTICS"))) {
 253                 getname_stat = true;
 254         }
 255 #endif
 256 
 257 
 258         /*
 259          * avo_init() sets the umask to 0.  Save it here and restore
 260          * it after the avo_init() call.
 261          */
 262 #if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL)
 263         um = umask(0);
 264         avo_init(argv[0]);
 265         umask(um);
 266 



 267         cleanup = new Avo_cleanup(NOCATGETS("dmake"), argc, argv);
 268 #endif

 269 
 270 #if defined(TEAMWARE_MAKE_CMN)
 271         catd = catopen(AVO_DOMAIN_DMAKE, NL_CAT_LOCALE);
 272         libcli_init();
 273 
 274 #ifdef _CHECK_UPDATE_H
 275         /* This is for dmake only (not for Solaris make).
 276          * Check (in background) if there is an update (dmake patch)
 277          * and inform user
 278          */
 279         {
 280                 Avo_err         *err;
 281                 char            *dir;
 282                 err = avo_find_run_dir(&dir);
 283                 if (AVO_OK == err) {
 284                         AU_check_update_service(NOCATGETS("Dmake"), dir);
 285                 }
 286         }
 287 #endif /* _CHECK_UPDATE_H */
 288 #endif
 289 
 290 // ---> fprintf(stderr, catgets(catd, 15, 666, "--- SUN make ---\n"));
 291 
 292 
 293 #if defined(TEAMWARE_MAKE_CMN) || defined(MAKETOOL)
 294 /*
 295  * I put libmksdmsi18n_init() under #ifdef because it requires avo_i18n_init()
 296  * from avo_util library. 
 297  */
 298         libmksdmsi18n_init();



 299 #endif
 300 
 301 
 302 #ifndef TEAMWARE_MAKE_CMN
 303         textdomain(NOCATGETS("SUNW_SPRO_MAKE"));
 304 #endif /* TEAMWARE_MAKE_CMN */
 305 
 306 #ifdef TEAMWARE_MAKE_CMN
 307         g_argc = argc;
 308         g_argv = (char **) malloc((g_argc + 1) * sizeof(char *));
 309         for (i = 0; i < argc; i++) {
 310                 g_argv[i] = argv[i];
 311         }
 312         g_argv[i] = NULL;
 313 #endif /* TEAMWARE_MAKE_CMN */
 314 
 315         /*
 316          * Set argv_zero_string to some form of argv[0] for
 317          * recursive MAKE builds.
 318          */


 761  *
 762  *      Parameters:
 763  *              status          The argument exit() was called with
 764  *              arg             Address of an argument vector to
 765  *                              cleanup_after_exit()
 766  *
 767  *      Global variables used:
 768  *              command_changed Set if we think .make.state should be rewritten
 769  *              current_line    Is set we set commands_changed
 770  *              do_not_exec_rule
 771  *                              True if -n flag on
 772  *              done            The Name ".DONE", rule we run
 773  *              keep_state      Set if .KEEP_STATE seen
 774  *              parallel        True if building in parallel
 775  *              quest           If -q is on we do not run .DONE
 776  *              report_dependencies
 777  *                              True if -P flag on
 778  *              running_list    List of parallel running processes
 779  *              temp_file_name  The temp file is removed, if any
 780  *              catd    the message catalog file


 781  */
 782 extern "C" void
 783 cleanup_after_exit(void)
 784 {
 785         Running         rp;
 786 
 787 extern long     getname_bytes_count;
 788 extern long     getname_names_count;
 789 extern long     getname_struct_count;
 790 extern long     freename_bytes_count;
 791 extern long     freename_names_count;
 792 extern long     freename_struct_count;
 793 extern long     other_alloc;
 794 
 795 extern long     env_alloc_num;
 796 extern long     env_alloc_bytes;
 797 
 798 
 799 #ifdef DMAKE_STATISTICS
 800 if(getname_stat) {


 897                 }
 898                 command_changed = true;
 899 /*
 900                 line = get_prop(rp->target->prop, line_prop);
 901                 if (line != NULL) {
 902                         line->body.line.command_used = NULL;
 903                 }
 904  */
 905         }
 906         /* Remove the statefile lock file if the file has been locked */
 907         if ((make_state_lockfile != NULL) && (make_state_locked)) {
 908                 (void) unlink(make_state_lockfile);
 909                 make_state_lockfile = NULL;
 910                 make_state_locked = false;
 911         }
 912         /* Write .make.state */
 913         write_state_file(1, (Boolean) 1);
 914 
 915 #ifdef TEAMWARE_MAKE_CMN
 916         // Deleting the usage tracking object sends the usage mail 




 917         cleanup->set_exit_status(exit_status);
 918         delete cleanup;
 919 #endif

 920 
 921 /*
 922 #ifdef DISTRIBUTED
 923     }
 924 #endif
 925  */
 926 
 927 #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
 928         job_adjust_fini();
 929 #endif
 930 
 931 #ifdef TEAMWARE_MAKE_CMN
 932         catclose(catd);
 933 #endif
 934 #ifdef DISTRIBUTED
 935         if (rxmPid > 0) {
 936                 // Tell rxm to exit by sending it an Avo_AcknowledgeMsg
 937                 Avo_AcknowledgeMsg acknowledgeMsg;
 938                 RWCollectable *msg = (RWCollectable *)&acknowledgeMsg;
 939