- Enhance .POSIX to set -e when invoking shells, as demanded by a
[make.git] / tests / scripts / variables / undefine
blob38707b837f22db2f7ecae3fbd8a19f56de475098
1 #                                                                    -*-perl-*-
3 $description = "Test variable undefine.";
5 $details = "";
7 # TEST 0: basic undefine functionality
9 run_make_test('
10 a = a
11 b := b
12 define c
14 endef
16 $(info $(flavor a) $(flavor b) $(flavor c))
18 n := b
20 undefine a
21 undefine $n
22 undefine c
24 $(info $(flavor a) $(flavor b) $(flavor c))
27 all: ;@:
29 '', "recursive simple recursive\nundefined undefined undefined");
32 # TEST 1: override
34 run_make_test('
35 undefine a
36 override undefine b
38 $(info $(flavor a) $(flavor b))
41 all: ;@:
43 'a=a b=b', "recursive undefined");
47 # TEST 2: undefine in eval (make sure we undefine from the global var set)
49 run_make_test('
50 define undef
51 $(eval undefine $$1)
52 endef
54 a := a
55 $(call undef,a)
56 $(info $(flavor a))
59 all: ;@:
61 '', "undefined");
64 # TEST 3: Missing variable name
66 run_make_test('
67 a =
68 undefine $a
69 all: ;@echo ouch
71 '', "#MAKEFILE#:3: *** empty variable name.  Stop.\n", 512);