1
2SET_BEFORE := should_not_appear_in_output_before
3
4# Save .VARIABLES so we can filter out all the built-in stuff later
5BEFORE:=$(.VARIABLES)
6
7# Simple variable
8ONE := 1
9
10# This is := so $(1) is evaluable right now
11EVALUABLE := $(ONE)$(1)
12
13# Deferred execution with $(1), so call it a function
14LOOKS_LIKE_A_FUNCTION_1 = $(1)
15LOOKS_LIKE_A_FUNCTION_2 = $(ONE)$(1)
16
17# Deferred execution without $(1), so should not be a function
18NOT_A_FUNCTION_1 = SIMPLE_TEXT
19NOT_A_FUNCTION_2 = $(ONE)
20
21# We can't evaluate it without eval, so we assume that it *is* a function.
22THE_EDGE_CASE_1 = $($(ONE))
23THE_EDGE_CASE_2 = $($(SET_BEFORE))
24THE_EDGE_CASE_3 = asdf$($(SET_BEFORE))
25THE_EDGE_CASE_4 = $($(SET_BEFORE))fsda
26THE_EDGE_CASE_5 = fdsa$($(SET_BEFORE))fdsa
27
28# This was already set before we saved the snapshot, so it shouldn't
29# reappear
30SET_BEFORE += should_not_appear_in_output_before
31
32$(info .VARIABLES (from make): $(sort $(filter-out $(BEFORE), $(.VARIABLES))))
33$(info .VARIABLES (hard coded): BEFORE EVALUABLE LOOKS_LIKE_A_FUNCTION_1 LOOKS_LIKE_A_FUNCTION_2 NOT_A_FUNCTION_1 NOT_A_FUNCTION_2 ONE THE_EDGE_CASE_1 THE_EDGE_CASE_2 THE_EDGE_CASE_3 THE_EDGE_CASE_4 THE_EDGE_CASE_5)
34
35ifdef KATI
36$(info .KATI_SYMBOLS: $(sort $(filter-out $(BEFORE), $(.KATI_SYMBOLS))))
37else
38# Make doesn't support .VARIABLES so output the expected values manually
39# for comparison
40$(info .KATI_SYMBOLS: BEFORE EVALUABLE NOT_A_FUNCTION_1 NOT_A_FUNCTION_2 ONE)
41endif
42
43# Updating this variable should not cause it to appear
44SET_BEFORE += a_new_value