3 $description = "Test define/endef variable assignments.";
7 # TEST 0: old-style basic define/endef
17 '', "hi\necho there\nthere\n");
19 # TEST 1: Various new-style define/endef
27 endef # this is the end
44 define cond ?= # this is a conditional
60 '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n");
62 # TEST 1a: Various new-style define/endef, with no spaces
70 endef # this is the end
87 define cond?= # this is a conditional
103 '', "echo hi\nhi\nthere\nfoo\nfoo\na\nb\nfirst\n");
105 # TEST 2: define in true section of conditional (containing conditional)
112 define $(subst e,e,$(NAME)) =
124 # TEST 3: define in false section of conditional (containing conditional)
126 run_make_test(undef, '', "foo\n");
128 # TEST 4: nested define (supported?)
139 outer: ; @echo $(inner)
143 # TEST 5: NEGATIVE: Missing variable name
152 '', "#MAKEFILE#:3: *** empty variable name. Stop.\n", 512);
154 # TEST 6: NEGATIVE: extra text after define
158 define NAME = $(NAME)
163 '', "#MAKEFILE#:3: extraneous text after `define' directive\nok\n");
165 # TEST 7: NEGATIVE: extra text after endef
174 '', "#MAKEFILE#:5: extraneous text after `endef' directive\nok\n");
176 # TEST 8: NEGATIVE: missing endef
185 '', "#MAKEFILE#:4: *** missing `endef', unterminated `define'. Stop.\n", 512);
187 # -------------------------
188 # Make sure that prefix characters apply properly to define/endef values.
190 # There's a bit of oddness here if you try to use a variable to hold the
191 # prefix character for a define. Even though something like this:
199 # (where V=@) can be seen by the user to be obviously different than this:
207 # and the user thinks it should behave the same as when the "@" is literal
208 # instead of in a variable, that can't happen because by the time make
209 # expands the variables for the command line and sees it begins with a "@" it
210 # can't know anymore whether the prefix character came before the variable
211 # reference or was included in the first line of the variable reference.
228 run_make_test(undef, 'V1=@ V2=@', 'hello
247 run_make_test(undef, 'V2=@', 'echo hello
254 run_make_test(undef, 'V1=@ V2=@', 'hello
259 # Test the basics; a "@" internally to the variable applies to only one line.
260 # A "@" before the variable applies to the entire variable.