aboutsummaryrefslogtreecommitdiff
path: root/testcase/deprecated_var.mk
blob: 935e8f188b450f6dd73fdc710d083a21aad4b502 (plain)
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
A := test
$(KATI_deprecated_var A B C D)

$(info Writing to an undefined deprecated variable)
B := test
ifndef KATI
$(info Makefile:5: B has been deprecated.)
endif

$(info Reading from deprecated variables - set before/after/never the deprecation func)
$(info Writing to an undefined deprecated variable)
D := $(A)$(B)$(C)
ifndef KATI
$(info Makefile:12: A has been deprecated.)
$(info Makefile:12: B has been deprecated.)
$(info Makefile:12: C has been deprecated.)
$(info Makefile:12: D has been deprecated.)
endif

$(info Writing to a reset deprecated variable)
D += test
ifndef KATI
$(info Makefile:21: D has been deprecated.)
endif

$(info Using a custom message)
$(KATI_deprecated_var E,Use X instead)
E = $(C)
ifndef KATI
$(info Makefile:28: E has been deprecated. Use X instead.)
endif

$(info Expanding a recursive variable with an embedded deprecated variable)
$(E)
ifndef KATI
$(info Makefile:34: E has been deprecated. Use X instead.)
$(info Makefile:34: C has been deprecated.)
endif

$(info All of the previous variable references have been basic SymRefs, now check VarRefs)
F = E
G := $($(F))
ifndef KATI
$(info Makefile:42: E has been deprecated. Use X instead.)
$(info Makefile:42: C has been deprecated.)
endif

$(info And check VarSubst)
G := $(C:%.o=%.c)
ifndef KATI
$(info Makefile:49: C has been deprecated.)
endif

$(info Deprecated variable used in a rule-specific variable)
test: A := $(E)
ifndef KATI
$(info Makefile:55: E has been deprecated. Use X instead.)
$(info Makefile:55: C has been deprecated.)
# A hides the global A variable, so is not considered deprecated.
endif

$(info Deprecated variable used as a macro)
A := $(call B)
ifndef KATI
$(info Makefile:63: B has been deprecated.)
$(info Makefile:63: A has been deprecated.)
endif

$(info Deprecated variable used in an ifdef)
ifdef C
endif
ifndef KATI
$(info Makefile:70: C has been deprecated.)
endif

$(info Deprecated variable used in a rule)
test:
	echo $(C)Done
ifndef KATI
$(info Makefile:78: C has been deprecated.)
endif