mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-02-01 03:57:59 +00:00
6c9a393f95
Add a new test suite for automatic variables.
50 lines
1.3 KiB
Perl
50 lines
1.3 KiB
Perl
# -*-perl-*-
|
|
|
|
$description = "Test automatic variable setting.";
|
|
|
|
$details = "";
|
|
|
|
use Cwd;
|
|
|
|
$dir = cwd;
|
|
$dir =~ s,.*/([^/]+)$,../$1,;
|
|
|
|
open(MAKEFILE, "> $makefile");
|
|
print MAKEFILE "dir = $dir\n";
|
|
print MAKEFILE <<'EOF';
|
|
.SUFFIXES:
|
|
.SUFFIXES: .x .y .z
|
|
$(dir)/foo.x : baz.z $(dir)/bar.y baz.z
|
|
@echo '$$@ = $@, $$(@D) = $(@D), $$(@F) = $(@F)'
|
|
@echo '$$* = $*, $$(*D) = $(*D), $$(*F) = $(*F)'
|
|
@echo '$$< = $<, $$(<D) = $(<D), $$(<F) = $(<F)'
|
|
@echo '$$^ = $^, $$(^D) = $(^D), $$(^F) = $(^F)'
|
|
@echo '$$+ = $+, $$(+D) = $(+D), $$(+F) = $(+F)'
|
|
@echo '$$? = $?, $$(?D) = $(?D), $$(?F) = $(?F)'
|
|
touch $@
|
|
|
|
$(dir)/bar.y baz.z : ; touch $@
|
|
EOF
|
|
close(MAKEFILE);
|
|
|
|
# TEST #1 -- simple test
|
|
# -------
|
|
|
|
&touch(qw(foo.x baz.z));
|
|
|
|
sleep(1);
|
|
|
|
&run_make_with_options($makefile, "", &get_logfile);
|
|
$answer = "touch $dir/bar.y
|
|
\$\@ = $dir/foo.x, \$(\@D) = $dir, \$(\@F) = foo.x
|
|
\$* = $dir/foo, \$(*D) = $dir, \$(*F) = foo
|
|
\$< = baz.z, \$(<D) = ., \$(<F) = baz.z
|
|
\$^ = baz.z $dir/bar.y, \$(^D) = . $dir, \$(^F) = baz.z bar.y
|
|
\$+ = baz.z $dir/bar.y baz.z, \$(+D) = . $dir ., \$(+F) = baz.z bar.y baz.z
|
|
\$? = $dir/bar.y, \$(?D) = $dir, \$(?F) = bar.y
|
|
touch $dir/foo.x\n";
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
unlink(qw(foo.x bar.y baz.z));
|
|
|
|
1;
|