Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): document variable expansion in the .EN...



details:   https://anonhg.NetBSD.org/src/rev/4a38b8c8ef66
branches:  trunk
changeset: 957876:4a38b8c8ef66
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Dec 13 18:57:44 2020 +0000

description:
make(1): document variable expansion in the .END node

diffstat:

 usr.bin/make/compat.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 636571f7a463 -r 4a38b8c8ef66 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sun Dec 13 18:12:29 2020 +0000
+++ b/usr.bin/make/compat.c     Sun Dec 13 18:57:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.213 2020/12/13 18:12:29 christos Exp $    */
+/*     $NetBSD: compat.c,v 1.214 2020/12/13 18:57:44 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.213 2020/12/13 18:12:29 christos Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.214 2020/12/13 18:57:44 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -258,6 +258,17 @@
        if (gn->type & OP_SAVE_CMDS) {
                GNode *endNode = Targ_GetEndNode();
                if (gn != endNode) {
+                       /*
+                        * Append the expanded command, to prevent the
+                        * local variables from being interpreted in the
+                        * context of the .END node.
+                        *
+                        * A probably unintended side effect of this is that
+                        * the expanded command will be expanded again in the
+                        * .END node.  Therefore, a literal '$' in these
+                        * commands must be written as '$$$$' instead of the
+                        * usual '$$'.
+                        */
                        Lst_Append(&endNode->commands, cmdStart);
                        return 0;
                }



Home | Main Index | Thread Index | Old Index