mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-01-01 01:33:51 +00:00
99 lines
1.3 KiB
Perl
99 lines
1.3 KiB
Perl
# -*-perl-*-
|
|
|
|
$description = "Test pattern rules.";
|
|
|
|
$details = "";
|
|
|
|
use Cwd;
|
|
|
|
$dir = cwd;
|
|
$dir =~ s,.*/([^/]+)$,../$1,;
|
|
|
|
|
|
# TEST #1: Make sure that multiple patterns where the same target
|
|
# can be built are searched even if the first one fails
|
|
# to match properly.
|
|
#
|
|
|
|
run_make_test('
|
|
.PHONY: all
|
|
|
|
all: case.1 case.2 case.3
|
|
a: void
|
|
|
|
# 1 - existing file
|
|
%.1: void
|
|
@false
|
|
%.1: #MAKEFILE#
|
|
@true
|
|
|
|
# 2 - phony
|
|
%.2: void
|
|
@false
|
|
%.2: 2.phony
|
|
@true
|
|
.PHONY: 2.phony
|
|
|
|
# 3 - implicit-phony
|
|
%.3: void
|
|
@false
|
|
%.3: 3.implicit-phony
|
|
@true
|
|
|
|
3.implicit-phony:
|
|
',
|
|
'',
|
|
'');
|
|
|
|
# TEST #2: make sure files that are built via implicit rules are marked
|
|
# as targets (Savannah bug #12202).
|
|
#
|
|
run_make_test('
|
|
TARGETS := foo foo.out
|
|
|
|
.PHONY: all foo.in
|
|
|
|
all: $(TARGETS)
|
|
|
|
%: %.in
|
|
@echo $@
|
|
|
|
%.out: %
|
|
@echo $@
|
|
|
|
foo.in: ; @:
|
|
|
|
',
|
|
'',
|
|
'foo
|
|
foo.out');
|
|
|
|
|
|
# TEST #3: make sure intermidite files that also happened to be
|
|
# prerequisites are not removed (Savannah bug #12267).
|
|
#
|
|
run_make_test('
|
|
$(dir)/foo.o:
|
|
|
|
$(dir)/foo.y:
|
|
@echo $@
|
|
|
|
%.c: %.y
|
|
touch $@
|
|
|
|
%.o: %.c
|
|
@echo $@
|
|
|
|
.PHONY: install
|
|
install: $(dir)/foo.c
|
|
|
|
',
|
|
"dir=$dir",
|
|
"$dir/foo.y
|
|
touch $dir/foo.c
|
|
$dir/foo.o");
|
|
|
|
unlink("$dir/foo.c");
|
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
1;
|