28 *
29 * This file contains various unclassified routines. Some main groups:
30 * getname
31 * Memory allocation
32 * String handling
33 * Property handling
34 * Error message handling
35 * Make internal state dumping
36 * main routine support
37 */
38
39 /*
40 * Included files
41 */
42 #include <errno.h>
43 #include <mk/defs.h>
44 #include <mksh/macro.h> /* SETVAR() */
45 #include <mksh/misc.h> /* enable_interrupt() */
46 #include <stdarg.h> /* va_list, va_start(), va_end() */
47 #include <vroot/report.h> /* SUNPRO_DEPENDENCIES */
48
49
50 #define MAXJOBS_ADJUST_RFE4694000
51
52 #ifdef MAXJOBS_ADJUST_RFE4694000
53 extern void job_adjust_fini();
54 #endif /* MAXJOBS_ADJUST_RFE4694000 */
55
56
57 /*
58 * Defined macros
59 */
60
61 /*
62 * typedefs & structs
63 */
64
65 /*
66 * Static variables
67 */
124 *
125 * Print a message and die
126 *
127 * Parameters:
128 * format printf type format string
129 * args Arguments to match the format
130 *
131 * Global variables used:
132 * fatal_in_progress Indicates if this is a recursive call
133 * parallel_process_cnt Do we need to wait for anything?
134 * report_pwd Should we report the current path?
135 */
136 /*VARARGS*/
137 void
138 fatal(const char *message, ...)
139 {
140 va_list args;
141
142 va_start(args, message);
143 (void) fflush(stdout);
144 (void) fprintf(stderr, catgets(catd, 1, 263, "make: Fatal error: "));
145 (void) vfprintf(stderr, message, args);
146 (void) fprintf(stderr, "\n");
147 va_end(args);
148 if (report_pwd) {
149 (void) fprintf(stderr,
150 catgets(catd, 1, 156, "Current working directory %s\n"),
151 get_current_path());
152 }
153 (void) fflush(stderr);
154 if (fatal_in_progress) {
155 exit_status = 1;
156 exit(1);
157 }
158 fatal_in_progress = true;
159 /* Let all parallel children finish */
160 if ((dmake_mode_type == parallel_mode) &&
161 (parallel_process_cnt > 0)) {
162 (void) fprintf(stderr,
163 catgets(catd, 1, 157, "Waiting for %d %s to finish\n"),
164 parallel_process_cnt,
165 parallel_process_cnt == 1 ?
166 catgets(catd, 1, 158, "job") : catgets(catd, 1, 159, "jobs"));
167 (void) fflush(stderr);
168 }
169
170 while (parallel_process_cnt > 0) {
171 await_parallel(true);
172 finish_children(false);
173 }
174
175 #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
176 job_adjust_fini();
177 #endif
178
179 exit_status = 1;
180 exit(1);
181 }
182
183 /*
184 * warning(format, args...)
185 *
186 * Print a message and continue.
187 *
188 * Parameters:
189 * format printf type format string
190 * args Arguments to match the format
191 *
192 * Global variables used:
193 * report_pwd Should we report the current path?
194 */
195 /*VARARGS*/
196 void
197 warning(char * message, ...)
198 {
199 va_list args;
200
201 va_start(args, message);
202 (void) fflush(stdout);
203 (void) fprintf(stderr, catgets(catd, 1, 265, "make: Warning: "));
204 (void) vfprintf(stderr, message, args);
205 (void) fprintf(stderr, "\n");
206 va_end(args);
207 if (report_pwd) {
208 (void) fprintf(stderr,
209 catgets(catd, 1, 161, "Current working directory %s\n"),
210 get_current_path());
211 }
212 (void) fflush(stderr);
213 }
214
215 /*
216 * time_to_string(time)
217 *
218 * Take a numeric time value and produce
219 * a proper string representation.
220 *
221 * Return value:
222 * The string representation of the time
223 *
224 * Parameters:
225 * time The time we need to translate
226 *
227 * Global variables used:
228 */
229 char *
230 time_to_string(const timestruc_t &time)
231 {
232 struct tm *tm;
233 char buf[128];
234
235 if (time == file_doesnt_exist) {
236 return catgets(catd, 1, 163, "File does not exist");
237 }
238 if (time == file_max_time) {
239 return catgets(catd, 1, 164, "Younger than any file");
240 }
241 tm = localtime(&time.tv_sec);
242 strftime(buf, sizeof (buf), NOCATGETS("%c %Z"), tm);
243 buf[127] = (int) nul_char;
244 return strdup(buf);
245 }
246
247 /*
248 * get_current_path()
249 *
250 * Stuff current_path with the current path if it isnt there already.
251 *
252 * Parameters:
253 *
254 * Global variables used:
255 */
256 char *
257 get_current_path(void)
258 {
259 char pwd[(MAXPATHLEN * MB_LEN_MAX)];
260 static char *current_path;
261
262 if (current_path == NULL) {
541 * main() support
542 */
543
544 /*
545 * load_cached_names()
546 *
547 * Load the vector of cached names
548 *
549 * Parameters:
550 *
551 * Global variables used:
552 * Many many pointers to Name blocks.
553 */
554 void
555 load_cached_names(void)
556 {
557 char *cp;
558 Name dollar;
559
560 /* Load the cached_names struct */
561 MBSTOWCS(wcs_buffer, NOCATGETS(".BUILT_LAST_MAKE_RUN"));
562 built_last_make_run = GETNAME(wcs_buffer, FIND_LENGTH);
563 MBSTOWCS(wcs_buffer, NOCATGETS("@"));
564 c_at = GETNAME(wcs_buffer, FIND_LENGTH);
565 MBSTOWCS(wcs_buffer, NOCATGETS(" *conditionals* "));
566 conditionals = GETNAME(wcs_buffer, FIND_LENGTH);
567 /*
568 * A version of make was released with NSE 1.0 that used
569 * VERSION-1.1 but this version is identical to VERSION-1.0.
570 * The version mismatch code makes a special case for this
571 * situation. If the version number is changed from 1.0
572 * it should go to 1.2.
573 */
574 MBSTOWCS(wcs_buffer, NOCATGETS("VERSION-1.0"));
575 current_make_version = GETNAME(wcs_buffer, FIND_LENGTH);
576 MBSTOWCS(wcs_buffer, NOCATGETS(".SVR4"));
577 svr4_name = GETNAME(wcs_buffer, FIND_LENGTH);
578 MBSTOWCS(wcs_buffer, NOCATGETS(".POSIX"));
579 posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
580 MBSTOWCS(wcs_buffer, NOCATGETS(".DEFAULT"));
581 default_rule_name = GETNAME(wcs_buffer, FIND_LENGTH);
582 MBSTOWCS(wcs_buffer, NOCATGETS("$"));
583 dollar = GETNAME(wcs_buffer, FIND_LENGTH);
584 MBSTOWCS(wcs_buffer, NOCATGETS(".DONE"));
585 done = GETNAME(wcs_buffer, FIND_LENGTH);
586 MBSTOWCS(wcs_buffer, NOCATGETS("."));
587 dot = GETNAME(wcs_buffer, FIND_LENGTH);
588 MBSTOWCS(wcs_buffer, NOCATGETS(".KEEP_STATE"));
589 dot_keep_state = GETNAME(wcs_buffer, FIND_LENGTH);
590 MBSTOWCS(wcs_buffer, NOCATGETS(".KEEP_STATE_FILE"));
591 dot_keep_state_file = GETNAME(wcs_buffer, FIND_LENGTH);
592 MBSTOWCS(wcs_buffer, NOCATGETS(""));
593 empty_name = GETNAME(wcs_buffer, FIND_LENGTH);
594 MBSTOWCS(wcs_buffer, NOCATGETS(" FORCE"));
595 force = GETNAME(wcs_buffer, FIND_LENGTH);
596 MBSTOWCS(wcs_buffer, NOCATGETS("HOST_ARCH"));
597 host_arch = GETNAME(wcs_buffer, FIND_LENGTH);
598 MBSTOWCS(wcs_buffer, NOCATGETS("HOST_MACH"));
599 host_mach = GETNAME(wcs_buffer, FIND_LENGTH);
600 MBSTOWCS(wcs_buffer, NOCATGETS(".IGNORE"));
601 ignore_name = GETNAME(wcs_buffer, FIND_LENGTH);
602 MBSTOWCS(wcs_buffer, NOCATGETS(".INIT"));
603 init = GETNAME(wcs_buffer, FIND_LENGTH);
604 MBSTOWCS(wcs_buffer, NOCATGETS(".LOCAL"));
605 localhost_name = GETNAME(wcs_buffer, FIND_LENGTH);
606 MBSTOWCS(wcs_buffer, NOCATGETS(".make.state"));
607 make_state = GETNAME(wcs_buffer, FIND_LENGTH);
608 MBSTOWCS(wcs_buffer, NOCATGETS("MAKEFLAGS"));
609 makeflags = GETNAME(wcs_buffer, FIND_LENGTH);
610 MBSTOWCS(wcs_buffer, NOCATGETS(".MAKE_VERSION"));
611 make_version = GETNAME(wcs_buffer, FIND_LENGTH);
612 MBSTOWCS(wcs_buffer, NOCATGETS(".NO_PARALLEL"));
613 no_parallel_name = GETNAME(wcs_buffer, FIND_LENGTH);
614 MBSTOWCS(wcs_buffer, NOCATGETS(".NOT_AUTO"));
615 not_auto = GETNAME(wcs_buffer, FIND_LENGTH);
616 MBSTOWCS(wcs_buffer, NOCATGETS(".PARALLEL"));
617 parallel_name = GETNAME(wcs_buffer, FIND_LENGTH);
618 MBSTOWCS(wcs_buffer, NOCATGETS("PATH"));
619 path_name = GETNAME(wcs_buffer, FIND_LENGTH);
620 MBSTOWCS(wcs_buffer, NOCATGETS("+"));
621 plus = GETNAME(wcs_buffer, FIND_LENGTH);
622 MBSTOWCS(wcs_buffer, NOCATGETS(".PRECIOUS"));
623 precious = GETNAME(wcs_buffer, FIND_LENGTH);
624 MBSTOWCS(wcs_buffer, NOCATGETS("?"));
625 query = GETNAME(wcs_buffer, FIND_LENGTH);
626 MBSTOWCS(wcs_buffer, NOCATGETS("^"));
627 hat = GETNAME(wcs_buffer, FIND_LENGTH);
628 MBSTOWCS(wcs_buffer, NOCATGETS(".RECURSIVE"));
629 recursive_name = GETNAME(wcs_buffer, FIND_LENGTH);
630 MBSTOWCS(wcs_buffer, NOCATGETS(".SCCS_GET"));
631 sccs_get_name = GETNAME(wcs_buffer, FIND_LENGTH);
632 MBSTOWCS(wcs_buffer, NOCATGETS(".SCCS_GET_POSIX"));
633 sccs_get_posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
634 MBSTOWCS(wcs_buffer, NOCATGETS(".GET"));
635 get_name = GETNAME(wcs_buffer, FIND_LENGTH);
636 MBSTOWCS(wcs_buffer, NOCATGETS(".GET_POSIX"));
637 get_posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
638 MBSTOWCS(wcs_buffer, NOCATGETS("SHELL"));
639 shell_name = GETNAME(wcs_buffer, FIND_LENGTH);
640 MBSTOWCS(wcs_buffer, NOCATGETS(".SILENT"));
641 silent_name = GETNAME(wcs_buffer, FIND_LENGTH);
642 MBSTOWCS(wcs_buffer, NOCATGETS(".SUFFIXES"));
643 suffixes_name = GETNAME(wcs_buffer, FIND_LENGTH);
644 MBSTOWCS(wcs_buffer, SUNPRO_DEPENDENCIES);
645 sunpro_dependencies = GETNAME(wcs_buffer, FIND_LENGTH);
646 MBSTOWCS(wcs_buffer, NOCATGETS("TARGET_ARCH"));
647 target_arch = GETNAME(wcs_buffer, FIND_LENGTH);
648 MBSTOWCS(wcs_buffer, NOCATGETS("TARGET_MACH"));
649 target_mach = GETNAME(wcs_buffer, FIND_LENGTH);
650 MBSTOWCS(wcs_buffer, NOCATGETS("VIRTUAL_ROOT"));
651 virtual_root = GETNAME(wcs_buffer, FIND_LENGTH);
652 MBSTOWCS(wcs_buffer, NOCATGETS("VPATH"));
653 vpath_name = GETNAME(wcs_buffer, FIND_LENGTH);
654 MBSTOWCS(wcs_buffer, NOCATGETS(".WAIT"));
655 wait_name = GETNAME(wcs_buffer, FIND_LENGTH);
656
657 wait_name->state = build_ok;
658
659 /* Mark special targets so that the reader treats them properly */
660 svr4_name->special_reader = svr4_special;
661 posix_name->special_reader = posix_special;
662 built_last_make_run->special_reader = built_last_make_run_special;
663 default_rule_name->special_reader = default_special;
664 dot_keep_state->special_reader = keep_state_special;
665 dot_keep_state_file->special_reader = keep_state_file_special;
666 ignore_name->special_reader = ignore_special;
667 make_version->special_reader = make_version_special;
668 no_parallel_name->special_reader = no_parallel_special;
669 parallel_name->special_reader = parallel_special;
670 localhost_name->special_reader = localhost_special;
671 precious->special_reader = precious_special;
672 sccs_get_name->special_reader = sccs_get_special;
673 sccs_get_posix_name->special_reader = sccs_get_posix_special;
674 get_name->special_reader = get_special;
675 get_posix_name->special_reader = get_posix_special;
676 silent_name->special_reader = silent_special;
677 suffixes_name->special_reader = suffixes_special;
678
679 /* The value of $$ is $ */
680 (void) SETVAR(dollar, dollar, false);
681 dollar->dollar = false;
682
683 /* Set the value of $(SHELL) */
684 if (posix) {
685 MBSTOWCS(wcs_buffer, NOCATGETS("/usr/xpg4/bin/sh"));
686 } else {
687 MBSTOWCS(wcs_buffer, NOCATGETS("/bin/sh"));
688 }
689 (void) SETVAR(shell_name, GETNAME(wcs_buffer, FIND_LENGTH), false);
690
691 /*
692 * Use " FORCE" to simulate a FRC dependency for :: type
693 * targets with no dependencies.
694 */
695 (void) append_prop(force, line_prop);
696 force->stat.time = file_max_time;
697
698 /* Make sure VPATH is defined before current dir is read */
699 if ((cp = getenv(vpath_name->string_mb)) != NULL) {
700 MBSTOWCS(wcs_buffer, cp);
701 (void) SETVAR(vpath_name,
702 GETNAME(wcs_buffer, FIND_LENGTH),
703 false);
704 }
705
706 /* Check if there is NO PATH variable. If not we construct one. */
707 if (getenv(path_name->string_mb) == NULL) {
708 vroot_path = NULL;
709 add_dir_to_path(NOCATGETS("."), &vroot_path, -1);
710 add_dir_to_path(NOCATGETS("/bin"), &vroot_path, -1);
711 add_dir_to_path(NOCATGETS("/usr/bin"), &vroot_path, -1);
712 }
713 }
714
715 /*
716 * iterate on list of conditional macros in np, and place them in
717 * a String_rec starting with, and separated by the '$' character.
718 */
719 void
720 cond_macros_into_string(Name np, String_rec *buffer)
721 {
722 Macro_list macro_list;
723
724 /*
725 * Put the version number at the start of the string
726 */
727 MBSTOWCS(wcs_buffer, DEPINFO_FMT_VERSION);
728 append_string(wcs_buffer, buffer, FIND_LENGTH);
729 /*
730 * Add the rest of the conditional macros to the buffer
731 */
|
28 *
29 * This file contains various unclassified routines. Some main groups:
30 * getname
31 * Memory allocation
32 * String handling
33 * Property handling
34 * Error message handling
35 * Make internal state dumping
36 * main routine support
37 */
38
39 /*
40 * Included files
41 */
42 #include <errno.h>
43 #include <mk/defs.h>
44 #include <mksh/macro.h> /* SETVAR() */
45 #include <mksh/misc.h> /* enable_interrupt() */
46 #include <stdarg.h> /* va_list, va_start(), va_end() */
47 #include <vroot/report.h> /* SUNPRO_DEPENDENCIES */
48 #include <libintl.h>
49
50
51 #define MAXJOBS_ADJUST_RFE4694000
52
53 #ifdef MAXJOBS_ADJUST_RFE4694000
54 extern void job_adjust_fini();
55 #endif /* MAXJOBS_ADJUST_RFE4694000 */
56
57
58 /*
59 * Defined macros
60 */
61
62 /*
63 * typedefs & structs
64 */
65
66 /*
67 * Static variables
68 */
125 *
126 * Print a message and die
127 *
128 * Parameters:
129 * format printf type format string
130 * args Arguments to match the format
131 *
132 * Global variables used:
133 * fatal_in_progress Indicates if this is a recursive call
134 * parallel_process_cnt Do we need to wait for anything?
135 * report_pwd Should we report the current path?
136 */
137 /*VARARGS*/
138 void
139 fatal(const char *message, ...)
140 {
141 va_list args;
142
143 va_start(args, message);
144 (void) fflush(stdout);
145 (void) fprintf(stderr, gettext("make: Fatal error: "));
146 (void) vfprintf(stderr, message, args);
147 (void) fprintf(stderr, "\n");
148 va_end(args);
149 if (report_pwd) {
150 (void) fprintf(stderr,
151 gettext("Current working directory %s\n"),
152 get_current_path());
153 }
154 (void) fflush(stderr);
155 if (fatal_in_progress) {
156 exit_status = 1;
157 exit(1);
158 }
159 fatal_in_progress = true;
160 /* Let all parallel children finish */
161 if ((dmake_mode_type == parallel_mode) &&
162 (parallel_process_cnt > 0)) {
163 (void) fprintf(stderr,
164 gettext("Waiting for %d %s to finish\n"),
165 parallel_process_cnt,
166 parallel_process_cnt == 1 ?
167 gettext("job") : gettext("jobs"));
168 (void) fflush(stderr);
169 }
170
171 while (parallel_process_cnt > 0) {
172 await_parallel(true);
173 finish_children(false);
174 }
175
176 #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
177 job_adjust_fini();
178 #endif
179
180 exit_status = 1;
181 exit(1);
182 }
183
184 /*
185 * warning(format, args...)
186 *
187 * Print a message and continue.
188 *
189 * Parameters:
190 * format printf type format string
191 * args Arguments to match the format
192 *
193 * Global variables used:
194 * report_pwd Should we report the current path?
195 */
196 /*VARARGS*/
197 void
198 warning(char * message, ...)
199 {
200 va_list args;
201
202 va_start(args, message);
203 (void) fflush(stdout);
204 (void) fprintf(stderr, gettext("make: Warning: "));
205 (void) vfprintf(stderr, message, args);
206 (void) fprintf(stderr, "\n");
207 va_end(args);
208 if (report_pwd) {
209 (void) fprintf(stderr,
210 gettext("Current working directory %s\n"),
211 get_current_path());
212 }
213 (void) fflush(stderr);
214 }
215
216 /*
217 * time_to_string(time)
218 *
219 * Take a numeric time value and produce
220 * a proper string representation.
221 *
222 * Return value:
223 * The string representation of the time
224 *
225 * Parameters:
226 * time The time we need to translate
227 *
228 * Global variables used:
229 */
230 char *
231 time_to_string(const timestruc_t &time)
232 {
233 struct tm *tm;
234 char buf[128];
235
236 if (time == file_doesnt_exist) {
237 return gettext("File does not exist");
238 }
239 if (time == file_max_time) {
240 return gettext("Younger than any file");
241 }
242 tm = localtime(&time.tv_sec);
243 strftime(buf, sizeof (buf), "%c %Z", tm);
244 buf[127] = (int) nul_char;
245 return strdup(buf);
246 }
247
248 /*
249 * get_current_path()
250 *
251 * Stuff current_path with the current path if it isnt there already.
252 *
253 * Parameters:
254 *
255 * Global variables used:
256 */
257 char *
258 get_current_path(void)
259 {
260 char pwd[(MAXPATHLEN * MB_LEN_MAX)];
261 static char *current_path;
262
263 if (current_path == NULL) {
542 * main() support
543 */
544
545 /*
546 * load_cached_names()
547 *
548 * Load the vector of cached names
549 *
550 * Parameters:
551 *
552 * Global variables used:
553 * Many many pointers to Name blocks.
554 */
555 void
556 load_cached_names(void)
557 {
558 char *cp;
559 Name dollar;
560
561 /* Load the cached_names struct */
562 MBSTOWCS(wcs_buffer, ".BUILT_LAST_MAKE_RUN");
563 built_last_make_run = GETNAME(wcs_buffer, FIND_LENGTH);
564 MBSTOWCS(wcs_buffer, "@");
565 c_at = GETNAME(wcs_buffer, FIND_LENGTH);
566 MBSTOWCS(wcs_buffer, " *conditionals* ");
567 conditionals = GETNAME(wcs_buffer, FIND_LENGTH);
568 /*
569 * A version of make was released with NSE 1.0 that used
570 * VERSION-1.1 but this version is identical to VERSION-1.0.
571 * The version mismatch code makes a special case for this
572 * situation. If the version number is changed from 1.0
573 * it should go to 1.2.
574 */
575 MBSTOWCS(wcs_buffer, "VERSION-1.0");
576 current_make_version = GETNAME(wcs_buffer, FIND_LENGTH);
577 MBSTOWCS(wcs_buffer, ".SVR4");
578 svr4_name = GETNAME(wcs_buffer, FIND_LENGTH);
579 MBSTOWCS(wcs_buffer, ".POSIX");
580 posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
581 MBSTOWCS(wcs_buffer, ".DEFAULT");
582 default_rule_name = GETNAME(wcs_buffer, FIND_LENGTH);
583 MBSTOWCS(wcs_buffer, "$");
584 dollar = GETNAME(wcs_buffer, FIND_LENGTH);
585 MBSTOWCS(wcs_buffer, ".DONE");
586 done = GETNAME(wcs_buffer, FIND_LENGTH);
587 MBSTOWCS(wcs_buffer, ".");
588 dot = GETNAME(wcs_buffer, FIND_LENGTH);
589 MBSTOWCS(wcs_buffer, ".KEEP_STATE");
590 dot_keep_state = GETNAME(wcs_buffer, FIND_LENGTH);
591 MBSTOWCS(wcs_buffer, ".KEEP_STATE_FILE");
592 dot_keep_state_file = GETNAME(wcs_buffer, FIND_LENGTH);
593 MBSTOWCS(wcs_buffer, "");
594 empty_name = GETNAME(wcs_buffer, FIND_LENGTH);
595 MBSTOWCS(wcs_buffer, " FORCE");
596 force = GETNAME(wcs_buffer, FIND_LENGTH);
597 MBSTOWCS(wcs_buffer, "HOST_ARCH");
598 host_arch = GETNAME(wcs_buffer, FIND_LENGTH);
599 MBSTOWCS(wcs_buffer, "HOST_MACH");
600 host_mach = GETNAME(wcs_buffer, FIND_LENGTH);
601 MBSTOWCS(wcs_buffer, ".IGNORE");
602 ignore_name = GETNAME(wcs_buffer, FIND_LENGTH);
603 MBSTOWCS(wcs_buffer, ".INIT");
604 init = GETNAME(wcs_buffer, FIND_LENGTH);
605 MBSTOWCS(wcs_buffer, ".LOCAL");
606 localhost_name = GETNAME(wcs_buffer, FIND_LENGTH);
607 MBSTOWCS(wcs_buffer, ".make.state");
608 make_state = GETNAME(wcs_buffer, FIND_LENGTH);
609 MBSTOWCS(wcs_buffer, "MAKEFLAGS");
610 makeflags = GETNAME(wcs_buffer, FIND_LENGTH);
611 MBSTOWCS(wcs_buffer, ".MAKE_VERSION");
612 make_version = GETNAME(wcs_buffer, FIND_LENGTH);
613 MBSTOWCS(wcs_buffer, ".NO_PARALLEL");
614 no_parallel_name = GETNAME(wcs_buffer, FIND_LENGTH);
615 MBSTOWCS(wcs_buffer, ".NOT_AUTO");
616 not_auto = GETNAME(wcs_buffer, FIND_LENGTH);
617 MBSTOWCS(wcs_buffer, ".PARALLEL");
618 parallel_name = GETNAME(wcs_buffer, FIND_LENGTH);
619 MBSTOWCS(wcs_buffer, "PATH");
620 path_name = GETNAME(wcs_buffer, FIND_LENGTH);
621 MBSTOWCS(wcs_buffer, "+");
622 plus = GETNAME(wcs_buffer, FIND_LENGTH);
623 MBSTOWCS(wcs_buffer, ".PRECIOUS");
624 precious = GETNAME(wcs_buffer, FIND_LENGTH);
625 MBSTOWCS(wcs_buffer, "?");
626 query = GETNAME(wcs_buffer, FIND_LENGTH);
627 MBSTOWCS(wcs_buffer, "^");
628 hat = GETNAME(wcs_buffer, FIND_LENGTH);
629 MBSTOWCS(wcs_buffer, ".RECURSIVE");
630 recursive_name = GETNAME(wcs_buffer, FIND_LENGTH);
631 MBSTOWCS(wcs_buffer, ".SCCS_GET");
632 sccs_get_name = GETNAME(wcs_buffer, FIND_LENGTH);
633 MBSTOWCS(wcs_buffer, ".SCCS_GET_POSIX");
634 sccs_get_posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
635 MBSTOWCS(wcs_buffer, ".GET");
636 get_name = GETNAME(wcs_buffer, FIND_LENGTH);
637 MBSTOWCS(wcs_buffer, ".GET_POSIX");
638 get_posix_name = GETNAME(wcs_buffer, FIND_LENGTH);
639 MBSTOWCS(wcs_buffer, "SHELL");
640 shell_name = GETNAME(wcs_buffer, FIND_LENGTH);
641 MBSTOWCS(wcs_buffer, ".SILENT");
642 silent_name = GETNAME(wcs_buffer, FIND_LENGTH);
643 MBSTOWCS(wcs_buffer, ".SUFFIXES");
644 suffixes_name = GETNAME(wcs_buffer, FIND_LENGTH);
645 MBSTOWCS(wcs_buffer, SUNPRO_DEPENDENCIES);
646 sunpro_dependencies = GETNAME(wcs_buffer, FIND_LENGTH);
647 MBSTOWCS(wcs_buffer, "TARGET_ARCH");
648 target_arch = GETNAME(wcs_buffer, FIND_LENGTH);
649 MBSTOWCS(wcs_buffer, "TARGET_MACH");
650 target_mach = GETNAME(wcs_buffer, FIND_LENGTH);
651 MBSTOWCS(wcs_buffer, "VIRTUAL_ROOT");
652 virtual_root = GETNAME(wcs_buffer, FIND_LENGTH);
653 MBSTOWCS(wcs_buffer, "VPATH");
654 vpath_name = GETNAME(wcs_buffer, FIND_LENGTH);
655 MBSTOWCS(wcs_buffer, ".WAIT");
656 wait_name = GETNAME(wcs_buffer, FIND_LENGTH);
657
658 wait_name->state = build_ok;
659
660 /* Mark special targets so that the reader treats them properly */
661 svr4_name->special_reader = svr4_special;
662 posix_name->special_reader = posix_special;
663 built_last_make_run->special_reader = built_last_make_run_special;
664 default_rule_name->special_reader = default_special;
665 dot_keep_state->special_reader = keep_state_special;
666 dot_keep_state_file->special_reader = keep_state_file_special;
667 ignore_name->special_reader = ignore_special;
668 make_version->special_reader = make_version_special;
669 no_parallel_name->special_reader = no_parallel_special;
670 parallel_name->special_reader = parallel_special;
671 localhost_name->special_reader = localhost_special;
672 precious->special_reader = precious_special;
673 sccs_get_name->special_reader = sccs_get_special;
674 sccs_get_posix_name->special_reader = sccs_get_posix_special;
675 get_name->special_reader = get_special;
676 get_posix_name->special_reader = get_posix_special;
677 silent_name->special_reader = silent_special;
678 suffixes_name->special_reader = suffixes_special;
679
680 /* The value of $$ is $ */
681 (void) SETVAR(dollar, dollar, false);
682 dollar->dollar = false;
683
684 /* Set the value of $(SHELL) */
685 if (posix) {
686 MBSTOWCS(wcs_buffer, "/usr/xpg4/bin/sh");
687 } else {
688 MBSTOWCS(wcs_buffer, "/bin/sh");
689 }
690 (void) SETVAR(shell_name, GETNAME(wcs_buffer, FIND_LENGTH), false);
691
692 /*
693 * Use " FORCE" to simulate a FRC dependency for :: type
694 * targets with no dependencies.
695 */
696 (void) append_prop(force, line_prop);
697 force->stat.time = file_max_time;
698
699 /* Make sure VPATH is defined before current dir is read */
700 if ((cp = getenv(vpath_name->string_mb)) != NULL) {
701 MBSTOWCS(wcs_buffer, cp);
702 (void) SETVAR(vpath_name,
703 GETNAME(wcs_buffer, FIND_LENGTH),
704 false);
705 }
706
707 /* Check if there is NO PATH variable. If not we construct one. */
708 if (getenv(path_name->string_mb) == NULL) {
709 vroot_path = NULL;
710 add_dir_to_path(".", &vroot_path, -1);
711 add_dir_to_path("/bin", &vroot_path, -1);
712 add_dir_to_path("/usr/bin", &vroot_path, -1);
713 }
714 }
715
716 /*
717 * iterate on list of conditional macros in np, and place them in
718 * a String_rec starting with, and separated by the '$' character.
719 */
720 void
721 cond_macros_into_string(Name np, String_rec *buffer)
722 {
723 Macro_list macro_list;
724
725 /*
726 * Put the version number at the start of the string
727 */
728 MBSTOWCS(wcs_buffer, DEPINFO_FMT_VERSION);
729 append_string(wcs_buffer, buffer, FIND_LENGTH);
730 /*
731 * Add the rest of the conditional macros to the buffer
732 */
|