summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2005-05-15 23:37:13 +0000
committerrillig <rillig@pkgsrc.org>2005-05-15 23:37:13 +0000
commit5f838616e6375d6538da58f6e963664cd88d9959 (patch)
tree3127721e1db5115054641a934ba08c63eccd545c /regress
parenta7508407e6e4d33d98a50fd861e3581a12db173e (diff)
downloadpkgsrc-5f838616e6375d6538da58f6e963664cd88d9959.tar.gz
Added an example workaround to bug1.mk.
Diffstat (limited to 'regress')
-rw-r--r--regress/make-quoting/files/bug1.mk37
-rw-r--r--regress/make-quoting/files/bug1.out3
2 files changed, 30 insertions, 10 deletions
diff --git a/regress/make-quoting/files/bug1.mk b/regress/make-quoting/files/bug1.mk
index a1bdf7e8a23..1117cddcf00 100644
--- a/regress/make-quoting/files/bug1.mk
+++ b/regress/make-quoting/files/bug1.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bug1.mk,v 1.1 2005/05/15 22:50:13 rillig Exp $
+# $NetBSD: bug1.mk,v 1.2 2005/05/15 23:37:13 rillig Exp $
#
# This file demonstrates a parsing bug in make(1) from NetBSD-1.6.2 and
# the current pkgsrc bmake. The make from NetBSD-2.99.15 has been fixed.
@@ -7,30 +7,49 @@
# terminator for a variable and once as literal character, which is
# appended to PKG_OPTIONS.
-PKG_OPTIONS= a b c
-.for _o_ in -b -c
-_opt_:= ${_o_} # .for variables cannot be used in modifiers
+OPTIONS= a b c d
+MYOPTIONS= -b -c
+
+OPTIONS_1:= ${OPTIONS}
+.for _o_ in ${MYOPTIONS}
+_opt_:= ${_o_}
. if !empty(_opt_:M-*)
-PKG_OPTIONS:= ${PKG_OPTIONS:N${_opt_:C/-//}} # <-- the bug
+OPTIONS_1:= ${OPTIONS_1:N${_opt_:C/-//}} # <-- the bug
+. endif
+.endfor
+
+# This is a possible workaround for this bug. It defines an intermediate
+# variable that reduces the complexity of the modifier expression.
+
+OPTIONS_2:= ${OPTIONS}
+.for _o_ in ${MYOPTIONS}
+_opt_:= ${_o_}
+_popt_:= ${_o_:C/-//} # <-- workaround, part 1
+. if !empty(_opt_:M-*)
+OPTIONS_2:= ${OPTIONS_2:N${_popt_}} # <-- workaround, part 2
. endif
.endfor
PASSED?= no
# /usr/bin/make from NetBSD 2.99.15 or similar
-.if !empty(MAKE_VERSION:Mnetbsd-2005*) && ${PKG_OPTIONS} == "a"
+.if !empty(MAKE_VERSION:Mnetbsd-2005*) && ${OPTIONS_1} == "a"
PASSED= yes
# /usr/bin/make from NetBSD 1.6.2
-.elif !empty(MAKE_VERSION:Mnetbsd-20040210) && ${PKG_OPTIONS} == "a b c}}"
+.elif !empty(MAKE_VERSION:Mnetbsd-20040210) && ${OPTIONS_1} == "a b c d}}"
PASSED= yes
# bmake from pkgsrc
-.elif !empty(MAKE_VERSION:Mbmake-3.1.12*) && ${PKG_OPTIONS} == "a b c}}"
+.elif !empty(MAKE_VERSION:Mbmake-3.1.12*) && ${OPTIONS_1} == "a b c d}}"
PASSED= yes
.endif
.PHONY: all
all:
- @echo ${PASSED}
+ @echo "PASSED="${PASSED:Q}""
+.if ${PASSED} != "yes"
+ @echo "OPTIONS_1="${OPTIONS_1:Q}""
+.endif
+ @echo "OPTIONS_2="${OPTIONS_2:Q}""
diff --git a/regress/make-quoting/files/bug1.out b/regress/make-quoting/files/bug1.out
index 7cfab5b05d6..45e2d5d314a 100644
--- a/regress/make-quoting/files/bug1.out
+++ b/regress/make-quoting/files/bug1.out
@@ -1 +1,2 @@
-yes
+PASSED=yes
+OPTIONS_2=a d