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