pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Add yesno.mk, a stab at standardizing YES and NO.



Module Name:	pkgsrc-wip
Committed By:	Christian Koch <cfkoch%edgebsd.org@localhost>
Pushed By:	cfkoch
Date:		Sun Nov 13 23:32:15 2016 -0800
Changeset:	42144b26de4e201e80d6cd539f9d128670b64284

Modified Files:
	mk/DESC
Added Files:
	mk/yesno.mk

Log Message:
Add yesno.mk, a stab at standardizing YES and NO.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=42144b26de4e201e80d6cd539f9d128670b64284

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

diffstat:
 mk/DESC     |  6 ++++++
 mk/yesno.mk | 15 +++++++++++++++
 2 files changed, 21 insertions(+)

diffs:
diff --git a/mk/DESC b/mk/DESC
index 4a2e3f9..3266e50 100644
--- a/mk/DESC
+++ b/mk/DESC
@@ -43,3 +43,9 @@ haskell.mk - generalised .mk file for Haskell Cabal packages.
 git-package.mk   -  retrieve sources from git repositories, much like
 		    svn-package.mk and cvs-package.mk handle SVN and CVS
 		    repositories. 
+
+yesno.mk - Standardizes how to specify boolean values in Makefiles, both
+   internally and in individual package Makefiles. Makes "yes" and "no"
+   universal and actual first-class words (there's nothing special about
+   them otherwise).  Eliminates subtle inconsistencies (does this variable
+   support "YES" uppercase or not?) and significantly DRYs up code.
diff --git a/mk/yesno.mk b/mk/yesno.mk
new file mode 100644
index 0000000..8ae9567
--- /dev/null
+++ b/mk/yesno.mk
@@ -0,0 +1,15 @@
+# $NetBSD$
+#
+# This Makefile fragment defines how to users can specify something should
+# be enabled and/or disabled. For example, you can test if a variable `FOO'
+# is turned "on" like so:
+#
+#     .if defined(FOO) && !empty(FOO:M${YES})
+
+.ifndef YESNO_MK
+YESNO_MK=	# defined
+
+YES=		[Yy][Ee][Ss]
+NO=		[Nn][Oo]
+
+.endif		# YESNO_MK


Home | Main Index | Thread Index | Old Index