Module Name:    src
Committed By:   rillig
Date:           Sat Oct 17 20:10:04 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: dep-colon.exp dep-colon.mk

Log Message:
make(1): add test for "target: source; command"


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/dep-colon.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/dep-colon.mk

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/unit-tests/dep-colon.exp
diff -u src/usr.bin/make/unit-tests/dep-colon.exp:1.1 src/usr.bin/make/unit-tests/dep-colon.exp:1.2
--- src/usr.bin/make/unit-tests/dep-colon.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/dep-colon.exp	Sat Oct 17 20:10:04 2020
@@ -1 +1,3 @@
+making target1 from source1
+making target2 from source2
 exit status 0

Index: src/usr.bin/make/unit-tests/dep-colon.mk
diff -u src/usr.bin/make/unit-tests/dep-colon.mk:1.2 src/usr.bin/make/unit-tests/dep-colon.mk:1.3
--- src/usr.bin/make/unit-tests/dep-colon.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/dep-colon.mk	Sat Oct 17 20:10:04 2020
@@ -1,8 +1,20 @@
-# $NetBSD: dep-colon.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: dep-colon.mk,v 1.3 2020/10/17 20:10:04 rillig Exp $
 #
 # Tests for the : operator in dependency declarations.
 
 # TODO: Implementation
 
-all:
-	@:;
+# In a dependency declaration line, there may be a shell command after the
+# sources.  It is separated by a semicolon.  This "feature" is required by
+# POSIX.  It is seldom used, if at all.
+all: target1
+target1: source1; @echo making ${.TARGET} from ${.ALLSRC}
+source1: .PHONY
+
+# The semicolon for separating the sources from the creation commands must
+# appear at the top-level.  The semicolons inside the :S;1;2; modifier are
+# skipped when looking for the semicolon that separates the sources from
+# the commands.
+all: target2
+target2: source${:U1:S;1;2;}; @echo making ${.TARGET} from ${.ALLSRC}
+source2: .PHONY

Reply via email to