Print this page
make: unifdef for MAKETOOL and DISTRIBUTED (undefined)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/make/bin/macro.cc
+++ new/usr/src/cmd/make/bin/macro.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 */
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
25 25
26 26 /*
27 27 * macro.cc
28 28 *
29 29 * Handle expansion of make macros
30 30 */
31 31
32 32 /*
33 33 * Included files
34 34 */
35 -#ifdef DISTRIBUTED
36 -#include <avo/strings.h> /* AVO_STRDUP() */
37 -#include <dm/Avo_DoJobMsg.h>
38 -#endif
39 35 #include <mk/defs.h>
40 36 #include <mksh/macro.h> /* getvar(), expand_value() */
41 37 #include <mksh/misc.h> /* getmem() */
42 38
43 39 /*
44 40 * Defined macros
45 41 */
46 42
47 43 /*
48 44 * typedefs & structs
49 45 */
50 46
51 47 /*
52 48 * Static variables
53 49 */
54 50
55 51 /*
56 52 * File table of contents
57 53 */
58 54
59 55 void
60 56 setvar_append(register Name name, register Name value)
61 57 {
62 58 register Property macro_apx = get_prop(name->prop, macro_append_prop);
63 59 register Property macro = get_prop(name->prop, macro_prop);
64 60 int length;
65 61 String_rec destination;
66 62 wchar_t buffer[STRING_BUFFER_LENGTH];
67 63 register Chain chain;
68 64 Name val = NULL;
69 65
70 66 if(macro_apx == NULL) {
71 67 macro_apx = append_prop(name, macro_append_prop);
72 68 if(macro != NULL) {
73 69 macro_apx->body.macro_appendix.value = macro->body.macro.value;
74 70 }
75 71 }
76 72
77 73 val = macro_apx->body.macro_appendix.value_to_append;
78 74
79 75 INIT_STRING_FROM_STACK(destination, buffer);
80 76 buffer[0] = 0;
81 77 if (val != NULL) {
82 78 APPEND_NAME(val,
83 79 &destination,
84 80 (int) val->hash.length);
85 81 if (value != NULL) {
86 82 MBTOWC(wcs_buffer, " ");
87 83 append_char(wcs_buffer[0], &destination);
88 84 }
89 85 }
90 86 if (value != NULL) {
91 87 APPEND_NAME(value,
92 88 &destination,
93 89 (int) value->hash.length);
94 90 }
95 91 value = GETNAME(destination.buffer.start, FIND_LENGTH);
96 92 if (destination.free_after_use) {
97 93 retmem(destination.buffer.start);
98 94 }
99 95 macro_apx->body.macro_appendix.value_to_append = value;
100 96
101 97 SETVAR(name, empty_name, true);
102 98 }
103 99
104 100 /*
105 101 * setvar_envvar()
↓ open down ↓ |
57 lines elided |
↑ open up ↑ |
106 102 *
107 103 * This function scans the list of environment variables that have
108 104 * dynamic values and sets them.
109 105 *
110 106 * Parameters:
111 107 *
112 108 * Global variables used:
113 109 * envvar A list of environment vars with $ in value
114 110 */
115 111 void
116 -#ifdef DISTRIBUTED
117 -setvar_envvar(Avo_DoJobMsg *dmake_job_msg)
118 -#else
119 112 setvar_envvar(void)
120 -#endif
121 113 {
122 114 wchar_t buffer[STRING_BUFFER_LENGTH];
123 115 int length;
124 -#ifdef DISTRIBUTED
125 - Property macro;
126 -#endif
127 116 register char *mbs, *tmp_mbs_buffer = NULL;
128 117 register char *env, *tmp_mbs_buffer2 = NULL;
129 118 Envvar p;
130 119 String_rec value;
131 120
132 121 for (p = envvar; p != NULL; p = p->next) {
133 122 if (p->already_put
134 -#ifdef DISTRIBUTED
135 - && !dmake_job_msg
136 -#endif
137 123 ) {
138 124 continue;
139 125 }
140 126 INIT_STRING_FROM_STACK(value, buffer);
141 127 expand_value(p->value, &value, false);
142 128 if ((length = wslen(value.buffer.start)) >= MAXPATHLEN) {
143 129 mbs = tmp_mbs_buffer = getmem((length + 1) * MB_LEN_MAX);
144 130 (void) wcstombs(mbs,
145 131 value.buffer.start,
146 132 (length + 1) * MB_LEN_MAX);
147 133 } else {
148 134 mbs = mbs_buffer;
149 135 WCSTOMBS(mbs, value.buffer.start);
150 136 }
151 137 length = 2 + strlen(p->name->string_mb) + strlen(mbs);
152 138 if (!p->already_put || length > (MAXPATHLEN * MB_LEN_MAX)) {
153 139 env = tmp_mbs_buffer2 = getmem(length);
154 140 } else {
155 141 env = mbs_buffer2;
156 142 }
157 143 (void) sprintf(env,
158 144 "%s=%s",
159 145 p->name->string_mb,
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
160 146 mbs);
161 147 if (!p->already_put) {
162 148 (void) putenv(env);
163 149 p->already_put = true;
164 150 if (p->env_string) {
165 151 retmem_mb(p->env_string);
166 152 }
167 153 p->env_string = env;
168 154 tmp_mbs_buffer2 = NULL; // We should not return this memory now
169 155 }
170 -#ifdef DISTRIBUTED
171 - if (dmake_job_msg) {
172 - dmake_job_msg->appendVar(env);
173 - }
174 -#endif
175 156 if (tmp_mbs_buffer2) {
176 157 retmem_mb(tmp_mbs_buffer2);
177 158 tmp_mbs_buffer2 = NULL;
178 159 }
179 160 if (tmp_mbs_buffer) {
180 161 retmem_mb(tmp_mbs_buffer);
181 162 tmp_mbs_buffer = NULL;
182 163 }
183 164 }
184 -#ifdef DISTRIBUTED
185 - /* Append SUNPRO_DEPENDENCIES to the dmake_job_msg. */
186 - if (keep_state && dmake_job_msg) {
187 - macro = get_prop(sunpro_dependencies->prop, macro_prop);
188 - length = 2 +
189 - strlen(sunpro_dependencies->string_mb) +
190 - strlen(macro->body.macro.value->string_mb);
191 - if (length > (MAXPATHLEN * MB_LEN_MAX)) {
192 - env = tmp_mbs_buffer2 = getmem(length);
193 - } else {
194 - env = mbs_buffer2;
195 - }
196 - (void) sprintf(env,
197 - "%s=%s",
198 - sunpro_dependencies->string_mb,
199 - macro->body.macro.value->string_mb);
200 - dmake_job_msg->appendVar(env);
201 - if (tmp_mbs_buffer2) {
202 - retmem_mb(tmp_mbs_buffer2);
203 - tmp_mbs_buffer2 = NULL;
204 - }
205 - }
206 -#endif
207 165 }
208 166
209 167
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX