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 * Copyright 2019, Joyent, Inc.
26 */
27
28/*
29 *	globals.cc
30 *
31 *	This declares all global variables
32 */
33
34/*
35 * Included files
36 */
37#include <nl_types.h>
38#include <mk/defs.h>
39#include <sys/stat.h>
40
41/*
42 * Defined macros
43 */
44
45/*
46 * typedefs & structs
47 */
48
49/*
50 * Global variables used by make only
51 */
52	FILE		*dependency_report_file;
53
54/*
55 * Global variables used by make
56 */
57	Boolean		allrules_read=false;
58	Name		posix_name;
59	Name		svr4_name;
60	Boolean		sdot_target;	/* used to identify s.m(/M)akefile */
61	Boolean		all_parallel;
62	Boolean		assign_done;
63	int foo;
64	Boolean		build_failed_seen;
65	Name		built_last_make_run;
66	Name		c_at;
67	Boolean		cleanup;
68	Boolean		close_report;
69	Boolean		command_changed;
70	Boolean		commands_done;
71	Chain		conditional_targets;
72	Name		conditionals;
73	Boolean		continue_after_error;		/* `-k' */
74	Property	current_line;
75	Name		current_make_version;
76	Name		current_target;
77	short		debug_level;
78	Cmd_line	default_rule;
79	Name		default_rule_name;
80	Name		default_target_to_build;
81	Name		dmake_group;
82	Name		dmake_max_jobs;
83	Name		dmake_mode;
84	DMake_mode	dmake_mode_type;
85	Name		dmake_output_mode;
86	DMake_output_mode	output_mode = txt1_mode;
87	Name		dmake_odir;
88	Name		dmake_rcfile;
89	Name		done;
90	Name		dot;
91	Name		dot_keep_state;
92	Name		dot_keep_state_file;
93	Name		empty_name;
94	Boolean		fatal_in_progress;
95	int		file_number;
96#if 0
97	Boolean		filter_stderr;			/* `-X' */
98#endif
99	Name		force;
100	Name		ignore_name;
101	Boolean		ignore_errors;			/* `-i' */
102	Boolean		ignore_errors_all;		/* `-i' */
103	Name		init;
104	int		job_msg_id;
105	Boolean		keep_state;
106	Name		make_state;
107	timestruc_t	make_state_before;
108	Dependency	makefiles_used;
109	Name		makeflags;
110//	Boolean		make_state_locked; // Moved to lib/mksh
111	Name		make_version;
112	char		mbs_buffer2[(MAXPATHLEN * MB_LEN_MAX)];
113	char		*mbs_ptr;
114	char		*mbs_ptr2;
115	Boolean		depinfo_already_read = false;
116	Boolean		no_action_was_taken = true;	/* true if we've not **
117							** run any command   */
118
119	Boolean		no_parallel = false;
120	Name		no_parallel_name;
121	Name		not_auto;
122	Boolean		only_parallel;
123	Boolean		parallel;
124	Name		parallel_name;
125	Name		localhost_name;
126	int		parallel_process_cnt;
127	Percent		percent_list;
128	Dyntarget	dyntarget_list;
129	Name		plus;
130	Name		pmake_machinesfile;
131	Name		precious;
132        Name		primary_makefile;
133	Boolean		quest;				/* `-q' */
134	short		read_trace_level;
135        Boolean		reading_dependencies = false;
136	Name		recursive_name;
137	int		recursion_level;
138	short		report_dependencies_level = 0;	/* -P */
139	Boolean		report_pwd;
140	Boolean		rewrite_statefile;
141	Running		running_list;
142	char		*sccs_dir_path;
143	Name		sccs_get_name;
144	Name		sccs_get_posix_name;
145	Cmd_line	sccs_get_rule;
146	Cmd_line	sccs_get_org_rule;
147	Cmd_line	sccs_get_posix_rule;
148	Name		get_name;
149	Cmd_line	get_rule;
150	Name		get_posix_name;
151	Cmd_line	get_posix_rule;
152	Boolean		all_precious;
153	Boolean		silent_all;			/* `-s' */
154	Boolean		report_cwd;			/* `-w' */
155	Boolean		silent;				/* `-s' */
156	Name		silent_name;
157	char		*stderr_file = NULL;
158	char		*stdout_file = NULL;
159	Boolean		stdout_stderr_same;
160	Dependency	suffixes;
161	Name		suffixes_name;
162	Name		sunpro_dependencies;
163        Boolean		target_variants;
164	const char	*tmpdir = "/tmp";
165	const char	*temp_file_directory = ".";
166	Name		temp_file_name;
167	short		temp_file_number;
168	time_t		timing_start;
169	wchar_t		*top_level_target;
170	Boolean		touch;				/* `-t' */
171	Boolean		trace_reader;			/* `-D' */
172	Boolean		build_unconditional;		/* `-u' */
173	pathpt		vroot_path = VROOT_DEFAULT;
174	Name		wait_name;
175	wchar_t		wcs_buffer2[MAXPATHLEN];
176	wchar_t		*wcs_ptr;
177	wchar_t		*wcs_ptr2;
178	long int	hostid;
179	Boolean		path_reset = false;
180	Boolean		rebuild_arg0 = false;
181
182/*
183 * File table of contents
184 */
185
186