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): move documentation for assignment modi...



details:   https://anonhg.NetBSD.org/src/rev/4f6d16b23393
branches:  trunk
changeset: 936175:4f6d16b23393
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 20 16:12:52 2020 +0000

description:
make(1): move documentation for assignment modifiers

diffstat:

 usr.bin/make/var.c |  48 +++++++++++++++++++++++++-----------------------
 1 files changed, 25 insertions(+), 23 deletions(-)

diffs (82 lines):

diff -r 42c29d0a8768 -r 4f6d16b23393 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Jul 20 16:12:02 2020 +0000
+++ b/usr.bin/make/var.c        Mon Jul 20 16:12:52 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.282 2020/07/20 15:48:50 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.283 2020/07/20 16:12:52 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2914,7 +2914,27 @@
     return TRUE;
 }
 
-/* "::=", "::!=", "::+=", or "::?=" */
+/*
+ * The ::= modifiers actually assign a value to the variable.
+ * Their main purpose is in supporting modifiers of .for loop
+ * iterators and other obscure uses.  They always expand to
+ * nothing.  In a target rule that would otherwise expand to an
+ * empty line they can be preceded with @: to keep make happy.
+ * Eg.
+ *
+ * foo:        .USE
+ * .for i in ${.TARGET} ${.TARGET:R}.gz
+ *     @: ${t::=$i}
+ *     @echo blah ${t:T}
+ * .endfor
+ *
+ *       ::=<str>      Assigns <str> as the new value of variable.
+ *       ::?=<str>     Assigns <str> as value of variable if
+ *                     it was not already set.
+ *       ::+=<str>     Appends <str> to variable.
+ *       ::!=<cmd>     Assigns output of <cmd> as the new value of
+ *                     variable.
+ */
 static int
 ApplyModifier_Assign(ApplyModifiersState *st)
 {
@@ -3158,25 +3178,7 @@
  *                     the form '${x:P}'.
  *       :!<cmd>!      Run cmd much the same as :sh run's the
  *                     current value of the variable.
- * The ::= modifiers, actually assign a value to the variable.
- * Their main purpose is in supporting modifiers of .for loop
- * iterators and other obscure uses.  They always expand to
- * nothing.  In a target rule that would otherwise expand to an
- * empty line they can be preceded with @: to keep make happy.
- * Eg.
- *
- * foo:        .USE
- * .for i in ${.TARGET} ${.TARGET:R}.gz
- *     @: ${t::=$i}
- *     @echo blah ${t:T}
- * .endfor
- *
- *       ::=<str>      Assigns <str> as the new value of variable.
- *       ::?=<str>     Assigns <str> as value of variable if
- *                     it was not already set.
- *       ::+=<str>     Appends <str> to variable.
- *       ::!=<cmd>     Assigns output of <cmd> as the new value of
- *                     variable.
+ * Assignment operators (see ApplyModifier_Assign).
  */
 static char *
 ApplyModifiers(char *nstr, const char *tstr,



Home | Main Index | Thread Index | Old Index