File: undefine

package info (click to toggle)
make-doc-non-dfsg 4.4.1-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid, trixie
  • size: 9,632 kB
  • sloc: ansic: 31,255; sh: 5,213; perl: 1,612; makefile: 160; lisp: 26; sed: 16
file content (91 lines) | stat: -rw-r--r-- 1,205 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#                                                                    -*-perl-*-

$description = "Test variable undefine.";

$details = "";

# TEST 0: basic undefine functionality

run_make_test('
a = a
b := b
define c
c
endef

$(info $(flavor a) $(flavor b) $(flavor c))

n := b

undefine a
undefine $n
undefine c

$(info $(flavor a) $(flavor b) $(flavor c))


all: ;@:
',
'', "recursive simple recursive\nundefined undefined undefined");


# TEST 1: override

run_make_test('
undefine a
override undefine b

$(info $(flavor a) $(flavor b))


all: ;@:
',
'a=a b=b', "recursive undefined");

1;

# TEST 2: undefine in eval (make sure we undefine from the global var set)

run_make_test('
define undef
$(eval undefine $$1)
endef

a := a
$(call undef,a)
$(info $(flavor a))


all: ;@:
',
'', "undefined");


# TEST 3: Missing variable name

run_make_test('
a =
undefine $a
all: ;@echo ouch
',
'', "#MAKEFILE#:3: *** empty variable name.  Stop.\n", 512);

# Ensure that define can be a target when not appearing in a variable
# definition context.  See SV 59870

run_make_test(q!
undefine = undefine

$(undefine) : ;@echo $@

%:undefine

all: undefine foo

%.x : undefine

foo:;
!,
    '', "undefine\n");

1;