blob: 33a1c456a4d8a8b556ba87bbb407bd63ae2472cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# $NetBSD: bug1.mk,v 1.3 2006/05/10 17:35:58 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.
#
# The bug is that one of the closing braces is parsed twice -- once as
# terminator for a variable and once as literal character, which is
# appended to PKG_OPTIONS.
OPTIONS= a b c d
MYOPTIONS= -b -c
OPTIONS_1:= ${OPTIONS}
.for _o_ in ${MYOPTIONS}
_opt_:= ${_o_}
. if !empty(_opt_:M-*)
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*) && ${OPTIONS_1} == "a d"
PASSED= yes
# /usr/bin/make from NetBSD 1.6.2
.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*) && ${OPTIONS_1} == "a b c d}}"
PASSED= yes
.else
PASSED= no (MAKE_VERSION=${MAKE_VERSION})
.endif
.PHONY: all
all:
@echo "PASSED="${PASSED:Q}""
.if ${PASSED} != "yes"
@echo "OPTIONS_1="${OPTIONS_1:Q}""
.endif
@echo "OPTIONS_2="${OPTIONS_2:Q}""
|