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
|
# -*-perl-*-
$description = "Test pattern-specific variable settings.";
$details = "\
Create a makefile containing various flavors of pattern-specific variable
settings, override and non-override, and using various variable expansion
rules, semicolon interference, etc.";
open(MAKEFILE,"> $makefile");
print MAKEFILE <<'EOF';
all: one.x two.x three.x
FOO = foo
BAR = bar
BAZ = baz
thr% : override BAZ = three
t%.x: BAR = four
%.x: BAR = two
%.x: override BAZ = three
one.x: override FOO = one
one.x two.x three.x: ; @echo $(FOO) $(BAR) $(BAZ)
four.x: baz ; @echo $(FOO) $(BAR) $(BAZ)
baz: ; @echo $(FOO) $(BAR) $(BAZ)
EOF
close(MAKEFILE);
# TEST #1 -- basics
&run_make_with_options($makefile, "", &get_logfile);
$answer = "one two three\nfoo four baz\nfoo bar three\n";
&compare_output($answer,&get_logfile(1));
# TEST #2 -- try the override feature
&run_make_with_options($makefile, "BAZ=five", &get_logfile);
$answer = "one two three\nfoo four five\nfoo bar three\n";
&compare_output($answer,&get_logfile(1));
# TEST #3 -- make sure patterns are inherited properly
&run_make_with_options($makefile, "four.x", &get_logfile);
$answer = "foo two three\nfoo two three\n";
&compare_output($answer,&get_logfile(1));
1;
|