Imported Upstream version 3.82
[platform/upstream/make.git] / tests / scripts / variables / undefine
1 #                                                                    -*-perl-*-
2
3 $description = "Test variable undefine.";
4
5 $details = "";
6
7 # TEST 0: basic undefine functionality
8
9 run_make_test('
10 a = a
11 b := b
12 define c
13 c
14 endef
15
16 $(info $(flavor a) $(flavor b) $(flavor c))
17
18 n := b
19
20 undefine a
21 undefine $n
22 undefine c
23
24 $(info $(flavor a) $(flavor b) $(flavor c))
25
26
27 all: ;@:
28 ',
29 '', "recursive simple recursive\nundefined undefined undefined");
30
31
32 # TEST 1: override
33
34 run_make_test('
35 undefine a
36 override undefine b
37
38 $(info $(flavor a) $(flavor b))
39
40
41 all: ;@:
42 ',
43 'a=a b=b', "recursive undefined");
44
45 1;
46
47 # TEST 2: undefine in eval (make sure we undefine from the global var set)
48
49 run_make_test('
50 define undef
51 $(eval undefine $$1)
52 endef
53
54 a := a
55 $(call undef,a)
56 $(info $(flavor a))
57
58
59 all: ;@:
60 ',
61 '', "undefined");
62
63
64 # TEST 3: Missing variable name
65
66 run_make_test('
67 a =
68 undefine $a
69 all: ;@echo ouch
70 ',
71 '', "#MAKEFILE#:3: *** empty variable name.  Stop.\n", 512);
72
73 1;