pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/doc/guide/files
Module Name: pkgsrc
Committed By: rillig
Date: Fri Nov 18 19:35:03 UTC 2022
Modified Files:
pkgsrc/doc/guide/files: makefile.xml
Log Message:
guide: document how to test yes/no variables
https://mail-index.netbsd.org/tech-pkg/2022/11/16/msg026992.html
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 pkgsrc/doc/guide/files/makefile.xml
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/doc/guide/files/makefile.xml
diff -u pkgsrc/doc/guide/files/makefile.xml:1.30 pkgsrc/doc/guide/files/makefile.xml:1.31
--- pkgsrc/doc/guide/files/makefile.xml:1.30 Sun Apr 28 11:16:07 2019
+++ pkgsrc/doc/guide/files/makefile.xml Fri Nov 18 19:35:03 2022
@@ -1,4 +1,4 @@
-<!-- $NetBSD: makefile.xml,v 1.30 2019/04/28 11:16:07 rillig Exp $ -->
+<!-- $NetBSD: makefile.xml,v 1.31 2022/11/18 19:35:03 rillig Exp $ -->
<chapter id="makefile"> <?dbhtml filename="makefile.html"?>
<title>Programming in <filename>Makefile</filename>s</title>
@@ -47,13 +47,13 @@ correct:
<filename>wrong</filename> will exist, although there was an error
message in the first run. On the other hand, running <command>make
correct</command> gives an error message twice, as expected.</para>
-
+
<para>You might remember that &man.make.1; sometimes removes
<literal>${.TARGET}</literal> in case of error, but this only
happens when it is interrupted, for example by pressing
<literal>Ctrl+C</literal>. This does <emphasis>not</emphasis> happen
when one of the commands fails (like &man.false.1; above).</para>
-
+
</listitem>
</itemizedlist>
</sect1>
@@ -229,7 +229,7 @@ install-examples: # produces a syntax
To fix this syntax error, use one of the snippets below.</para>
<programlisting>
-EMPTY= # empty
+EGFILES= # empty
install-examples:
for egfile in ${EGFILES} ""; do \
@@ -257,5 +257,27 @@ enclosed in single or double quotes.</pa
the following code: <code>${TEST} -z ${POSSIBLY_EMPTY:Q}""</code>.</para>
</sect2>
+
+<sect2 id="makefile.yesno">
+<title>Testing yes/no variables in conditions</title>
+
+<para>When a variable can have the values <literal>yes</literal> or
+<literal>no</literal>, use the following pattern to test the variable:</para>
+
+<programlisting>
+.if ${VAR:U:tl} == "yes"
+# do something
+.endif
+</programlisting>
+
+<para>The <literal>:U</literal> modifier is only necessary if the variable
+can be undefined. If the variable is guaranteed to be defined, the
+<literal>:U</literal> can be omitted.</para>
+
+<para>The <literal>:tl</literal> modifier converts the variable value to
+lowercase, allowing for the values <literal>yes</literal>,
+<literal>Yes</literal>, <literal>YES</literal>.</para>
+
+</sect2>
</sect1>
</chapter>
Home |
Main Index |
Thread Index |
Old Index