mirror of
https://github.com/mirror/make.git
synced 2025-01-07 19:00:09 +08:00
80 lines
1.6 KiB
Plaintext
80 lines
1.6 KiB
Plaintext
|
# -*-perl-*-
|
||
|
$description = "Test order-only prerequisites.";
|
||
|
|
||
|
$details = "\
|
||
|
Create makefiles with various combinations of normal and order-only
|
||
|
prerequisites and ensure they behave properly. Test the \$| variable.";
|
||
|
|
||
|
open(MAKEFILE,"> $makefile");
|
||
|
|
||
|
print MAKEFILE <<'EOF';
|
||
|
foo: bar | baz
|
||
|
@echo '$$^ = $^'
|
||
|
@echo '$$? = $?'
|
||
|
@echo '$$| = $|'
|
||
|
touch $@
|
||
|
|
||
|
.PHONY: baz
|
||
|
|
||
|
bar baz:
|
||
|
touch $@
|
||
|
EOF
|
||
|
|
||
|
close(MAKEFILE);
|
||
|
|
||
|
|
||
|
# TEST #1 -- just the syntax
|
||
|
|
||
|
&run_make_with_options($makefile, "", &get_logfile);
|
||
|
$answer = "touch bar\ntouch baz\n\$^ = bar\n\$? = bar\n\$| = baz\ntouch foo\n";
|
||
|
&compare_output($answer,&get_logfile(1));
|
||
|
|
||
|
|
||
|
# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated
|
||
|
|
||
|
&run_make_with_options($makefile, "", &get_logfile);
|
||
|
$answer = "touch baz\n";
|
||
|
&compare_output($answer,&get_logfile(1));
|
||
|
|
||
|
unlink(qw(foo bar baz));
|
||
|
|
||
|
# Test prereqs that are both order and non-order
|
||
|
|
||
|
$makefile2 = &get_tmpfile;
|
||
|
|
||
|
open(MAKEFILE,"> $makefile2");
|
||
|
|
||
|
print MAKEFILE <<'EOF';
|
||
|
foo: bar | baz
|
||
|
@echo '$$^ = $^'
|
||
|
@echo '$$? = $?'
|
||
|
@echo '$$| = $|'
|
||
|
touch $@
|
||
|
|
||
|
foo: baz
|
||
|
|
||
|
.PHONY: baz
|
||
|
|
||
|
bar baz:
|
||
|
touch $@
|
||
|
EOF
|
||
|
|
||
|
close(MAKEFILE);
|
||
|
|
||
|
# TEST #3 -- just the syntax
|
||
|
|
||
|
&run_make_with_options($makefile2, "", &get_logfile);
|
||
|
$answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$? = bar baz\n\$| = baz\ntouch foo\n";
|
||
|
&compare_output($answer,&get_logfile(1));
|
||
|
|
||
|
|
||
|
# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated
|
||
|
|
||
|
&run_make_with_options($makefile2, "", &get_logfile);
|
||
|
$answer = "touch baz\$^ = bar baz\n\$? = baz\n\$| = baz\ntouch foo\n";
|
||
|
&compare_output($answer,&get_logfile(1));
|
||
|
|
||
|
unlink(qw(foo bar baz));
|
||
|
|
||
|
1;
|