3
$description = "Test define/endef variable assignments.";
7
# TEST 0: old-style basic define/endef
19
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
21
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
25
# TEST 1: Various new-style define/endef
33
endef # this is the end
46
define cond ?= # this is a conditional
62
"##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
64
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
65
hi\nthere\nfoo\na\nb\nfirst\n");
67
# TEST 2: define in true section of conditional (containing conditional)
74
define $(subst e,e,$(NAME)) =
86
# TEST 3: define in false section of conditional (containing conditional)
88
run_make_test(undef, '', "foo\n");
90
# TEST 4: nested define (supported?)
101
outer: ; @echo $(inner)
105
# TEST 5: NEGATIVE: Missing variable name
114
'', "#MAKEFILE#:3: *** empty variable name. Stop.
115
Command-line invocation:
116
\"$make_path -f work/variables/define.mk.4\"
119
# TEST 6: NEGATIVE: extra text after define
123
define NAME = $(NAME)
128
'', "#MAKEFILE#:3: extraneous text after `define' directive\nok\n");
130
# TEST 7: NEGATIVE: extra text after endef
139
'', "#MAKEFILE#:5: extraneous text after `endef' directive\nok\n");
141
# TEST 8: NEGATIVE: missing endef
150
'', "#MAKEFILE#:4: *** missing `endef', unterminated `define'. Stop.
151
Command-line invocation:
152
\"$make_path -f work/variables/define.mk.7\"
155
# -------------------------
156
# Make sure that prefix characters apply properly to define/endef values.
158
# There's a bit of oddness here if you try to use a variable to hold the
159
# prefix character for a define. Even though something like this:
167
# (where V=@) can be seen by the user to be obviously different than this:
175
# and the user thinks it should behave the same as when the "@" is literal
176
# instead of in a variable, that can't happen because by the time make
177
# expands the variables for the command line and sees it begins with a "@" it
178
# can't know anymore whether the prefix character came before the variable
179
# reference or was included in the first line of the variable reference.
196
run_make_test(undef, 'V1=@ V2=@', 'hello
209
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
211
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
217
run_make_test(undef, 'V2=@', '##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
219
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
226
run_make_test(undef, 'V1=@ V2=@', 'hello
231
# Test the basics; a "@" internally to the variable applies to only one line.
232
# A "@" before the variable applies to the entire variable.
248
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
250
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<