Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Fix parsing of SUNSHCMD style :sh = assigments.



details:   https://anonhg.NetBSD.org/src/rev/48d914885296
branches:  trunk
changeset: 789634:48d914885296
user:      sjg <sjg%NetBSD.org@localhost>
date:      Wed Aug 28 21:56:49 2013 +0000

description:
Fix parsing of SUNSHCMD style :sh = assigments.

Submitted by: Will Andrews at freebsd.org

diffstat:

 usr.bin/make/parse.c             |  12 +++++++++---
 usr.bin/make/unit-tests/Makefile |   3 ++-
 usr.bin/make/unit-tests/sunshcmd |  10 ++++++++++
 usr.bin/make/unit-tests/test.exp |   3 +++
 4 files changed, 24 insertions(+), 4 deletions(-)

diffs (83 lines):

diff -r bb1e1d375e9b -r 48d914885296 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Wed Aug 28 19:31:14 2013 +0000
+++ b/usr.bin/make/parse.c      Wed Aug 28 21:56:49 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $  */
+/*     $NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c    8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $");
+__RCSID("$NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1741,6 +1741,12 @@
            ch = *line++;
            wasSpace = TRUE;
        }
+#ifdef SUNSHCMD
+       if (ch == ':' && strncmp(line, "sh", 2) == 0) {
+           line += 2;
+           continue;
+       }
+#endif
        if (ch == '=')
            return TRUE;
        if (*line == '=' && ISEQOPERATOR(ch))
diff -r bb1e1d375e9b -r 48d914885296 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Wed Aug 28 19:31:14 2013 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Wed Aug 28 21:56:49 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.37 2013/07/16 19:59:28 sjg Exp $
+# $NetBSD: Makefile,v 1.38 2013/08/28 21:56:50 sjg Exp $
 #
 # Unit tests for make(1)
 # The main targets are:
@@ -41,6 +41,7 @@
        phony-end \
        posix \
        qequals \
+       sunshcmd \
        sysv \
        ternary \
        unexport \
diff -r bb1e1d375e9b -r 48d914885296 usr.bin/make/unit-tests/sunshcmd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/sunshcmd  Wed Aug 28 21:56:49 2013 +0000
@@ -0,0 +1,10 @@
+BYECMD         = echo bye
+LATERCMD       = echo later
+TEST1 :sh      = echo hello
+TEST2 :sh      = ${BYECMD}
+TEST3          = ${LATERCMD:sh}
+
+all:
+       @echo "TEST1=${TEST1}"
+       @echo "TEST2=${TEST2}"
+       @echo "TEST3=${TEST3}"
diff -r bb1e1d375e9b -r 48d914885296 usr.bin/make/unit-tests/test.exp
--- a/usr.bin/make/unit-tests/test.exp  Wed Aug 28 19:31:14 2013 +0000
+++ b/usr.bin/make/unit-tests/test.exp  Wed Aug 28 21:56:49 2013 +0000
@@ -349,6 +349,9 @@
 *** Error code 1 (continuing)
 `all' not remade because of errors.
 V.i386 ?= OK
+TEST1=hello
+TEST2=bye
+TEST3=later
 FOOBAR =
 FOOBAR = foobar fubar
 fun



Home | Main Index | Thread Index | Old Index