Module Name:    src
Committed By:   sjg
Date:           Wed Aug 28 21:56:50 UTC 2013

Modified Files:
        src/usr.bin/make: parse.c
        src/usr.bin/make/unit-tests: Makefile test.exp
Added Files:
        src/usr.bin/make/unit-tests: sunshcmd

Log Message:
Fix parsing of SUNSHCMD style :sh = assigments.

Submitted by: Will Andrews at freebsd.org


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/usr.bin/make/parse.c
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/sunshcmd
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/make/unit-tests/test.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.190 src/usr.bin/make/parse.c:1.191
--- src/usr.bin/make/parse.c:1.190	Sat Aug 10 21:20:03 2013
+++ src/usr.bin/make/parse.c	Wed Aug 28 21:56:49 2013
@@ -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 @@ Parse_IsVar(char *line)
 	    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))

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.37 src/usr.bin/make/unit-tests/Makefile:1.38
--- src/usr.bin/make/unit-tests/Makefile:1.37	Tue Jul 16 19:59:28 2013
+++ src/usr.bin/make/unit-tests/Makefile	Wed Aug 28 21:56:50 2013
@@ -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 @@ SUBFILES= \
 	phony-end \
 	posix \
 	qequals \
+	sunshcmd \
 	sysv \
 	ternary \
 	unexport \

Index: src/usr.bin/make/unit-tests/test.exp
diff -u src/usr.bin/make/unit-tests/test.exp:1.42 src/usr.bin/make/unit-tests/test.exp:1.43
--- src/usr.bin/make/unit-tests/test.exp:1.42	Fri Mar 22 16:36:46 2013
+++ src/usr.bin/make/unit-tests/test.exp	Wed Aug 28 21:56:50 2013
@@ -349,6 +349,9 @@ Now we expect an error...
 *** Error code 1 (continuing)
 `all' not remade because of errors.
 V.i386 ?= OK
+TEST1=hello
+TEST2=bye
+TEST3=later
 FOOBAR =
 FOOBAR = foobar fubar
 fun

Added files:

Index: src/usr.bin/make/unit-tests/sunshcmd
diff -u /dev/null src/usr.bin/make/unit-tests/sunshcmd:1.1
--- /dev/null	Wed Aug 28 21:56:50 2013
+++ src/usr.bin/make/unit-tests/sunshcmd	Wed Aug 28 21:56:50 2013
@@ -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}"

Reply via email to