char *subst_beg, *subst_end, *replace_beg, *replace_end;
subst_beg = colon + 1;
- subst_end = strchr (subst_beg, '=');
+ subst_end = lindex (subst_beg, end, '=');
if (subst_end == 0)
/* There is no = in sight. Punt on the substitution
reference and treat this as a variable name containing
have_sysv_atvar = 0;
if (!posix_pedantic)
for (p = strchr (p2, '$'); p != 0; p = strchr (p+1, '$'))
- if (p[1] == '@' || (p[1] == '(' && p[2] == '@'))
+ if (p[1] == '@' || ((p[1] == '(' || p[1] == '{') && p[2] == '@'))
{
have_sysv_atvar = 1;
break;
since we're just emulating a SysV function, and if we do that then
why not emulate it completely (that's what SysV make does: it
re-expands the entire prerequisite list, all the time, with $@
- etc. in scope. But, it would be a pain indeed to document this
+ etc. in scope). But, it would be a pain indeed to document this
("iff you use $$@, your prerequisite lists is expanded twice...")
Ouch. Maybe better to make the code more complex. */
char *at;
int atlen;
- /* If it's a '$@' or '$(@', it's escaped */
+ /* If it's '$@', '$(@', or '${@', it's escaped */
if ((++p)[0] == '$'
- && (p[1] == '@' || (p[1] == '(' && p[2] == '@')))
+ && (p[1] == '@'
+ || ((p[1] == '(' || p[1] == '{') && p[2] == '@')))
{
bcopy (p, s, strlen (p)+1);
continue;
}
- /* Maybe found one. Check. p will point to '@' [for $@] or
- ')' [for $(@)] or 'D' [for $(@D)] or 'F' [for $(@F)]. */
- if (p[0] != '@'
- && (p[0] != '(' || (++p)[0] != '@'
- || ((++p)[0] != ')'
- && (p[1] != ')' || (p[0] != 'D' && p[0] != 'F')))))
+ /* Maybe found one. We like anything of any form matching @,
+ [({]@[}):], or [({]@[DF][}):]. */
+
+ if (! (p[0] == '@'
+ || ((p[0] == '(' || p[0] == '{') && (++p)[0] == '@'
+ && (((++p)[0] == ')' || p[0] == '}' || p[0] == ':')
+ || ((p[1] == ')' || p[1] == '}' || p[1] == ':')
+ && (p[0] == 'D' || p[0] == 'F'))))))
continue;
/* Found one. Compute the length and string ptr. Move p
$(dir)/foo $(dir)/bar: $@.x $$@.x $$$@.x $$$$@.x $$(@D).x $$(@F).x
$(dir)/x.z $(dir)/y.z: $(dir)/%.z : $@.% $$@.% $$$@.% $$$$@.% $$(@D).% $$(@F).%
+
+$(dir)/biz: $$(@).x $${@}.x $${@D}.x $${@F}.x
EOF
close(MAKEFILE);
$answer = ".x\n$dir/x.z.x\n\$.x\n\$@.x\n$dir.x\nx.z.x\n.y\n$dir/y.z.y\n\$.y\n\$@.y\n$dir.y\ny.z.y\n";
&compare_output($answer, &get_logfile(1));
+&run_make_with_options($makefile2, "$dir/biz", &get_logfile);
+$answer = "$dir/biz.x\n$dir.x\nbiz.x\n";
+&compare_output($answer, &get_logfile(1));
+
1;