aboutsummaryrefslogtreecommitdiffstats
path: root/testcase/deprecated_var.mk
blob: 2cacbda3749d7529fa9f6e011793a3fca1b3d74d (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
# TODO(go): not implemented


A := test
$(KATI_deprecated_var A B C D)

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

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

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

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

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

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

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

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

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