aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/make.c9
-rwxr-xr-xtestsuite/make.tests23
2 files changed, 16 insertions, 16 deletions
diff --git a/miscutils/make.c b/miscutils/make.c
index 8e3778461..431ac41d4 100644
--- a/miscutils/make.c
+++ b/miscutils/make.c
@@ -1609,11 +1609,11 @@ input(FILE *fd, int ilevel)
1609 } 1609 }
1610 break; 1610 break;
1611 } 1611 }
1612 case '!': 1612 // ':=' is a non-POSIX extension.
1613 // ':=' and '!=' are non-POSIX extensions.
1614 case '+': 1613 case '+':
1615 case '?': 1614 case '?':
1616 // '+=' and '?=' are from POSIX 202X. 1615 case '!':
1616 // '+=', '?=' and '!=' are from POSIX 202X.
1617 if (posix) 1617 if (posix)
1618 break; 1618 break;
1619 eq = q[-1]; 1619 eq = q[-1];
@@ -1662,8 +1662,7 @@ input(FILE *fd, int ilevel)
1662 if (rhs != q) 1662 if (rhs != q)
1663 free(rhs); 1663 free(rhs);
1664 q = newq; 1664 q = newq;
1665 } 1665 } else if (eq == '!') {
1666 else if (eq == '!') {
1667 char *cmd = expand_macros(q, FALSE); 1666 char *cmd = expand_macros(q, FALSE);
1668 q = newq = run_command(cmd); 1667 q = newq = run_command(cmd);
1669 free(cmd); 1668 free(cmd);
diff --git a/testsuite/make.tests b/testsuite/make.tests
index 67617f8a2..c97950e95 100755
--- a/testsuite/make.tests
+++ b/testsuite/make.tests
@@ -267,6 +267,18 @@ target: file1 file2 file2 file3 file3
267' 267'
268cd .. || exit 1; rm -rf make.tempdir 2>/dev/null 268cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
269 269
270# Assign the output of a shell command to a macro.
271testing "make shell assignment" \
272 "make -f -" \
273 "1 2 3 4\n" "" '
274hello != echo 1; echo 2; echo 3; echo; echo
275
276target:
277 @echo "$(hello) 4"
278'
279
280cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
281
270# Nested macro expansion is allowed. This should be compatible 282# Nested macro expansion is allowed. This should be compatible
271# with other implementations. 283# with other implementations.
272testing "make nested macro expansion" \ 284testing "make nested macro expansion" \
@@ -332,17 +344,6 @@ testing "make chained inference rules" \
332' 344'
333cd .. || exit 1; rm -rf make.tempdir 2>/dev/null 345cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
334 346
335# Assign the output of a shell command to a macro.
336testing "make shell assignment" \
337 "make -f -" \
338 "1 2 3 4\n" "" '
339hello != echo 1; echo 2; echo 3; echo; echo
340
341target:
342 @echo "$(hello) 4"
343'
344
345cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
346# make supports *, ? and [] wildcards in targets and prerequisites 347# make supports *, ? and [] wildcards in targets and prerequisites
347mkdir make.tempdir && cd make.tempdir || exit 1 348mkdir make.tempdir && cd make.tempdir || exit 1
348touch -t 202206171201 t1a t2aa t3b 349touch -t 202206171201 t1a t2aa t3b