| 1 |
# -*-perl-*- |
| 2 |
|
| 3 |
$description = "\ |
| 4 |
This tests random features of make's algorithms, often somewhat obscure, |
| 5 |
which have either broken at some point in the past or seem likely to |
| 6 |
break."; |
| 7 |
|
| 8 |
run_make_test(' |
| 9 |
# Make sure that subdirectories built as prerequisites are actually handled |
| 10 |
# properly. |
| 11 |
|
| 12 |
all: dir/subdir/file.a |
| 13 |
|
| 14 |
dir/subdir: ; @echo mkdir -p dir/subdir |
| 15 |
|
| 16 |
dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b |
| 17 |
|
| 18 |
dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@', |
| 19 |
'', "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n"); |
| 20 |
|
| 21 |
# Test implicit rules |
| 22 |
|
| 23 |
&touch('foo.c'); |
| 24 |
run_make_test('foo: foo.o', |
| 25 |
'CC="@echo cc" OUTPUT_OPTION=', |
| 26 |
'cc -c foo.c |
| 27 |
cc foo.o -o foo'); |
| 28 |
unlink('foo.c'); |
| 29 |
|
| 30 |
|
| 31 |
# Test implicit rules with '$' in the name (see se_implicit) |
| 32 |
|
| 33 |
run_make_test(q! |
| 34 |
%.foo : baz$$bar ; @echo 'done $<' |
| 35 |
%.foo : bar$$baz ; @echo 'done $<' |
| 36 |
test.foo: |
| 37 |
baz$$bar bar$$baz: ; @echo '$@' |
| 38 |
!, |
| 39 |
'', |
| 40 |
"baz\$bar\ndone baz\$bar"); |
| 41 |
|
| 42 |
|
| 43 |
# Test implicit rules with '$' in the name (see se_implicit) |
| 44 |
# Use the '$' in the pattern. |
| 45 |
|
| 46 |
run_make_test(q! |
| 47 |
%.foo : %$$bar ; @echo 'done $<' |
| 48 |
test.foo: |
| 49 |
test$$bar: ; @echo '$@' |
| 50 |
!, |
| 51 |
'', |
| 52 |
"test\$bar\ndone test\$bar"); |
| 53 |
|
| 54 |
# Make sure that subdirectories built as prerequisites are actually handled |
| 55 |
# properly... this time with '$' |
| 56 |
|
| 57 |
run_make_test(q! |
| 58 |
|
| 59 |
all: dir/subdir/file.$$a |
| 60 |
|
| 61 |
dir/subdir: ; @echo mkdir -p '$@' |
| 62 |
|
| 63 |
dir/subdir/file.$$b: dir/subdir ; @echo touch '$@' |
| 64 |
|
| 65 |
dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@' |
| 66 |
!, |
| 67 |
'', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n"); |
| 68 |
|
| 69 |
# Test odd whitespace at the beginning of a line |
| 70 |
|
| 71 |
run_make_test(" |
| 72 |
all: |
| 73 |
\f |
| 74 |
|
| 75 |
\\ |
| 76 |
\f \\ |
| 77 |
\013 \\ |
| 78 |
all: ; \@echo hi |
| 79 |
", |
| 80 |
'', "hi\n"); |
| 81 |
|
| 82 |
1; |