summaryrefslogtreecommitdiff
path: root/tests/scripts/variables
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-07-09 06:35:56 +0000
committerPaul Smith <psmith@gnu.org>2002-07-09 06:35:56 +0000
commit6c9a393f954805d49ab6c66957b46199ddd6e78e (patch)
tree88a3c6a2e807a1356d4bcca1ecca91a6cc037ee5 /tests/scripts/variables
parent724925be2b9a48f7911ee6baa315b872bd86995c (diff)
downloadgunmake-6c9a393f954805d49ab6c66957b46199ddd6e78e.tar.gz
Documentation and tests for order-only prerequisites.
Add a new test suite for automatic variables.
Diffstat (limited to 'tests/scripts/variables')
-rw-r--r--tests/scripts/variables/automatic50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/scripts/variables/automatic b/tests/scripts/variables/automatic
new file mode 100644
index 0000000..b80d478
--- /dev/null
+++ b/tests/scripts/variables/automatic
@@ -0,0 +1,50 @@
+# -*-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;