mirror of
https://github.com/mirror/make.git
synced 2025-01-10 12:20:18 +08:00
51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
|
# -*-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;
|