2 $description = "Test order-only prerequisites.";
5 Create makefiles with various combinations of normal and order-only
6 prerequisites and ensure they behave properly. Test the \$| variable.";
8 open(MAKEFILE,"> $makefile");
10 print MAKEFILE <<'EOF';
25 # TEST #1 -- just the syntax
27 &run_make_with_options($makefile, "", &get_logfile);
28 $answer = "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n";
29 &compare_output($answer,&get_logfile(1));
32 # TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated
34 &run_make_with_options($makefile, "", &get_logfile);
35 $answer = "touch baz\n";
36 &compare_output($answer,&get_logfile(1));
38 unlink(qw(foo bar baz));
40 # Test prereqs that are both order and non-order
42 $makefile2 = &get_tmpfile;
44 open(MAKEFILE,"> $makefile2");
46 print MAKEFILE <<'EOF';
62 # TEST #3 -- Make sure the order-only prereq was promoted to normal.
64 &run_make_with_options($makefile2, "", &get_logfile);
65 $answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";
66 &compare_output($answer,&get_logfile(1));
69 # TEST #4 -- now we do it again
71 &run_make_with_options($makefile2, "", &get_logfile);
72 $answer = "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";
73 &compare_output($answer,&get_logfile(1));
75 unlink(qw(foo bar baz));
77 # Test empty normal prereqs
79 $makefile3 = &get_tmpfile;
81 open(MAKEFILE,"> $makefile3");
83 print MAKEFILE <<'EOF';
97 # TEST #5 -- make sure the parser was correct.
99 &run_make_with_options($makefile3, "", &get_logfile);
100 $answer = "touch baz\n\$^ = \n\$| = baz\ntouch foo\n";
101 &compare_output($answer,&get_logfile(1));
104 # TEST #6 -- now we do it again: this time foo won't be built
106 &run_make_with_options($makefile3, "", &get_logfile);
107 $answer = "touch baz\n";
108 &compare_output($answer,&get_logfile(1));