253 |
d->file = enter_file (*p); |
d->file = enter_file (*p); |
254 |
d->file->dontcare = 1; |
d->file->dontcare = 1; |
255 |
d->ignore_mtime = 0; |
d->ignore_mtime = 0; |
256 |
|
d->need_2nd_expansion = 0; |
257 |
/* Tell update_goal_chain to bail out as soon as this file is |
/* Tell update_goal_chain to bail out as soon as this file is |
258 |
made, and main not to die if we can't make this file. */ |
made, and main not to die if we can't make this file. */ |
259 |
d->changed = RM_DONTCARE; |
d->changed = RM_DONTCARE; |
373 |
filename = deps->file->name; |
filename = deps->file->name; |
374 |
deps->changed = flags; |
deps->changed = flags; |
375 |
deps->ignore_mtime = 0; |
deps->ignore_mtime = 0; |
376 |
|
deps->need_2nd_expansion = 0; |
377 |
if (flags & RM_DONTCARE) |
if (flags & RM_DONTCARE) |
378 |
deps->file->dontcare = 1; |
deps->file->dontcare = 1; |
379 |
|
|
1169 |
|
|
1170 |
if (beg <= end && *beg != '\0') |
if (beg <= end && *beg != '\0') |
1171 |
{ |
{ |
1172 |
|
char *top; |
1173 |
|
const char *fromp = beg; |
1174 |
|
|
1175 |
|
/* Make a copy of the dependency string. Note if we find '$'. */ |
1176 |
deps = (struct dep*) xmalloc (sizeof (struct dep)); |
deps = (struct dep*) xmalloc (sizeof (struct dep)); |
1177 |
deps->next = 0; |
deps->next = 0; |
1178 |
deps->name = savestring (beg, end - beg + 1); |
deps->name = top = (char *) xmalloc (end - beg + 2); |
1179 |
|
deps->need_2nd_expansion = 0; |
1180 |
|
while (fromp <= end) |
1181 |
|
{ |
1182 |
|
if (*fromp == '$') |
1183 |
|
deps->need_2nd_expansion = 1; |
1184 |
|
*(top++) = *(fromp++); |
1185 |
|
} |
1186 |
|
*top = '\0'; |
1187 |
deps->file = 0; |
deps->file = 0; |
1188 |
} |
} |
1189 |
else |
else |
1208 |
commands[commands_idx++] = '\n'; |
commands[commands_idx++] = '\n'; |
1209 |
} |
} |
1210 |
|
|
1211 |
/* Determine if this target should be made default. We used |
/* Determine if this target should be made default. We used to do |
1212 |
to do this in record_files() but because of the delayed |
this in record_files() but because of the delayed target recording |
1213 |
target recording and because preprocessor directives are |
and because preprocessor directives are legal in target's commands |
1214 |
legal in target's commands it is too late. Consider this |
it is too late. Consider this fragment for example: |
|
fragment for example: |
|
1215 |
|
|
1216 |
foo: |
foo: |
1217 |
|
|
1219 |
... |
... |
1220 |
endif |
endif |
1221 |
|
|
1222 |
Because the target is not recorded until after ifeq |
Because the target is not recorded until after ifeq directive is |
1223 |
directive is evaluated the .DEFAULT_TARGET does not |
evaluated the .DEFAULT_TARGET does not contain foo yet as one |
1224 |
contain foo yet as one would expect. Because of this |
would expect. Because of this we have to move some of the logic |
1225 |
we have to move some of the logic here. */ |
here. */ |
1226 |
|
|
1227 |
if (**default_target_name == '\0' && set_default) |
if (**default_target_name == '\0' && set_default) |
1228 |
{ |
{ |
1245 |
#ifdef HAVE_DOS_PATHS |
#ifdef HAVE_DOS_PATHS |
1246 |
&& strchr (name, '\\') == 0 |
&& strchr (name, '\\') == 0 |
1247 |
#endif |
#endif |
1248 |
) |
) |
1249 |
continue; |
continue; |
1250 |
|
|
1251 |
|
|
1908 |
|
|
1909 |
/* If there are multiple filenames, copy the chain DEPS |
/* If there are multiple filenames, copy the chain DEPS |
1910 |
for all but the last one. It is not safe for the same deps |
for all but the last one. It is not safe for the same deps |
1911 |
to go in more than one place in the data base. */ |
to go in more than one place in the database. */ |
1912 |
this = nextf != 0 ? copy_dep_chain (deps) : deps; |
this = nextf != 0 ? copy_dep_chain (deps) : deps; |
1913 |
|
|
1914 |
if (pattern != 0) |
if (pattern != 0) |
1925 |
this = 0; |
this = 0; |
1926 |
} |
} |
1927 |
else |
else |
1928 |
{ |
/* We use subst_expand to do the work of translating % to $* in |
1929 |
/* We use subst_expand to do the work of translating |
the dependency line. */ |
|
% to $* in the dependency line. */ |
|
1930 |
|
|
1931 |
if (this != 0 && find_percent (this->name) != 0) |
if (this != 0 && find_percent (this->name) != 0) |
1932 |
{ |
{ |
1933 |
char *o; |
char *o; |
1934 |
char *buffer = variable_expand (""); |
char *buffer = variable_expand (""); |
1935 |
|
|
1936 |
o = subst_expand (buffer, this->name, "%", "$*", |
o = subst_expand (buffer, this->name, "%", "$*", 1, 2, 0); |
|
1, 2, 0); |
|
1937 |
|
|
1938 |
free (this->name); |
free (this->name); |
1939 |
this->name = savestring (buffer, o - buffer); |
this->name = savestring (buffer, o - buffer); |
1940 |
} |
this->need_2nd_expansion = 1; |
1941 |
} |
} |
1942 |
} |
} |
1943 |
|
|
1944 |
if (!two_colon) |
if (!two_colon) |
2020 |
/* This is the rule without commands. Put its |
/* This is the rule without commands. Put its |
2021 |
dependencies at the end but before dependencies |
dependencies at the end but before dependencies |
2022 |
from the rule with commands (if any). This way |
from the rule with commands (if any). This way |
2023 |
everyhting appears in makefile order. */ |
everything appears in makefile order. */ |
2024 |
|
|
2025 |
if (f->cmds != 0) |
if (f->cmds != 0) |
2026 |
{ |
{ |
2037 |
/* This is a hack. I need a way to communicate to snap_deps() |
/* This is a hack. I need a way to communicate to snap_deps() |
2038 |
that the last dependency line in this file came with commands |
that the last dependency line in this file came with commands |
2039 |
(so that logic in snap_deps() can put it in front and all |
(so that logic in snap_deps() can put it in front and all |
2040 |
this $< -logic works). I cannot's simply rely oon file->cmds |
this $< -logic works). I cannot simply rely on file->cmds |
2041 |
being not 0 because of the cases like the following: |
being not 0 because of the cases like the following: |
2042 |
|
|
2043 |
foo: bar |
foo: bar |