| 1 |
# -*-perl-*- |
| 2 |
$description = "Test handling of static pattern rules."; |
| 3 |
|
| 4 |
$details = "\ |
| 5 |
The makefile created in this test has three targets. The |
| 6 |
filter command is used to get those target names ending in |
| 7 |
.o and statically creates a compile command with the target |
| 8 |
name and the target name with .c. It also does the same thing |
| 9 |
for another target filtered with .elc and creates a command |
| 10 |
to emacs a .el file"; |
| 11 |
|
| 12 |
&touch('bar.c', 'lose.c'); |
| 13 |
|
| 14 |
# TEST #0 |
| 15 |
# ------- |
| 16 |
|
| 17 |
run_make_test(' |
| 18 |
files = foo.elc bar.o lose.o |
| 19 |
|
| 20 |
$(filter %.o,$(files)): %.o: %.c ; @echo CC -c $(CFLAGS) $< -o $@ |
| 21 |
|
| 22 |
$(filter %.elc,$(files)): %.elc: %.el ; @echo emacs $< |
| 23 |
', |
| 24 |
'', |
| 25 |
'CC -c bar.c -o bar.o'); |
| 26 |
|
| 27 |
# TEST #1 |
| 28 |
# ------- |
| 29 |
|
| 30 |
run_make_test(undef, 'lose.o', 'CC -c lose.c -o lose.o'); |
| 31 |
|
| 32 |
|
| 33 |
# TEST #2 |
| 34 |
# ------- |
| 35 |
&touch("foo.el"); |
| 36 |
|
| 37 |
run_make_test(undef, 'foo.elc', 'emacs foo.el'); |
| 38 |
|
| 39 |
# Clean up after the first tests. |
| 40 |
unlink('foo.el', 'bar.c', 'lose.c'); |
| 41 |
|
| 42 |
|
| 43 |
# TEST #3 -- PR/1670: don't core dump on invalid static pattern rules |
| 44 |
# ------- |
| 45 |
|
| 46 |
run_make_test(' |
| 47 |
.DEFAULT: ; @echo $@ |
| 48 |
foo: foo%: % %.x % % % y.% % ; @echo $@ |
| 49 |
', |
| 50 |
'', ".x\ny.\nfoo"); |
| 51 |
|
| 52 |
|
| 53 |
# TEST #4 -- bug #12180: core dump on a stat pattern rule with an empty |
| 54 |
# prerequisite list. |
| 55 |
run_make_test(' |
| 56 |
foo.x bar.x: %.x : ; @echo $@ |
| 57 |
|
| 58 |
', |
| 59 |
'', 'foo.x'); |
| 60 |
|
| 61 |
|
| 62 |
# TEST #5 -- bug #13881: double colon static pattern rule does not |
| 63 |
# substitute %. |
| 64 |
run_make_test(' |
| 65 |
foo.bar:: %.bar: %.baz |
| 66 |
foo.baz: ;@: |
| 67 |
', |
| 68 |
'', ''); |
| 69 |
|
| 70 |
|
| 71 |
# TEST #6: make sure the second stem does not overwrite the first |
| 72 |
# perprerequisite's stem (Savannah bug #16053). |
| 73 |
# |
| 74 |
run_make_test(' |
| 75 |
all.foo.bar: %.foo.bar: %.one |
| 76 |
|
| 77 |
all.foo.bar: %.bar: %.two |
| 78 |
|
| 79 |
all.foo.bar: |
| 80 |
@echo $* |
| 81 |
@echo $^ |
| 82 |
|
| 83 |
.DEFAULT:;@: |
| 84 |
', |
| 85 |
'', |
| 86 |
'all.foo |
| 87 |
all.one all.foo.two'); |
| 88 |
|
| 89 |
|
| 90 |
# TEST #7: make sure the second stem does not overwrite the first |
| 91 |
# perprerequisite's stem when second expansion is enabled |
| 92 |
# (Savannah bug #16053). |
| 93 |
# |
| 94 |
run_make_test(' |
| 95 |
.SECONDEXPANSION: |
| 96 |
|
| 97 |
all.foo.bar: %.foo.bar: %.one $$*-one |
| 98 |
|
| 99 |
all.foo.bar: %.bar: %.two $$*-two |
| 100 |
|
| 101 |
all.foo.bar: |
| 102 |
@echo $* |
| 103 |
@echo $^ |
| 104 |
|
| 105 |
.DEFAULT:;@: |
| 106 |
', |
| 107 |
'', |
| 108 |
'all.foo |
| 109 |
all.one all-one all.foo.two all.foo-two'); |
| 110 |
|
| 111 |
1; |