Print this page
make: unifdef for MAKETOOL and DISTRIBUTED (undefined)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/make/bin/dosys.cc
+++ new/usr/src/cmd/make/bin/dosys.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 2004 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /*
27 27 * dosys.cc
28 28 *
29 29 * Execute one commandline
30 30 */
31 31
32 32 /*
33 33 * Included files
34 34 */
35 35 #include <fcntl.h> /* open() */
36 36 #include <mk/defs.h>
37 37 #include <mksh/dosys.h> /* doshell(), doexec() */
38 38 #include <mksh/misc.h> /* getmem() */
39 39 #include <sys/stat.h> /* open() */
40 40 #include <unistd.h> /* getpid() */
41 41
42 42 /*
43 43 * Defined macros
44 44 */
45 45
46 46 /*
47 47 * typedefs & structs
48 48 */
49 49
50 50 /*
51 51 * Static variables
52 52 */
53 53 static int filter_file;
54 54 static char *filter_file_name;
55 55
56 56 /*
57 57 * File table of contents
58 58 */
59 59 static void redirect_stderr(void);
60 60
61 61 /*
62 62 * dosys(command, ignore_error, call_make, silent_error, target)
63 63 *
64 64 * Check if command string contains meta chars and dispatch to
65 65 * the proper routine for executing one command line.
66 66 *
67 67 * Return value:
68 68 * Indicates if the command execution failed
69 69 *
70 70 * Parameters:
71 71 * command The command to run
72 72 * ignore_error Should make abort when an error is seen?
73 73 * call_make Did command reference $(MAKE) ?
74 74 * silent_error Should error messages be suppressed for pmake?
75 75 * target Target we are building
76 76 *
77 77 * Global variables used:
78 78 * do_not_exec_rule Is -n on?
79 79 * working_on_targets We started processing real targets
80 80 */
81 81 Doname
82 82 dosys(register Name command, register Boolean ignore_error, register Boolean call_make, Boolean silent_error, Boolean always_exec, Name target, Boolean redirect_out_err)
83 83 {
84 84 timestruc_t before;
85 85 register int length = command->hash.length;
86 86 Wstring wcb(command);
87 87 register wchar_t *p = wcb.get_string();
88 88 register wchar_t *q;
89 89 Doname result;
90 90
91 91 /* Strip spaces from head of command string */
92 92 while (iswspace(*p)) {
93 93 p++, length--;
94 94 }
95 95 if (*p == (int) nul_char) {
96 96 return build_failed;
97 97 }
98 98 /* If we are faking it we just return */
99 99 if (do_not_exec_rule &&
100 100 working_on_targets &&
101 101 !call_make &&
102 102 !always_exec) {
103 103 return build_ok;
104 104 }
105 105 /* no_action_was_taken is used to print special message */
106 106 no_action_was_taken = false;
107 107
108 108 /* Copy string to make it OK to write it. */
109 109 q = ALLOC_WC(length + 1);
110 110 (void) wscpy(q, p);
111 111 /* Write the state file iff this command uses make. */
112 112 if (call_make && command_changed) {
113 113 write_state_file(0, false);
114 114 }
115 115 make_state->stat.time = file_no_time;
116 116 (void)exists(make_state);
117 117 before = make_state->stat.time;
118 118 /*
119 119 * Run command directly if it contains no shell meta chars,
120 120 * else run it using the shell.
121 121 */
122 122 if (await(ignore_error,
↓ open down ↓ |
122 lines elided |
↑ open up ↑ |
123 123 silent_error,
124 124 target,
125 125 wcb.get_string(),
126 126 command->meta ?
127 127 doshell(q, ignore_error, redirect_out_err,
128 128 stdout_file, stderr_file, 0) :
129 129 doexec(q, ignore_error, redirect_out_err,
130 130 stdout_file, stderr_file,
131 131 vroot_path, 0),
132 132 send_mtool_msgs,
133 -#if defined(DISTRIBUTED) || defined(MAKETOOL) /* tolik */
134 - get_xdrs_ptr(),
135 - get_job_msg_id()
136 -#else
137 133 NULL,
138 134 -1
139 -#endif
140 135 )) {
141 136 result = build_ok;
142 137 } else {
143 138 result = build_failed;
144 139 }
145 140 retmem(q);
146 141
147 142 if ((report_dependencies_level == 0) &&
148 143 call_make) {
149 144 make_state->stat.time = file_no_time;
150 145 (void)exists(make_state);
151 146 if (before == make_state->stat.time) {
152 147 return result;
153 148 }
154 149 makefile_type = reading_statefile;
155 150 if (read_trace_level > 1) {
156 151 trace_reader = true;
157 152 }
158 153 temp_file_number++;
159 154 (void) read_simple_file(make_state,
160 155 false,
161 156 false,
162 157 false,
163 158 false,
164 159 false,
165 160 true);
166 161 trace_reader = false;
167 162 }
168 163 return result;
169 164 }
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX