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
|
# -*-perl-*-
$description = "Test various flavors of make variable setting.";
$details = "";
open(MAKEFILE, "> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<'EOF';
foo = $(bar)
bar = ${ugh}
ugh = Hello
all: multi ; @echo $(foo)
multi: ; $(multi)
x := foo
y := $(x) bar
x := later
nullstring :=
space := $(nullstring) $(nullstring)
next: ; @echo $x$(space)$y
define multi
@echo hi
echo there
endef
ifdef BOGUS
define
@echo error
endef
endif
define outer
define inner
A = B
endef
endef
$(eval $(outer))
outer: ; @echo $(inner)
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
# TEST #1
# -------
&run_make_with_options($makefile, "", &get_logfile);
$answer = "hi\necho there\nthere\nHello\n";
&compare_output($answer, &get_logfile(1));
# TEST #2
# -------
&run_make_with_options($makefile, "next", &get_logfile);
$answer = "later foo bar\n";
&compare_output($answer, &get_logfile(1));
# TEST #3
# -------
&run_make_with_options($makefile, "BOGUS=true", &get_logfile, 512);
$answer = "$makefile:23: *** empty variable name. Stop.\n";
&compare_output($answer, &get_logfile(1));
# TEST #4
# -------
&run_make_with_options($makefile, "outer", &get_logfile);
$answer = "A = B\n";
&compare_output($answer, &get_logfile(1));
1;
|