| @@ -1,22 +1,23 @@ | | | @@ -1,22 +1,23 @@ |
1 | # $Id: varmisc.mk,v 1.15 2020/07/26 20:30:42 rillig Exp $ | | 1 | # $Id: varmisc.mk,v 1.16 2020/07/26 21:09:49 rillig Exp $ |
2 | # | | 2 | # |
3 | # Miscellaneous variable tests. | | 3 | # Miscellaneous variable tests. |
4 | | | 4 | |
5 | all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \ | | 5 | all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \ |
6 | strftime cmpv manok | | 6 | strftime cmpv manok |
7 | all: save-dollars | | 7 | all: save-dollars |
8 | all: export-appended | | 8 | all: export-appended |
9 | all: parse-dynamic | | 9 | all: parse-dynamic |
| | | 10 | all: varerror-unclosed |
10 | | | 11 | |
11 | unmatched_var_paren: | | 12 | unmatched_var_paren: |
12 | @echo ${foo::=foo-text} | | 13 | @echo ${foo::=foo-text} |
13 | | | 14 | |
14 | True = ${echo true >&2:L:sh}TRUE | | 15 | True = ${echo true >&2:L:sh}TRUE |
15 | False= ${echo false >&2:L:sh}FALSE | | 16 | False= ${echo false >&2:L:sh}FALSE |
16 | | | 17 | |
17 | VSET= is set | | 18 | VSET= is set |
18 | .undef UNDEF | | 19 | .undef UNDEF |
19 | | | 20 | |
20 | U_false: | | 21 | U_false: |
21 | @echo :U skipped when var set | | 22 | @echo :U skipped when var set |
22 | @echo ${VSET:U${False}} | | 23 | @echo ${VSET:U${False}} |
| @@ -164,13 +165,22 @@ export-appended: | | | @@ -164,13 +165,22 @@ export-appended: |
164 | # the global context. They are preserved until there is a local context | | 165 | # the global context. They are preserved until there is a local context |
165 | # in which resolving them makes sense. | | 166 | # in which resolving them makes sense. |
166 | | | 167 | |
167 | ${:U>}= before | | 168 | ${:U>}= before |
168 | G_TARGET:= $@ | | 169 | G_TARGET:= $@ |
169 | G_MEMBER:= $% | | 170 | G_MEMBER:= $% |
170 | G_PREFIX:= $* | | 171 | G_PREFIX:= $* |
171 | G_ARCHIVE:= $! | | 172 | G_ARCHIVE:= $! |
172 | G_ALLSRC:= $> | | 173 | G_ALLSRC:= $> |
173 | ${:U>}= after | | 174 | ${:U>}= after |
174 | | | 175 | |
175 | parse-dynamic: | | 176 | parse-dynamic: |
176 | @echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC} | | 177 | @echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC} |
| | | 178 | |
| | | 179 | # As of 2020-07-26, make does not complain about unclosed variables. |
| | | 180 | # It does complain about unclosed variables when parsing modifiers though. |
| | | 181 | varerror-unclosed: |
| | | 182 | @echo $@:begin |
| | | 183 | @echo ${UNCLOSED |
| | | 184 | @echo ${UNCLOSED:M${PATTERN |
| | | 185 | @echo ${UNCLOSED.${param |
| | | 186 | @echo $@:end |