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