1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * @(#)globals.cc 1.42 06/12/12
  27  */
  28 
  29 #pragma ident   "@(#)globals.cc 1.42    06/12/12"
  30 
  31 /*
  32  *      globals.cc
  33  *
  34  *      This declares all global variables
  35  */
  36 
  37 /*
  38  * Included files
  39  */
  40 #include <nl_types.h>
  41 #include <mk/defs.h>
  42 #include <sys/stat.h>
  43 
  44 /*
  45  * Defined macros
  46  */
  47 
  48 /*
  49  * typedefs & structs
  50  */
  51 
  52 /*
  53  * Global variables used by make only
  54  */
  55         FILE            *dependency_report_file;
  56 
  57 /*
  58  * Global variables used by make
  59  */
  60         Boolean         allrules_read=false;
  61         Name            posix_name;
  62         Name            svr4_name;
  63         Boolean         sdot_target;    /* used to identify s.m(/M)akefile */
  64         Boolean         all_parallel;                   /* TEAMWARE_MAKE_CMN */
  65         Boolean         assign_done;
  66         int foo;        
  67         Boolean         build_failed_seen;
  68 #ifdef DISTRIBUTED
  69         Boolean         building_serial;
  70 #endif
  71         Name            built_last_make_run;
  72         Name            c_at;
  73 #ifdef DISTRIBUTED
  74         Boolean         called_make = false;
  75 #endif
  76         Boolean         cleanup;
  77         Boolean         close_report;
  78         Boolean         command_changed;
  79         Boolean         commands_done;
  80         Chain           conditional_targets;
  81         Name            conditionals;
  82         Boolean         continue_after_error;           /* `-k' */
  83         Property        current_line;
  84         Name            current_make_version;
  85         Name            current_target;
  86         short           debug_level;
  87         Cmd_line        default_rule;
  88         Name            default_rule_name;
  89         Name            default_target_to_build;
  90         Name            dmake_group;
  91         Name            dmake_max_jobs;
  92         Name            dmake_mode;
  93         DMake_mode      dmake_mode_type;
  94         Name            dmake_output_mode;
  95         DMake_output_mode       output_mode = txt1_mode;
  96         Name            dmake_odir;
  97         Name            dmake_rcfile;
  98         Name            done;
  99         Name            dot;
 100         Name            dot_keep_state;
 101         Name            dot_keep_state_file;
 102         Name            empty_name;
 103 #if defined(HP_UX) ||  defined(linux)
 104         int             exit_status;
 105 #endif
 106         Boolean         fatal_in_progress;
 107         int             file_number;
 108 #if 0
 109         Boolean         filter_stderr;                  /* `-X' */
 110 #endif
 111         Name            force;
 112         Name            ignore_name;
 113         Boolean         ignore_errors;                  /* `-i' */
 114         Boolean         ignore_errors_all;              /* `-i' */
 115         Name            init;
 116         int             job_msg_id;
 117         Boolean         keep_state;
 118         Name            make_state;
 119 #ifdef TEAMWARE_MAKE_CMN
 120         timestruc_t     make_state_before;
 121 #endif
 122         Dependency      makefiles_used;
 123         Name            makeflags;
 124 //      Boolean         make_state_locked; // Moved to lib/mksh
 125         Name            make_version;
 126         char            mbs_buffer2[(MAXPATHLEN * MB_LEN_MAX)];
 127         char            *mbs_ptr;
 128         char            *mbs_ptr2;
 129         int             mtool_msgs_fd;
 130         Boolean         depinfo_already_read = false;
 131 #ifdef NSE
 132         Name            derived_src;
 133         Boolean         nse;                            /* NSE on */
 134         Name            nse_backquote_seen;
 135         char            nse_depinfo_lockfile[MAXPATHLEN];
 136         Boolean         nse_depinfo_locked;
 137         Boolean         nse_did_recursion;
 138         Name            nse_shell_var_used;
 139         Boolean         nse_watch_vars = false;
 140         wchar_t         current_makefile[MAXPATHLEN];
 141 #endif
 142         Boolean         no_action_was_taken = true;     /* true if we've not **
 143                                                         ** run any command   */
 144 
 145         Boolean         no_parallel = false;            /* TEAMWARE_MAKE_CMN */
 146 #ifdef SGE_SUPPORT
 147         Boolean         grid = false;                   /* TEAMWARE_MAKE_CMN */
 148 #endif
 149         Name            no_parallel_name;
 150         Name            not_auto;
 151         Boolean         only_parallel;                  /* TEAMWARE_MAKE_CMN */
 152         Boolean         parallel;                       /* TEAMWARE_MAKE_CMN */
 153         Name            parallel_name;
 154         Name            localhost_name;
 155         int             parallel_process_cnt;
 156         Percent         percent_list;
 157         Dyntarget       dyntarget_list;
 158         Name            plus;
 159         Name            pmake_machinesfile;
 160         Name            precious;
 161         Name            primary_makefile;
 162         Boolean         quest;                          /* `-q' */
 163         short           read_trace_level;
 164         Boolean         reading_dependencies = false;
 165         Name            recursive_name;
 166         int             recursion_level;
 167         short           report_dependencies_level = 0;  /* -P */
 168         Boolean         report_pwd;
 169         Boolean         rewrite_statefile;
 170         Running         running_list;
 171         char            *sccs_dir_path;
 172         Name            sccs_get_name;
 173         Name            sccs_get_posix_name;
 174         Cmd_line        sccs_get_rule;
 175         Cmd_line        sccs_get_org_rule;
 176         Cmd_line        sccs_get_posix_rule;
 177         Name            get_name;
 178         Cmd_line        get_rule;
 179         Name            get_posix_name;
 180         Cmd_line        get_posix_rule;
 181         Boolean         send_mtool_msgs;                /* `-K' */
 182         Boolean         all_precious;
 183         Boolean         silent_all;                     /* `-s' */
 184         Boolean         report_cwd;                     /* `-w' */
 185         Boolean         silent;                         /* `-s' */
 186         Name            silent_name;
 187         char            *stderr_file = NULL;
 188         char            *stdout_file = NULL;
 189 #ifdef SGE_SUPPORT
 190         char            script_file[MAXPATHLEN] = "";
 191 #endif
 192         Boolean         stdout_stderr_same;
 193         Dependency      suffixes;
 194         Name            suffixes_name;
 195         Name            sunpro_dependencies;
 196         Boolean         target_variants;
 197         char            *tmpdir = NOCATGETS("/tmp");
 198         char            *temp_file_directory = NOCATGETS(".");
 199         Name            temp_file_name;
 200         short           temp_file_number;
 201         time_t          timing_start;
 202         wchar_t         *top_level_target;
 203         Boolean         touch;                          /* `-t' */
 204         Boolean         trace_reader;                   /* `-D' */
 205         Boolean         build_unconditional;            /* `-u' */
 206         pathpt          vroot_path = VROOT_DEFAULT;
 207         Name            wait_name;
 208         wchar_t         wcs_buffer2[MAXPATHLEN];
 209         wchar_t         *wcs_ptr;
 210         wchar_t         *wcs_ptr2;
 211         nl_catd         catd;
 212         long int        hostid;
 213 
 214 /*
 215  * File table of contents
 216  */
 217