Print this page
make: unifdef for two bugfixes conditioned for unknown reasons (defined)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/make/bin/misc.cc
+++ new/usr/src/cmd/make/bin/misc.cc
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /*
27 27 * misc.cc
28 28 *
29 29 * This file contains various unclassified routines. Some main groups:
30 30 * getname
31 31 * Memory allocation
32 32 * String handling
33 33 * Property handling
34 34 * Error message handling
35 35 * Make internal state dumping
36 36 * main routine support
37 37 */
38 38
39 39 /*
↓ open down ↓ |
39 lines elided |
↑ open up ↑ |
40 40 * Included files
41 41 */
42 42 #include <errno.h>
43 43 #include <mk/defs.h>
44 44 #include <mksh/macro.h> /* SETVAR() */
45 45 #include <mksh/misc.h> /* enable_interrupt() */
46 46 #include <stdarg.h> /* va_list, va_start(), va_end() */
47 47 #include <vroot/report.h> /* SUNPRO_DEPENDENCIES */
48 48 #include <libintl.h>
49 49
50 -
51 -#define MAXJOBS_ADJUST_RFE4694000
52 -
53 -#ifdef MAXJOBS_ADJUST_RFE4694000
54 50 extern void job_adjust_fini();
55 -#endif /* MAXJOBS_ADJUST_RFE4694000 */
56 -
57 51
58 52 /*
59 53 * Defined macros
60 54 */
61 55
62 56 /*
63 57 * typedefs & structs
64 58 */
65 59
66 60 /*
67 61 * Static variables
68 62 */
69 63
70 64 /*
71 65 * File table of contents
72 66 */
73 67 static void print_rule(register Name target);
74 68 static void print_target_n_deps(register Name target);
75 69
76 70 /*****************************************
77 71 *
78 72 * getname
79 73 */
80 74
81 75 /*****************************************
82 76 *
83 77 * Memory allocation
84 78 */
85 79
86 80 /*
87 81 * free_chain()
88 82 *
89 83 * frees a chain of Name_vector's
90 84 *
91 85 * Parameters:
92 86 * ptr Pointer to the first element in the chain
93 87 * to be freed.
94 88 *
95 89 * Global variables used:
96 90 */
97 91 void
98 92 free_chain(Name_vector ptr)
99 93 {
100 94 if (ptr != NULL) {
101 95 if (ptr->next != NULL) {
102 96 free_chain(ptr->next);
103 97 }
104 98 free((char *) ptr);
105 99 }
106 100 }
107 101
108 102 /*****************************************
109 103 *
110 104 * String manipulation
111 105 */
112 106
113 107 /*****************************************
114 108 *
115 109 * Nameblock property handling
116 110 */
117 111
118 112 /*****************************************
119 113 *
120 114 * Error message handling
121 115 */
122 116
123 117 /*
124 118 * fatal(format, args...)
125 119 *
126 120 * Print a message and die
127 121 *
128 122 * Parameters:
129 123 * format printf type format string
130 124 * args Arguments to match the format
131 125 *
132 126 * Global variables used:
133 127 * fatal_in_progress Indicates if this is a recursive call
134 128 * parallel_process_cnt Do we need to wait for anything?
135 129 * report_pwd Should we report the current path?
136 130 */
137 131 /*VARARGS*/
138 132 void
139 133 fatal(const char *message, ...)
140 134 {
141 135 va_list args;
142 136
143 137 va_start(args, message);
144 138 (void) fflush(stdout);
145 139 (void) fprintf(stderr, gettext("make: Fatal error: "));
146 140 (void) vfprintf(stderr, message, args);
147 141 (void) fprintf(stderr, "\n");
148 142 va_end(args);
149 143 if (report_pwd) {
150 144 (void) fprintf(stderr,
151 145 gettext("Current working directory %s\n"),
152 146 get_current_path());
153 147 }
154 148 (void) fflush(stderr);
155 149 if (fatal_in_progress) {
156 150 exit_status = 1;
157 151 exit(1);
158 152 }
159 153 fatal_in_progress = true;
160 154 /* Let all parallel children finish */
161 155 if ((dmake_mode_type == parallel_mode) &&
162 156 (parallel_process_cnt > 0)) {
163 157 (void) fprintf(stderr,
164 158 gettext("Waiting for %d %s to finish\n"),
165 159 parallel_process_cnt,
↓ open down ↓ |
99 lines elided |
↑ open up ↑ |
166 160 parallel_process_cnt == 1 ?
167 161 gettext("job") : gettext("jobs"));
168 162 (void) fflush(stderr);
169 163 }
170 164
171 165 while (parallel_process_cnt > 0) {
172 166 await_parallel(true);
173 167 finish_children(false);
174 168 }
175 169
176 -#if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
177 170 job_adjust_fini();
178 -#endif
179 171
180 172 exit_status = 1;
181 173 exit(1);
182 174 }
183 175
184 176 /*
185 177 * warning(format, args...)
186 178 *
187 179 * Print a message and continue.
188 180 *
189 181 * Parameters:
190 182 * format printf type format string
191 183 * args Arguments to match the format
192 184 *
193 185 * Global variables used:
194 186 * report_pwd Should we report the current path?
195 187 */
196 188 /*VARARGS*/
197 189 void
198 190 warning(char * message, ...)
199 191 {
200 192 va_list args;
201 193
202 194 va_start(args, message);
203 195 (void) fflush(stdout);
204 196 (void) fprintf(stderr, gettext("make: Warning: "));
205 197 (void) vfprintf(stderr, message, args);
206 198 (void) fprintf(stderr, "\n");
207 199 va_end(args);
208 200 if (report_pwd) {
209 201 (void) fprintf(stderr,
210 202 gettext("Current working directory %s\n"),
211 203 get_current_path());
212 204 }
213 205 (void) fflush(stderr);
214 206 }
215 207
216 208 /*
217 209 * time_to_string(time)
218 210 *
219 211 * Take a numeric time value and produce
220 212 * a proper string representation.
221 213 *
222 214 * Return value:
223 215 * The string representation of the time
224 216 *
225 217 * Parameters:
226 218 * time The time we need to translate
227 219 *
228 220 * Global variables used:
229 221 */
230 222 char *
231 223 time_to_string(const timestruc_t &time)
232 224 {
233 225 struct tm *tm;
234 226 char buf[128];
235 227
236 228 if (time == file_doesnt_exist) {
237 229 return gettext("File does not exist");
238 230 }
239 231 if (time == file_max_time) {
240 232 return gettext("Younger than any file");
241 233 }
242 234 tm = localtime(&time.tv_sec);
243 235 strftime(buf, sizeof (buf), "%c %Z", tm);
244 236 buf[127] = (int) nul_char;
245 237 return strdup(buf);
246 238 }
247 239
248 240 /*
249 241 * get_current_path()
250 242 *
251 243 * Stuff current_path with the current path if it isnt there already.
252 244 *
253 245 * Parameters:
254 246 *
255 247 * Global variables used:
256 248 */
257 249 char *
258 250 get_current_path(void)
259 251 {
260 252 char pwd[(MAXPATHLEN * MB_LEN_MAX)];
261 253 static char *current_path;
262 254
263 255 if (current_path == NULL) {
264 256 getcwd(pwd, sizeof(pwd));
265 257 if (pwd[0] == (int) nul_char) {
266 258 pwd[0] = (int) slash_char;
267 259 pwd[1] = (int) nul_char;
268 260 }
269 261 current_path = strdup(pwd);
270 262 }
271 263 return current_path;
272 264 }
273 265
274 266 /*****************************************
275 267 *
276 268 * Make internal state dumping
277 269 *
278 270 * This is a set of routines for dumping the internal make state
279 271 * Used for the -p option
280 272 */
281 273
282 274 /*
283 275 * dump_make_state()
284 276 *
285 277 * Dump make's internal state to stdout
286 278 *
287 279 * Parameters:
288 280 *
289 281 * Global variables used:
290 282 * svr4 Was ".SVR4" seen in makefile?
291 283 * svr4_name The Name ".SVR4", printed
292 284 * posix Was ".POSIX" seen in makefile?
293 285 * posix_name The Name ".POSIX", printed
294 286 * default_rule Points to the .DEFAULT rule
295 287 * default_rule_name The Name ".DEFAULT", printed
296 288 * default_target_to_build The first target to print
297 289 * dot_keep_state The Name ".KEEP_STATE", printed
298 290 * dot_keep_state_file The Name ".KEEP_STATE_FILE", printed
299 291 * hashtab The make hash table for Name blocks
300 292 * ignore_errors Was ".IGNORE" seen in makefile?
301 293 * ignore_name The Name ".IGNORE", printed
302 294 * keep_state Was ".KEEP_STATE" seen in makefile?
303 295 * percent_list The list of % rules
304 296 * precious The Name ".PRECIOUS", printed
305 297 * sccs_get_name The Name ".SCCS_GET", printed
306 298 * sccs_get_posix_name The Name ".SCCS_GET_POSIX", printed
307 299 * get_name The Name ".GET", printed
308 300 * get_posix_name The Name ".GET_POSIX", printed
309 301 * sccs_get_rule Points to the ".SCCS_GET" rule
310 302 * silent Was ".SILENT" seen in makefile?
311 303 * silent_name The Name ".SILENT", printed
312 304 * suffixes The suffix list from ".SUFFIXES"
313 305 * suffixes_name The Name ".SUFFIX", printed
314 306 */
315 307 void
316 308 dump_make_state(void)
317 309 {
318 310 Name_set::iterator p, e;
319 311 register Property prop;
320 312 register Dependency dep;
321 313 register Cmd_line rule;
322 314 Percent percent, percent_depe;
323 315
324 316 /* Default target */
325 317 if (default_target_to_build != NULL) {
326 318 print_rule(default_target_to_build);
327 319 }
328 320 (void) printf("\n");
329 321
330 322 /* .POSIX */
331 323 if (posix) {
332 324 (void) printf("%s:\n", posix_name->string_mb);
333 325 }
334 326
335 327 /* .DEFAULT */
336 328 if (default_rule != NULL) {
337 329 (void) printf("%s:\n", default_rule_name->string_mb);
338 330 for (rule = default_rule; rule != NULL; rule = rule->next) {
339 331 (void) printf("\t%s\n", rule->command_line->string_mb);
340 332 }
341 333 }
342 334
343 335 /* .IGNORE */
344 336 if (ignore_errors) {
345 337 (void) printf("%s:\n", ignore_name->string_mb);
346 338 }
347 339
348 340 /* .KEEP_STATE: */
349 341 if (keep_state) {
350 342 (void) printf("%s:\n\n", dot_keep_state->string_mb);
351 343 }
352 344
353 345 /* .PRECIOUS */
354 346 (void) printf("%s:", precious->string_mb);
355 347 for (p = hashtab.begin(), e = hashtab.end(); p != e; p++) {
356 348 if ((p->stat.is_precious) || (all_precious)) {
357 349 (void) printf(" %s", p->string_mb);
358 350 }
359 351 }
360 352 (void) printf("\n");
361 353
362 354 /* .SCCS_GET */
363 355 if (sccs_get_rule != NULL) {
364 356 (void) printf("%s:\n", sccs_get_name->string_mb);
365 357 for (rule = sccs_get_rule; rule != NULL; rule = rule->next) {
366 358 (void) printf("\t%s\n", rule->command_line->string_mb);
367 359 }
368 360 }
369 361
370 362 /* .SILENT */
371 363 if (silent) {
372 364 (void) printf("%s:\n", silent_name->string_mb);
373 365 }
374 366
375 367 /* .SUFFIXES: */
376 368 (void) printf("%s:", suffixes_name->string_mb);
377 369 for (dep = suffixes; dep != NULL; dep = dep->next) {
378 370 (void) printf(" %s", dep->name->string_mb);
379 371 build_suffix_list(dep->name);
380 372 }
381 373 (void) printf("\n\n");
382 374
383 375 /* % rules */
384 376 for (percent = percent_list;
385 377 percent != NULL;
386 378 percent = percent->next) {
387 379 (void) printf("%s:",
388 380 percent->name->string_mb);
389 381
390 382 for (percent_depe = percent->dependencies;
391 383 percent_depe != NULL;
392 384 percent_depe = percent_depe->next) {
393 385 (void) printf(" %s", percent_depe->name->string_mb);
394 386 }
395 387
396 388 (void) printf("\n");
397 389
398 390 for (rule = percent->command_template;
399 391 rule != NULL;
400 392 rule = rule->next) {
401 393 (void) printf("\t%s\n", rule->command_line->string_mb);
402 394 }
403 395 }
404 396
405 397 /* Suffix rules */
406 398 for (p = hashtab.begin(), e = hashtab.end(); p != e; p++) {
407 399 Wstring wcb(p);
408 400 if (wcb.get_string()[0] == (int) period_char) {
409 401 print_rule(p);
410 402 }
411 403 }
412 404
413 405 /* Macro assignments */
414 406 for (p = hashtab.begin(), e = hashtab.end(); p != e; p++) {
415 407 if (((prop = get_prop(p->prop, macro_prop)) != NULL) &&
416 408 (prop->body.macro.value != NULL)) {
417 409 (void) printf("%s", p->string_mb);
418 410 print_value(prop->body.macro.value,
419 411 (Daemon) prop->body.macro.daemon);
420 412 }
421 413 }
422 414 (void) printf("\n");
423 415
424 416 /* Conditional macro assignments */
425 417 for (p = hashtab.begin(), e = hashtab.end(); p != e; p++) {
426 418 for (prop = get_prop(p->prop, conditional_prop);
427 419 prop != NULL;
428 420 prop = get_prop(prop->next, conditional_prop)) {
429 421 (void) printf("%s := %s",
430 422 p->string_mb,
431 423 prop->body.conditional.name->
432 424 string_mb);
433 425 if (prop->body.conditional.append) {
434 426 printf(" +");
435 427 }
436 428 else {
437 429 printf(" ");
438 430 }
439 431 print_value(prop->body.conditional.value,
440 432 no_daemon);
441 433 }
442 434 }
443 435 (void) printf("\n");
444 436
445 437 /* All other dependencies */
446 438 for (p = hashtab.begin(), e = hashtab.end(); p != e; p++) {
447 439 if (p->colons != no_colon) {
448 440 print_rule(p);
449 441 }
450 442 }
451 443 (void) printf("\n");
452 444 }
453 445
454 446 /*
455 447 * print_rule(target)
456 448 *
457 449 * Print the rule for one target
458 450 *
459 451 * Parameters:
460 452 * target Target we print rule for
461 453 *
462 454 * Global variables used:
463 455 */
464 456 static void
465 457 print_rule(register Name target)
466 458 {
467 459 register Cmd_line rule;
468 460 register Property line;
469 461 register Dependency dependency;
470 462
471 463 if (target->dependency_printed ||
472 464 ((line = get_prop(target->prop, line_prop)) == NULL) ||
473 465 ((line->body.line.command_template == NULL) &&
474 466 (line->body.line.dependencies == NULL))) {
475 467 return;
476 468 }
477 469 target->dependency_printed = true;
478 470
479 471 (void) printf("%s:", target->string_mb);
480 472
481 473 for (dependency = line->body.line.dependencies;
482 474 dependency != NULL;
483 475 dependency = dependency->next) {
484 476 (void) printf(" %s", dependency->name->string_mb);
485 477 }
486 478
487 479 (void) printf("\n");
488 480
489 481 for (rule = line->body.line.command_template;
490 482 rule != NULL;
491 483 rule = rule->next) {
492 484 (void) printf("\t%s\n", rule->command_line->string_mb);
493 485 }
494 486 }
495 487
496 488 void
497 489 dump_target_list(void)
498 490 {
499 491 Name_set::iterator p, e;
500 492 Wstring str;
501 493
502 494 for (p = hashtab.begin(), e = hashtab.end(); p != e; p++) {
503 495 str.init(p);
504 496 wchar_t * wcb = str.get_string();
505 497 if ((p->colons != no_colon) &&
506 498 ((wcb[0] != (int) period_char) ||
507 499 ((wcb[0] == (int) period_char) &&
508 500 (wschr(wcb, (int) slash_char))))) {
509 501 print_target_n_deps(p);
510 502 }
511 503 }
512 504 }
513 505
514 506 static void
515 507 print_target_n_deps(register Name target)
516 508 {
517 509 register Cmd_line rule;
518 510 register Property line;
519 511 register Dependency dependency;
520 512
521 513 if (target->dependency_printed) {
522 514 return;
523 515 }
524 516 target->dependency_printed = true;
525 517
526 518 (void) printf("%s\n", target->string_mb);
527 519
528 520 if ((line = get_prop(target->prop, line_prop)) == NULL) {
529 521 return;
530 522 }
531 523 for (dependency = line->body.line.dependencies;
532 524 dependency != NULL;
533 525 dependency = dependency->next) {
534 526 if (!dependency->automatic) {
535 527 print_target_n_deps(dependency->name);
536 528 }
537 529 }
538 530 }
539 531
540 532 /*****************************************
541 533 *
542 534 * main() support
543 535 */
544 536
545 537 /*
546 538 * load_cached_names()
547 539 *
548 540 * Load the vector of cached names
549 541 *
550 542 * Parameters:
551 543 *
552 544 * Global variables used:
553 545 * Many many pointers to Name blocks.
554 546 */
555 547 void
556 548 load_cached_names(void)
557 549 {
558 550 char *cp;
559 551 Name dollar;
560 552
561 553 /* Load the cached_names struct */
562 554 MBSTOWCS(wcs_buffer, ".BUILT_LAST_MAKE_RUN");
563 555 built_last_make_run = GETNAME(wcs_buffer, FIND_LENGTH);
564 556 MBSTOWCS(wcs_buffer, "@");
565 557 c_at = GETNAME(wcs_buffer, FIND_LENGTH);
566 558 MBSTOWCS(wcs_buffer, " *conditionals* ");
567 559 conditionals = GETNAME(wcs_buffer, FIND_LENGTH);
568 560 /*
569 561 * A version of make was released with NSE 1.0 that used
570 562 * VERSION-1.1 but this version is identical to VERSION-1.0.
571 563 * The version mismatch code makes a special case for this
572 564 * situation. If the version number is changed from 1.0
573 565 * it should go to 1.2.
574 566 */
575 567 MBSTOWCS(wcs_buffer, "VERSION-1.0");
576 568 current_make_version = GETNAME(wcs_buffer, FIND_LENGTH);
577 569 MBSTOWCS(wcs_buffer, ".SVR4");
578 570 svr4_name = GETNAME(wcs_buffer, FIND_LENGTH);
579 571 MBSTOWCS(wcs_buffer, ".POSIX");
580 572 posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
581 573 MBSTOWCS(wcs_buffer, ".DEFAULT");
582 574 default_rule_name = GETNAME(wcs_buffer, FIND_LENGTH);
583 575 MBSTOWCS(wcs_buffer, "$");
584 576 dollar = GETNAME(wcs_buffer, FIND_LENGTH);
585 577 MBSTOWCS(wcs_buffer, ".DONE");
586 578 done = GETNAME(wcs_buffer, FIND_LENGTH);
587 579 MBSTOWCS(wcs_buffer, ".");
588 580 dot = GETNAME(wcs_buffer, FIND_LENGTH);
589 581 MBSTOWCS(wcs_buffer, ".KEEP_STATE");
590 582 dot_keep_state = GETNAME(wcs_buffer, FIND_LENGTH);
591 583 MBSTOWCS(wcs_buffer, ".KEEP_STATE_FILE");
592 584 dot_keep_state_file = GETNAME(wcs_buffer, FIND_LENGTH);
593 585 MBSTOWCS(wcs_buffer, "");
594 586 empty_name = GETNAME(wcs_buffer, FIND_LENGTH);
595 587 MBSTOWCS(wcs_buffer, " FORCE");
596 588 force = GETNAME(wcs_buffer, FIND_LENGTH);
597 589 MBSTOWCS(wcs_buffer, "HOST_ARCH");
598 590 host_arch = GETNAME(wcs_buffer, FIND_LENGTH);
599 591 MBSTOWCS(wcs_buffer, "HOST_MACH");
600 592 host_mach = GETNAME(wcs_buffer, FIND_LENGTH);
601 593 MBSTOWCS(wcs_buffer, ".IGNORE");
602 594 ignore_name = GETNAME(wcs_buffer, FIND_LENGTH);
603 595 MBSTOWCS(wcs_buffer, ".INIT");
604 596 init = GETNAME(wcs_buffer, FIND_LENGTH);
605 597 MBSTOWCS(wcs_buffer, ".LOCAL");
606 598 localhost_name = GETNAME(wcs_buffer, FIND_LENGTH);
607 599 MBSTOWCS(wcs_buffer, ".make.state");
608 600 make_state = GETNAME(wcs_buffer, FIND_LENGTH);
609 601 MBSTOWCS(wcs_buffer, "MAKEFLAGS");
610 602 makeflags = GETNAME(wcs_buffer, FIND_LENGTH);
611 603 MBSTOWCS(wcs_buffer, ".MAKE_VERSION");
612 604 make_version = GETNAME(wcs_buffer, FIND_LENGTH);
613 605 MBSTOWCS(wcs_buffer, ".NO_PARALLEL");
614 606 no_parallel_name = GETNAME(wcs_buffer, FIND_LENGTH);
615 607 MBSTOWCS(wcs_buffer, ".NOT_AUTO");
616 608 not_auto = GETNAME(wcs_buffer, FIND_LENGTH);
617 609 MBSTOWCS(wcs_buffer, ".PARALLEL");
618 610 parallel_name = GETNAME(wcs_buffer, FIND_LENGTH);
619 611 MBSTOWCS(wcs_buffer, "PATH");
620 612 path_name = GETNAME(wcs_buffer, FIND_LENGTH);
621 613 MBSTOWCS(wcs_buffer, "+");
622 614 plus = GETNAME(wcs_buffer, FIND_LENGTH);
623 615 MBSTOWCS(wcs_buffer, ".PRECIOUS");
624 616 precious = GETNAME(wcs_buffer, FIND_LENGTH);
625 617 MBSTOWCS(wcs_buffer, "?");
626 618 query = GETNAME(wcs_buffer, FIND_LENGTH);
627 619 MBSTOWCS(wcs_buffer, "^");
628 620 hat = GETNAME(wcs_buffer, FIND_LENGTH);
629 621 MBSTOWCS(wcs_buffer, ".RECURSIVE");
630 622 recursive_name = GETNAME(wcs_buffer, FIND_LENGTH);
631 623 MBSTOWCS(wcs_buffer, ".SCCS_GET");
632 624 sccs_get_name = GETNAME(wcs_buffer, FIND_LENGTH);
633 625 MBSTOWCS(wcs_buffer, ".SCCS_GET_POSIX");
634 626 sccs_get_posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
635 627 MBSTOWCS(wcs_buffer, ".GET");
636 628 get_name = GETNAME(wcs_buffer, FIND_LENGTH);
637 629 MBSTOWCS(wcs_buffer, ".GET_POSIX");
638 630 get_posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
639 631 MBSTOWCS(wcs_buffer, "SHELL");
640 632 shell_name = GETNAME(wcs_buffer, FIND_LENGTH);
641 633 MBSTOWCS(wcs_buffer, ".SILENT");
642 634 silent_name = GETNAME(wcs_buffer, FIND_LENGTH);
643 635 MBSTOWCS(wcs_buffer, ".SUFFIXES");
644 636 suffixes_name = GETNAME(wcs_buffer, FIND_LENGTH);
645 637 MBSTOWCS(wcs_buffer, SUNPRO_DEPENDENCIES);
646 638 sunpro_dependencies = GETNAME(wcs_buffer, FIND_LENGTH);
647 639 MBSTOWCS(wcs_buffer, "TARGET_ARCH");
648 640 target_arch = GETNAME(wcs_buffer, FIND_LENGTH);
649 641 MBSTOWCS(wcs_buffer, "TARGET_MACH");
650 642 target_mach = GETNAME(wcs_buffer, FIND_LENGTH);
651 643 MBSTOWCS(wcs_buffer, "VIRTUAL_ROOT");
652 644 virtual_root = GETNAME(wcs_buffer, FIND_LENGTH);
653 645 MBSTOWCS(wcs_buffer, "VPATH");
654 646 vpath_name = GETNAME(wcs_buffer, FIND_LENGTH);
655 647 MBSTOWCS(wcs_buffer, ".WAIT");
656 648 wait_name = GETNAME(wcs_buffer, FIND_LENGTH);
657 649
658 650 wait_name->state = build_ok;
659 651
660 652 /* Mark special targets so that the reader treats them properly */
661 653 svr4_name->special_reader = svr4_special;
662 654 posix_name->special_reader = posix_special;
663 655 built_last_make_run->special_reader = built_last_make_run_special;
664 656 default_rule_name->special_reader = default_special;
665 657 dot_keep_state->special_reader = keep_state_special;
666 658 dot_keep_state_file->special_reader = keep_state_file_special;
667 659 ignore_name->special_reader = ignore_special;
668 660 make_version->special_reader = make_version_special;
669 661 no_parallel_name->special_reader = no_parallel_special;
670 662 parallel_name->special_reader = parallel_special;
671 663 localhost_name->special_reader = localhost_special;
672 664 precious->special_reader = precious_special;
673 665 sccs_get_name->special_reader = sccs_get_special;
674 666 sccs_get_posix_name->special_reader = sccs_get_posix_special;
675 667 get_name->special_reader = get_special;
676 668 get_posix_name->special_reader = get_posix_special;
677 669 silent_name->special_reader = silent_special;
678 670 suffixes_name->special_reader = suffixes_special;
679 671
680 672 /* The value of $$ is $ */
681 673 (void) SETVAR(dollar, dollar, false);
682 674 dollar->dollar = false;
683 675
684 676 /* Set the value of $(SHELL) */
685 677 if (posix) {
686 678 MBSTOWCS(wcs_buffer, "/usr/xpg4/bin/sh");
687 679 } else {
688 680 MBSTOWCS(wcs_buffer, "/bin/sh");
689 681 }
690 682 (void) SETVAR(shell_name, GETNAME(wcs_buffer, FIND_LENGTH), false);
691 683
692 684 /*
693 685 * Use " FORCE" to simulate a FRC dependency for :: type
694 686 * targets with no dependencies.
695 687 */
696 688 (void) append_prop(force, line_prop);
697 689 force->stat.time = file_max_time;
698 690
699 691 /* Make sure VPATH is defined before current dir is read */
700 692 if ((cp = getenv(vpath_name->string_mb)) != NULL) {
701 693 MBSTOWCS(wcs_buffer, cp);
702 694 (void) SETVAR(vpath_name,
703 695 GETNAME(wcs_buffer, FIND_LENGTH),
704 696 false);
705 697 }
706 698
707 699 /* Check if there is NO PATH variable. If not we construct one. */
708 700 if (getenv(path_name->string_mb) == NULL) {
709 701 vroot_path = NULL;
710 702 add_dir_to_path(".", &vroot_path, -1);
711 703 add_dir_to_path("/bin", &vroot_path, -1);
712 704 add_dir_to_path("/usr/bin", &vroot_path, -1);
713 705 }
714 706 }
715 707
716 708 /*
717 709 * iterate on list of conditional macros in np, and place them in
718 710 * a String_rec starting with, and separated by the '$' character.
719 711 */
720 712 void
721 713 cond_macros_into_string(Name np, String_rec *buffer)
722 714 {
723 715 Macro_list macro_list;
724 716
725 717 /*
726 718 * Put the version number at the start of the string
727 719 */
728 720 MBSTOWCS(wcs_buffer, DEPINFO_FMT_VERSION);
729 721 append_string(wcs_buffer, buffer, FIND_LENGTH);
730 722 /*
731 723 * Add the rest of the conditional macros to the buffer
732 724 */
733 725 if (np->depends_on_conditional){
734 726 for (macro_list = np->conditional_macro_list;
735 727 macro_list != NULL; macro_list = macro_list->next){
736 728 append_string(macro_list->macro_name, buffer,
737 729 FIND_LENGTH);
738 730 append_char((int) equal_char, buffer);
739 731 append_string(macro_list->value, buffer, FIND_LENGTH);
740 732 append_char((int) dollar_char, buffer);
741 733 }
742 734 }
743 735 }
744 736
↓ open down ↓ |
556 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX