Received: by mail.netbsd.org (Postfix, from userid 605) id DF49884E9F; Fri, 18 Nov 2022 19:35:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 1BDBD84D96 for ; Fri, 18 Nov 2022 19:35:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id eGyuXg_MPJzh for ; Fri, 18 Nov 2022 19:35:03 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 8369384CD9 for ; Fri, 18 Nov 2022 19:35:03 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 7D283FA90; Fri, 18 Nov 2022 19:35:03 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1668800103170450" MIME-Version: 1.0 Date: Fri, 18 Nov 2022 19:35:03 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/doc/guide/files To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20221118193503.7D283FA90@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1668800103170450 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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. --_----------=_1668800103170450 Content-Disposition: inline Content-Length: 2384 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii 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 @@ - + Programming in <filename>Makefile</filename>s @@ -47,13 +47,13 @@ correct: wrong will exist, although there was an error message in the first run. On the other hand, running make correct gives an error message twice, as expected. - + You might remember that &man.make.1; sometimes removes ${.TARGET} in case of error, but this only happens when it is interrupted, for example by pressing Ctrl+C. This does not happen when one of the commands fails (like &man.false.1; above). - + @@ -229,7 +229,7 @@ install-examples: # produces a syntax To fix this syntax error, use one of the snippets below. -EMPTY= # empty +EGFILES= # empty install-examples: for egfile in ${EGFILES} ""; do \ @@ -257,5 +257,27 @@ enclosed in single or double quotes.${TEST} -z ${POSSIBLY_EMPTY:Q}"". + + +Testing yes/no variables in conditions + +When a variable can have the values yes or +no, use the following pattern to test the variable: + + +.if ${VAR:U:tl} == "yes" +# do something +.endif + + +The :U modifier is only necessary if the variable +can be undefined. If the variable is guaranteed to be defined, the +:U can be omitted. + +The :tl modifier converts the variable value to +lowercase, allowing for the values yes, +Yes, YES. + + --_----------=_1668800103170450--