###	SPAR <http://www.cpan.org/scripts/>
###	29	644	1161580578	1231322001	makepp_test_script.pl
# Test all variants of existing and created symlinks, to existing and created files.

makepp;
my %warnings;
n_files 'n_files1', sub {
  undef $warnings{$1} if
    /warning:.*?(is a symbolic link|I attempted to build|\w+ is probably also phony)/;
};
die unless 3 == keys %warnings;

unlink qw(a bl f g h);		# Force rebuild of linkee or make link stale.
wait_timestamp qw(c e);
for my $file (qw(c e)) {	# Edit linkees.
  open my $fh, '>', $file or die "$file--$!";
  close $fh;
}

eval { makepp qw(D=dd -k) }; # [a-e]l2 and dl must not be rebuilt!
%warnings = ();
n_files 'n_files2', sub {
  undef $warnings{$1} if
    /warning:(.*)/;
};
die unless 1 == keys %warnings;

makepp qw(--rm-stale D=dd);
die if grep -f, qw(fl fl2 fc gl gl2 gc hl hl2 hc);

1;
###	26	644	1230569382	1231320259	Makeppfile
default: default1			# Provoke no-phony warnings.

default1: ?c

$(foreach) $(foreach)l: :foreach a b # Both created in one rule.
	&echo $(output) -o $(output)
	&ln -fs $(outputs)

%l: %
	&ln -fs $(input) $(output)

%l2: %l
	&ln -fs $(input) $(output)

%c: %l2 :signature md5
	&cp $(input) $(output)

cl:
	&echo $(output) -o $(output) # Should warn about link to c.

D=d
d:
	&echo $D -o $(output)

%l: %
	&ln -fs $(input) $(output)
###	0	644	1230569045	1230571314	c
###	L	S	0	0	cl
c
###	1	644	1230569045	1230569045	e
e
###	1	644	1230569045	1230569045	f
f
###	1	644	1230569045	1230569045	g
g
###	L	S	0	0	gl
g
###	1	644	1230569045	1230569045	h
h
###	D	755	1230569356	1230569356	answers
###	1	644	1230569356	1230569356	answers/n_files1
27 2 0
###	1	644	1230569356	1230569356	answers/n_files2
9 0 3
###	1	644	1230569356	1230569356	answers/n_files
0 2 0