mirror of
https://github.com/mirror/make.git
synced 2025-01-11 04:40:30 +08:00
79 lines
1.3 KiB
Plaintext
79 lines
1.3 KiB
Plaintext
|
# -*-perl-*-
|
||
|
|
||
|
$description = "Test suffix rules.";
|
||
|
|
||
|
$details = "";
|
||
|
|
||
|
# TEST #0: Clear all suffixes
|
||
|
|
||
|
touch('foo.c');
|
||
|
|
||
|
run_make_test(q!
|
||
|
.SUFFIXES:
|
||
|
all: foo.o ; @echo $@ $<
|
||
|
!,
|
||
|
'', "#MAKE#: *** No rule to make target 'foo.o', needed by 'all'. Stop.\n", 512);
|
||
|
|
||
|
unlink('foo.c');
|
||
|
|
||
|
# Test #1: Add a simple suffix rule
|
||
|
|
||
|
touch('foo.baz');
|
||
|
|
||
|
run_make_test(q!
|
||
|
.SUFFIXES: .biz .baz
|
||
|
|
||
|
.baz.biz: ; @echo make $@
|
||
|
!,
|
||
|
'foo.biz', "make foo.biz\n");
|
||
|
|
||
|
unlink('foo.baz');
|
||
|
|
||
|
# Test #2: Make sure the defaults still work
|
||
|
|
||
|
touch('foo.c');
|
||
|
|
||
|
run_make_test(undef, 'foo.o COMPILE.c=@echo OUTPUT_OPTION=', "foo.c\n");
|
||
|
|
||
|
unlink('foo.c');
|
||
|
|
||
|
# Test #3: Replacing all suffixes
|
||
|
|
||
|
touch('foo.baz');
|
||
|
|
||
|
run_make_test(q!
|
||
|
.SUFFIXES:
|
||
|
.SUFFIXES: .biz .baz
|
||
|
|
||
|
.baz.biz: ; @echo make $@
|
||
|
!,
|
||
|
'foo.biz', "make foo.biz\n");
|
||
|
|
||
|
unlink('foo.baz');
|
||
|
|
||
|
# Test #4: Suffix rules with deps are not suffix rules
|
||
|
|
||
|
touch('foo.bar');
|
||
|
|
||
|
run_make_test(q!
|
||
|
.SUFFIXES:
|
||
|
.SUFFIXES: .biz .baz
|
||
|
|
||
|
.baz.biz: foo.bar ; @echo make $@ from $<
|
||
|
!,
|
||
|
'.baz.biz', "make .baz.biz from foo.bar\n");
|
||
|
|
||
|
unlink('foo.bar');
|
||
|
|
||
|
# Test #5: Should not create pattern rules for it either
|
||
|
|
||
|
touch('foo.baz');
|
||
|
|
||
|
run_make_test(undef,
|
||
|
'foo.biz', "#MAKE#: *** No rule to make target 'foo.biz'. Stop.\n", 512);
|
||
|
|
||
|
unlink('foo.baz');
|
||
|
|
||
|
# Complete
|
||
|
1;
|