* New config.sub and config.guess
[make.git] / tests / scripts / options / dash-n
blob98f1d217558f2aeb42b4b79d5b67e103b0a35689
1 #                                                                    -*-perl-*-
2 $description = "Test the -n option.\n";
4 $details = "Try various uses of -n and ensure they all give the correct results.\n";
6 open(MAKEFILE, "> $makefile");
8 # The Contents of the MAKEFILE ...
10 print MAKEFILE <<'EOMAKE';
12 final: intermediate ; echo >> $@
13 intermediate: orig ; echo >> $@
15 EOMAKE
17 close(MAKEFILE);
19 &touch('orig');
21 # TEST 0
23 &run_make_with_options($makefile, "", &get_logfile);
24 $answer = "echo >> intermediate\necho >> final\n";
25 &compare_output($answer, &get_logfile(1));
27 # TEST 1
29 &run_make_with_options($makefile, "-Worig -n", &get_logfile);
30 $answer = "echo >> intermediate\necho >> final\n";
31 &compare_output($answer, &get_logfile(1));
33 unlink('orig', 'intermediate', 'final');
35 # We consider the actual updated timestamp of targets with all
36 # recursive commands, even with -n.
38 $makefile2 = &get_tmpfile;
40 open(MAKEFILE, "> $makefile2");
42 print MAKEFILE <<'EOF';
43 .SUFFIXES:
44 BAR =     # nothing
45 FOO = +$(BAR)
46 a: b; echo > $@
47 b: c; $(FOO)
48 EOF
50 close(MAKEFILE);
52 &touch('b');
53 &touch('a');
54 sleep(1);
55 &touch('c');
57 # TEST 2
59 &run_make_with_options($makefile2, "", &get_logfile);
60 $answer = "$make_name: `a' is up to date.\n";
61 &compare_output($answer, &get_logfile(1));
63 # TEST 3
65 &run_make_with_options($makefile2, "-n", &get_logfile);
66 $answer = "$make_name: `a' is up to date.\n";
67 &compare_output($answer, &get_logfile(1));
69 unlink('a', 'b', 'c');