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
40 define cond ?= # this is a conditional
55 '', "echo hi\nhi\nthere\nfoo\na\nb\nfirst\n");
57 # TEST 2: define in true section of conditional (containing conditional)
64 define $(subst e,e,$(NAME)) =
76 # TEST 3: define in false section of conditional (containing conditional)
78 run_make_test(undef, '', "foo\n");
80 # TEST 4: nested define (supported?)
91 outer: ; @echo $(inner)
95 # TEST 5: NEGATIVE: Missing variable name
104 '', "#MAKEFILE#:3: *** empty variable name. Stop.\n", 512);
106 # TEST 6: NEGATIVE: extra text after define
110 define NAME = $(NAME)
115 '', "#MAKEFILE#:3: extraneous text after `define' directive\nok\n");
117 # TEST 7: NEGATIVE: extra text after endef
126 '', "#MAKEFILE#:5: extraneous text after `endef' directive\nok\n");
128 # TEST 8: NEGATIVE: missing endef
137 '', "#MAKEFILE#:4: *** missing `endef', unterminated `define'. Stop.\n", 512);
139 # -------------------------
140 # Make sure that prefix characters apply properly to define/endef values.
142 # There's a bit of oddness here if you try to use a variable to hold the
143 # prefix character for a define. Even though something like this:
151 # (where V=@) can be seen by the user to be obviously different than this:
159 # and the user thinks it should behave the same as when the "@" is literal
160 # instead of in a variable, that can't happen because by the time make
161 # expands the variables for the command line and sees it begins with a "@" it
162 # can't know anymore whether the prefix character came before the variable
163 # reference or was included in the first line of the variable reference.
180 run_make_test(undef, 'V1=@ V2=@', 'hello
199 run_make_test(undef, 'V2=@', 'echo hello
206 run_make_test(undef, 'V1=@ V2=@', 'hello
211 # Test the basics; a "@" internally to the variable applies to only one line.
212 # A "@" before the variable applies to the entire variable.