summaryrefslogtreecommitdiff
path: root/tests/scripts/misc/general4
blob: 6d42a16dcb07f371241f941f1341196775237556 (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
#                                                                    -*-perl-*-

$description = "\
This tests random features of make's algorithms, often somewhat obscure,
which have either broken at some point in the past or seem likely to
break.";

run_make_test('
# Make sure that subdirectories built as prerequisites are actually handled
# properly.

all: dir/subdir/file.a

dir/subdir: ; @echo mkdir -p dir/subdir

dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b

dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@',
              '', "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n");

# Test implicit rules

&touch('foo.c');
run_make_test('foo: foo.o',
              'CC="@echo cc" OUTPUT_OPTION=',
              'cc -c foo.c
cc foo.o -o foo');
unlink('foo.c');


# Test implicit rules with '$' in the name (see se_implicit)

run_make_test(q!
%.foo : baz$$bar ; @echo 'done $<'
%.foo : bar$$baz ; @echo 'done $<'
test.foo:
baz$$bar bar$$baz: ; @echo '$@'
!,
              '',
              "baz\$bar\ndone baz\$bar");


# Test implicit rules with '$' in the name (see se_implicit)
# Use the '$' in the pattern.

run_make_test(q!
%.foo : %$$bar ; @echo 'done $<'
test.foo:
test$$bar: ; @echo '$@'
!,
              '',
              "test\$bar\ndone test\$bar");

# Make sure that subdirectories built as prerequisites are actually handled
# properly... this time with '$'

run_make_test(q!

all: dir/subdir/file.$$a

dir/subdir: ; @echo mkdir -p '$@'

dir/subdir/file.$$b: dir/subdir ; @echo touch '$@'

dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@'
!,
              '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n");

# Test odd whitespace at the beginning of a line

run_make_test("
all:
   \f

    \\
 \f  \\
    \013 \\
all: ; \@echo hi
",
              '', "hi\n");

1;