Print this page
make: unifdef for other OSes (undefined)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/make/include/mk/defs.h
+++ new/usr/src/cmd/make/include/mk/defs.h
1 1 #ifndef _MK_DEFS_H
2 2 #define _MK_DEFS_H
3 3 /*
4 4 * CDDL HEADER START
5 5 *
6 6 * The contents of this file are subject to the terms of the
7 7 * Common Development and Distribution License (the "License").
8 8 * You may not use this file except in compliance with the License.
9 9 *
10 10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 11 * or http://www.opensolaris.org/os/licensing.
12 12 * See the License for the specific language governing permissions
13 13 * and limitations under the License.
14 14 *
15 15 * When distributing Covered Code, include this CDDL HEADER in each
16 16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 17 * If applicable, add the following below this CDDL HEADER, with the
18 18 * fields enclosed by brackets "[]" replaced with your own identifying
19 19 * information: Portions Copyright [yyyy] [name of copyright owner]
20 20 *
21 21 * CDDL HEADER END
22 22 */
23 23 /*
24 24 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
25 25 * Use is subject to license terms.
26 26 */
27 27
28 28 /*
29 29 * Included files
30 30 */
31 31 #ifdef DISTRIBUTED
32 32 # include <dm/Avo_AcknowledgeMsg.h>
33 33 # include <dm/Avo_DoJobMsg.h>
34 34 # include <dm/Avo_JobResultMsg.h>
35 35 #endif
36 36
37 37 #include <mksh/defs.h>
38 38
39 39 #if defined(DISTRIBUTED) || defined(MAKETOOL) /* tolik */
40 40 # include <rw/xdrstrea.h>
41 41 #endif
42 42
43 43
44 44 /*
45 45 * Defined macros
46 46 */
47 47
48 48 #define SKIPSPACE(x) while (*x && \
49 49 ((*x == (int) space_char) || \
50 50 (*x == (int) tab_char) || \
51 51 (*x == (int) comma_char))) { \
52 52 x++; \
53 53 }
54 54
55 55 #define SKIPWORD(x) while (*x && \
56 56 (*x != (int) space_char) && \
57 57 (*x != (int) tab_char) && \
58 58 (*x != (int) newline_char) && \
59 59 (*x != (int) comma_char) && \
60 60 (*x != (int) equal_char)) { \
61 61 x++; \
62 62 }
63 63
64 64 #define SKIPTOEND(x) while (*x && \
65 65 (*x != (int) newline_char)) { \
66 66 x++; \
67 67 }
68 68
69 69 #define PMAKE_DEF_MAX_JOBS 2 /* Default number of parallel jobs. */
70 70
71 71 #define OUT_OF_DATE(a,b) \
72 72 (((a) < (b)) || (((a) == file_doesnt_exist) && ((b) == file_doesnt_exist)))
73 73
74 74 #define OUT_OF_DATE_SEC(a,b) \
75 75 (((a).tv_sec < (b).tv_sec) || (((a).tv_sec == file_doesnt_exist.tv_sec) && ((b).tv_sec == file_doesnt_exist.tv_sec)))
76 76
77 77 #define SETVAR(name, value, append) \
78 78 setvar_daemon(name, value, append, no_daemon, \
79 79 true, debug_level)
80 80 #define MAX(a,b) (((a)>(b))?(a):(b))
81 81 /*
82 82 * New feature added to SUN5_0 make, invoke the vanilla svr4 make when
83 83 * the USE_SVR4_MAKE environment variable is set.
84 84 */
85 85 #define SVR4_MAKE "/usr/ccs/lib/svr4.make"
86 86 #define USE_SVR4_MAKE "USE_SVR4_MAKE"
87 87 /*
88 88 * The standard MAXHOSTNAMELEN is 64. We want 32.
89 89 */
90 90 #define MAX_HOSTNAMELEN 32
91 91
92 92
93 93 /*
94 94 * typedefs & structs
95 95 */
96 96 typedef enum {
97 97 no_state,
98 98 scan_name_state,
99 99 scan_command_state,
100 100 enter_dependencies_state,
101 101 enter_conditional_state,
102 102 enter_equal_state,
103 103 illegal_bytes_state,
104 104 illegal_eoln_state,
105 105 poorly_formed_macro_state,
106 106 exit_state
107 107 } Reader_state;
108 108
109 109 struct _Name_vector {
110 110 struct _Name *names[64];
111 111 struct _Chain *target_group[64];
112 112 short used;
113 113 struct _Name_vector *next;
114 114 };
115 115
116 116 struct _Running {
117 117 struct _Running *next;
118 118 Doname state;
119 119 struct _Name *target;
120 120 struct _Name *true_target;
121 121 struct _Property *command;
122 122 struct _Name *sprodep_value;
123 123 char *sprodep_env;
124 124 int recursion_level;
125 125 Boolean do_get;
126 126 Boolean implicit;
127 127 Boolean redo;
128 128 int auto_count;
129 129 struct _Name **automatics;
130 130 pid_t pid;
131 131 #ifdef TEAMWARE_MAKE_CMN
132 132 int job_msg_id;
133 133 #else
134 134 int host;
135 135 #endif
136 136 char *stdout_file;
137 137 char *stderr_file;
138 138 struct _Name *temp_file;
139 139 int conditional_cnt;
140 140 struct _Name **conditional_targets;
141 141 #ifdef TEAMWARE_MAKE_CMN
142 142 Boolean make_refd;
143 143 #endif
144 144 };
145 145
146 146 typedef enum {
147 147 serial_mode,
148 148 parallel_mode,
149 149 distributed_mode
150 150 } DMake_mode;
151 151
152 152 typedef enum {
153 153 txt1_mode,
154 154 txt2_mode,
155 155 html1_mode
156 156 } DMake_output_mode;
157 157
158 158 struct _Recursive_make {
159 159 struct _Recursive_make *next; /* Linked list */
160 160 wchar_t *target;/* Name of target */
161 161 wchar_t *oldline;/* Original line in .nse_depinfo */
162 162 wchar_t *newline;/* New line in .nse_depinfo */
163 163 wchar_t *cond_macrostring;
164 164 /* string built from value of
165 165 * conditional macros used by
166 166 * this target
167 167 */
168 168 Boolean removed;/* This target is no longer recursive*/
169 169 };
170 170
171 171 struct _Dyntarget {
172 172 struct _Dyntarget *next;
173 173 struct _Name *name;
174 174 };
175 175
176 176
177 177 /*
178 178 * Typedefs for all structs
179 179 */
180 180 typedef struct _Cmd_line *Cmd_line, Cmd_line_rec;
181 181 typedef struct _Dependency *Dependency, Dependency_rec;
182 182 typedef struct _Macro *Macro, Macro_rec;
183 183 typedef struct _Name_vector *Name_vector, Name_vector_rec;
184 184 typedef struct _Percent *Percent, Percent_rec;
185 185 typedef struct _Dyntarget *Dyntarget;
186 186 typedef struct _Recursive_make *Recursive_make, Recursive_make_rec;
187 187 typedef struct _Running *Running, Running_rec;
188 188
189 189
190 190 /*
191 191 * extern declarations for all global variables.
192 192 * The actual declarations are in globals.cc
193 193 */
194 194 extern Boolean allrules_read;
195 195 extern Name posix_name;
196 196 extern Name svr4_name;
197 197 extern Boolean sdot_target;
198 198 extern Boolean all_parallel;
199 199 extern Boolean assign_done;
200 200 extern Boolean build_failed_seen;
201 201 #ifdef DISTRIBUTED
202 202 extern Boolean building_serial;
203 203 #endif
204 204 extern Name built_last_make_run;
205 205 extern Name c_at;
206 206 #ifdef DISTRIBUTED
207 207 extern Boolean called_make;
208 208 #endif
209 209 extern Boolean command_changed;
210 210 extern Boolean commands_done;
211 211 extern Chain conditional_targets;
212 212 extern Name conditionals;
213 213 extern Boolean continue_after_error;
214 214 extern Property current_line;
215 215 extern Name current_make_version;
216 216 extern Name current_target;
217 217 extern short debug_level;
218 218 extern Cmd_line default_rule;
219 219 extern Name default_rule_name;
220 220 extern Name default_target_to_build;
221 221 extern Boolean depinfo_already_read;
222 222 extern Name dmake_group;
223 223 extern Name dmake_max_jobs;
224 224 extern Name dmake_mode;
225 225 extern DMake_mode dmake_mode_type;
226 226 extern Name dmake_output_mode;
227 227 extern DMake_output_mode output_mode;
228 228 extern Name dmake_odir;
229 229 extern Name dmake_rcfile;
230 230 extern Name done;
231 231 extern Name dot;
232 232 extern Name dot_keep_state;
233 233 extern Name dot_keep_state_file;
234 234 extern Name empty_name;
235 235 extern Boolean fatal_in_progress;
236 236 extern int file_number;
237 237 extern Name force;
238 238 extern Name ignore_name;
239 239 extern Boolean ignore_errors;
240 240 extern Boolean ignore_errors_all;
241 241 extern Name init;
242 242 extern int job_msg_id;
243 243 extern Boolean keep_state;
244 244 extern Name make_state;
245 245 #ifdef TEAMWARE_MAKE_CMN
246 246 extern timestruc_t make_state_before;
247 247 #endif
248 248 extern Boolean make_state_locked;
249 249 extern Dependency makefiles_used;
250 250 extern Name makeflags;
251 251 extern Name make_version;
252 252 extern char mbs_buffer2[];
253 253 extern char *mbs_ptr;
254 254 extern char *mbs_ptr2;
255 255 extern Boolean no_action_was_taken;
256 256 extern int mtool_msgs_fd;
257 257 extern Boolean no_parallel;
258 258 #ifdef SGE_SUPPORT
259 259 extern Boolean grid;
260 260 #endif
261 261 extern Name no_parallel_name;
262 262 extern Name not_auto;
263 263 extern Boolean only_parallel;
264 264 extern Boolean parallel;
265 265 extern Name parallel_name;
266 266 extern Name localhost_name;
267 267 extern int parallel_process_cnt;
268 268 extern Percent percent_list;
269 269 extern Dyntarget dyntarget_list;
270 270 extern Name plus;
271 271 extern Name pmake_machinesfile;
272 272 extern Name precious;
273 273 extern Name primary_makefile;
274 274 extern Boolean quest;
275 275 extern short read_trace_level;
276 276 extern Boolean reading_dependencies;
277 277 extern int recursion_level;
278 278 extern Name recursive_name;
279 279 extern short report_dependencies_level;
280 280 extern Boolean report_pwd;
281 281 extern Boolean rewrite_statefile;
282 282 extern Running running_list;
283 283 extern char *sccs_dir_path;
284 284 extern Name sccs_get_name;
285 285 extern Name sccs_get_posix_name;
286 286 extern Cmd_line sccs_get_rule;
287 287 extern Cmd_line sccs_get_org_rule;
288 288 extern Cmd_line sccs_get_posix_rule;
289 289 extern Name get_name;
290 290 extern Name get_posix_name;
291 291 extern Cmd_line get_rule;
292 292 extern Cmd_line get_posix_rule;
293 293 extern Boolean send_mtool_msgs;
294 294 extern Boolean all_precious;
295 295 extern Boolean report_cwd;
296 296 extern Boolean silent_all;
297 297 extern Boolean silent;
298 298 extern Name silent_name;
299 299 extern char *stderr_file;
300 300 extern char *stdout_file;
301 301 #ifdef SGE_SUPPORT
302 302 extern char script_file[];
303 303 #endif
304 304 extern Boolean stdout_stderr_same;
305 305 extern Dependency suffixes;
306 306 extern Name suffixes_name;
307 307 extern Name sunpro_dependencies;
308 308 extern Boolean target_variants;
309 309 extern const char *tmpdir;
310 310 extern const char *temp_file_directory;
311 311 extern Name temp_file_name;
312 312 extern short temp_file_number;
313 313 extern wchar_t *top_level_target;
314 314 extern Boolean touch;
315 315 extern Boolean trace_reader;
316 316 extern Boolean build_unconditional;
317 317 extern pathpt vroot_path;
↓ open down ↓ |
317 lines elided |
↑ open up ↑ |
318 318 extern Name wait_name;
319 319 extern wchar_t wcs_buffer2[];
320 320 extern wchar_t *wcs_ptr;
321 321 extern wchar_t *wcs_ptr2;
322 322 extern nl_catd catd;
323 323 extern long int hostid;
324 324
325 325 /*
326 326 * Declarations of system defined variables
327 327 */
328 -#if !defined(linux)
329 328 /* On linux this variable is defined in 'signal.h' */
330 329 extern char *sys_siglist[];
331 -#endif
332 330
333 331 /*
334 332 * Declarations of system supplied functions
335 333 */
336 334 extern int file_lock(char *, char *, int *, int);
337 335
338 336 /*
339 337 * Declarations of functions declared and used by make
340 338 */
341 339 extern void add_pending(Name target, int recursion_level, Boolean do_get, Boolean implicit, Boolean redo);
342 340 extern void add_running(Name target, Name true_target, Property command, int recursion_level, int auto_count, Name *automatics, Boolean do_get, Boolean implicit);
343 341 extern void add_serial(Name target, int recursion_level, Boolean do_get, Boolean implicit);
344 342 extern void add_subtree(Name target, int recursion_level, Boolean do_get, Boolean implicit);
345 343 extern void append_or_replace_macro_in_dyn_array(ASCII_Dyn_Array *Ar, char *macro);
346 344 #ifdef DISTRIBUTED
347 345 extern Doname await_dist(Boolean waitflg);
348 346 #endif
349 347 #ifdef TEAMWARE_MAKE_CMN
350 348 extern void await_parallel(Boolean waitflg);
351 349 #endif
352 350 extern void build_suffix_list(Name target_suffix);
353 351 extern Boolean check_auto_dependencies(Name target, int auto_count, Name *automatics);
354 352 extern void check_state(Name temp_file_name);
355 353 extern void cond_macros_into_string(Name np, String_rec *buffer);
356 354 extern void construct_target_string();
357 355 extern void create_xdrs_ptr(void);
358 356 extern void depvar_add_to_list (Name name, Boolean cmdline);
359 357 #ifdef DISTRIBUTED
360 358 extern void distribute_rxm(Avo_DoJobMsg *dmake_job_msg);
361 359 extern int getRxmMessage(void);
362 360 extern Avo_JobResultMsg* getJobResultMsg(void);
363 361 extern Avo_AcknowledgeMsg* getAcknowledgeMsg(void);
364 362 #endif
365 363 extern Doname doname(register Name target, register Boolean do_get, register Boolean implicit, register Boolean automatic = false);
366 364 extern Doname doname_check(register Name target, register Boolean do_get, register Boolean implicit, register Boolean automatic);
367 365 extern Doname doname_parallel(Name target, Boolean do_get, Boolean implicit);
368 366 extern Doname dosys(register Name command, register Boolean ignore_error, register Boolean call_make, Boolean silent_error, Boolean always_exec, Name target, Boolean redirect_out_err);
369 367 extern void dump_make_state(void);
370 368 extern void dump_target_list(void);
371 369 extern void enter_conditional(register Name target, Name name, Name value, register Boolean append);
372 370 extern void enter_dependencies(register Name target, Chain target_group, register Name_vector depes, register Cmd_line command, register Separator separator);
373 371 extern void enter_dependency(Property line, register Name depe, Boolean automatic);
374 372 extern void enter_equal(Name name, Name value, register Boolean append);
375 373 extern Percent enter_percent(register Name target, Chain target_group, register Name_vector depes, Cmd_line command);
376 374 extern Dyntarget enter_dyntarget(register Name target);
377 375 extern Name_vector enter_name(String string, Boolean tail_present, register wchar_t *string_start, register wchar_t *string_end, Name_vector current_names, Name_vector *extra_names, Boolean *target_group_seen);
378 376 extern Boolean exec_vp(register char *name, register char **argv, char **envp, register Boolean ignore_error);
379 377 extern Doname execute_parallel(Property line, Boolean waitflg, Boolean local = false);
380 378 extern Doname execute_serial(Property line);
381 379 extern timestruc_t& exists(register Name target);
382 380 extern void fatal(char *, ...);
383 381 extern void fatal_reader(char *, ...);
384 382 extern Doname find_ar_suffix_rule(register Name target, Name true_target, Property *command, Boolean rechecking);
385 383 extern Doname find_double_suffix_rule(register Name target, Property *command, Boolean rechecking);
386 384 extern Doname find_percent_rule(register Name target, Property *command, Boolean rechecking);
387 385 extern int find_run_directory (char *cmd, char *cwd, char *dir, char **pgm, char **run, char *path);
388 386 extern Doname find_suffix_rule(Name target, Name target_body, Name target_suffix, Property *command, Boolean rechecking);
389 387 extern Chain find_target_groups(register Name_vector target_list, register int i, Boolean reset);
390 388 extern void finish_children(Boolean docheck);
391 389 extern void finish_running(void);
392 390 extern void free_chain(Name_vector ptr);
393 391 extern void gather_recursive_deps(void);
394 392 extern char *get_current_path(void);
395 393 extern int get_job_msg_id(void);
396 394 extern FILE *get_mtool_msgs_fp(void);
397 395 #ifdef DISTRIBUTED
398 396 extern Boolean get_dmake_group_specified(void);
↓ open down ↓ |
57 lines elided |
↑ open up ↑ |
399 397 extern Boolean get_dmake_max_jobs_specified(void);
400 398 extern Boolean get_dmake_mode_specified(void);
401 399 extern Boolean get_dmake_odir_specified(void);
402 400 extern Boolean get_dmake_rcfile_specified(void);
403 401 extern Boolean get_pmake_machinesfile_specified(void);
404 402 #endif
405 403 #if defined(DISTRIBUTED) || defined(MAKETOOL) /* tolik */
406 404 extern XDR *get_xdrs_ptr(void);
407 405 #endif
408 406 extern wchar_t *getmem_wc(register int size);
409 -#if !defined(linux)
410 407 /* On linux getwd(char *) is defined in 'unistd.h' */
411 408 #ifdef __cplusplus
412 409 extern "C" {
413 410 #endif
414 411 extern char *getwd(char *);
415 412 #ifdef __cplusplus
416 413 }
417 414 #endif
418 -#endif
419 415 extern void handle_interrupt(int);
420 416 extern Boolean is_running(Name target);
421 417 extern void load_cached_names(void);
422 418 extern Boolean parallel_ok(Name target, Boolean line_prop_must_exists);
423 419 extern void print_dependencies(register Name target, register Property line);
424 420 extern void send_job_start_msg(Property line);
425 421 extern void send_rsrc_info_msg(int max_jobs, char *hostname, char *username);
426 422 extern void print_value(register Name value, Daemon daemon);
427 423 extern timestruc_t& read_archive(register Name target);
428 424 extern int read_dir(Name dir, wchar_t *pattern, Property line, wchar_t *library);
429 425 extern void read_directory_of_file(register Name file);
430 426 extern int read_make_machines(Name make_machines_name);
431 427 extern Boolean read_simple_file(register Name makefile_name, register Boolean chase_path, register Boolean doname_it, Boolean complain, Boolean must_exist, Boolean report_file, Boolean lock_makefile);
432 428 extern void remove_recursive_dep(Name target);
433 429 extern void report_recursive_dep(Name target, char *line);
434 430 extern void report_recursive_done(void);
435 431 extern void report_recursive_init(void);
436 432 extern Recursive_make find_recursive_target(Name target);
437 433 extern void reset_locals(register Name target, register Property old_locals, register Property conditional, register int index);
438 434 extern void set_locals(register Name target, register Property old_locals);
439 435 extern void setvar_append(register Name name, register Name value);
440 436 #ifdef DISTRIBUTED
441 437 extern void setvar_envvar(Avo_DoJobMsg *dmake_job_msg);
442 438 #else
443 439 extern void setvar_envvar(void);
444 440 #endif
445 441 extern void special_reader(Name target, register Name_vector depes, Cmd_line command);
446 442 extern void startup_rxm();
447 443 extern Doname target_can_be_built(register Name target);
448 444 extern char *time_to_string(const timestruc_t &time);
449 445 extern void update_target(Property line, Doname result);
450 446 extern void warning(char *, ...);
451 447 extern void write_state_file(int report_recursive, Boolean exiting);
452 448 extern Name vpath_translation(register Name cmd);
453 449
454 450 #define DEPINFO_FMT_VERSION "VERS2$"
455 451 #define VER_LEN strlen(DEPINFO_FMT_VERSION)
456 452
457 453 #ifdef NSE
458 454
459 455 /*
460 456 * NSE version for depinfo format
461 457 */
462 458 extern Boolean nse;
463 459 extern Name nse_backquote_seen;
464 460 extern Boolean nse_did_recursion;
465 461 extern Name nse_shell_var_used;
466 462 extern Boolean nse_watch_vars;
467 463 extern wchar_t current_makefile[MAXPATHLEN];
468 464 extern Boolean nse_depinfo_locked;
469 465 extern char nse_depinfo_lockfile[MAXPATHLEN];
470 466 extern Name derived_src;
471 467
472 468 extern void depvar_dep_macro_used(Name);
473 469 extern void depvar_rule_macro_used(Name);
474 470 extern Boolean nse_backquotes(wchar_t *);
475 471 extern void nse_check_cd(Property);
476 472 extern void nse_check_derived_src(Name, wchar_t *, Cmd_line);
477 473 extern void nse_check_file_backquotes(wchar_t *);
478 474 extern void nse_check_no_deps_no_rule(Name, Property, Property);
479 475 extern void nse_check_sccs(wchar_t *, wchar_t *);
480 476 extern void nse_dep_cmdmacro(wchar_t *);
481 477 extern int nse_exit_status(void);
482 478 extern void nse_init_source_suffixes(void);
483 479 extern void nse_no_makefile(Name);
484 480 extern void nse_rule_cmdmacro(wchar_t *);
485 481 extern void nse_wildcard(wchar_t *, wchar_t *);
486 482 #endif
487 483
488 484 #endif
↓ open down ↓ |
60 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX