summaryrefslogtreecommitdiff
path: root/tests/scripts/variables/special
blob: a1e15c22cb6ccda4d0009f151130341704d8cf3b (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#                                                                    -*-perl-*-

$description = "Test special GNU make variables.";

$details = "";

&run_make_test('

X1 := $(sort $(filter FOO BAR,$(.VARIABLES)))

FOO := foo

X2 := $(sort $(filter FOO BAR,$(.VARIABLES)))

BAR := bar

all:
	@echo X1 = $(X1)
	@echo X2 = $(X2)
	@echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES)))
',
               '', "X1 =\nX2 = FOO\nLAST = BAR FOO\n");



# $makefile2 = &get_tmpfile;
# open(MAKEFILE, "> $makefile2");

# print MAKEFILE <<'EOF';

# X1 := $(sort $(.TARGETS))

# all: foo
# 	@echo X1 = $(X1)
# 	@echo X2 = $(X2)
# 	@echo LAST = $(sort $(.TARGETS))

# X2 := $(sort $(.TARGETS))

# foo:

# EOF

# close(MAKEFILE);

# # TEST #2
# # -------

# &run_make_with_options($makefile2, "", &get_logfile);
# $answer = "X1 =\nX2 = all\nLAST = all foo\n";
# &compare_output($answer, &get_logfile(1));

# Test the .RECIPEPREFIX variable
&run_make_test('
define foo
: foo-one \
foo-two
: foo-three
	: foo-four
endef

orig: ; : orig-one
	: orig-two \
orig-three \
	orig-four \
		orig-five \\\\
	: orig-six
	$(foo)

.RECIPEPREFIX = >
test: ; : test-one
>: test-two \
test-three \
>test-four \
>	test-five \\\\
>: test-six
>$(foo)

.RECIPEPREFIX =
reset: ; : reset-one
	: reset-two \
reset-three \
	reset-four \
		reset-five \\\\
	: reset-six
	$(foo)
',
               'orig test reset',
               ': orig-one
: orig-two \
orig-three \
orig-four \
	orig-five \\\\
: orig-six
: foo-one foo-two
: foo-three
: foo-four
: test-one
: test-two \
test-three \
test-four \
	test-five \\\\
: test-six
: foo-one foo-two
: foo-three
: foo-four
: reset-one
: reset-two \
reset-three \
reset-four \
	reset-five \\\\
: reset-six
: foo-one foo-two
: foo-three
: foo-four');

1;