2 $description = "Test the -n option.\n";
4 $details = "Try various uses of -n and ensure they all give the correct results.\n";
9 final: intermediate ; echo >> $@
10 intermediate: orig ; echo >> $@
12 '', "echo >> intermediate\necho >> final\n");
16 run_make_test(undef, '-Worig -n', "echo >> intermediate\necho >> final\n");
18 rmfiles(qw(orig intermediate final));
20 # We consider the actual updated timestamp of targets with all
21 # recursive commands, even with -n. Switching this to the new model
22 # is non-trivial because we use a trick below to change the log content
23 # before we compare it ...
25 $makefile2 = &get_tmpfile;
27 open(MAKEFILE, "> $makefile2");
29 print MAKEFILE <<'EOF';
45 &run_make_with_options($makefile2, "", &get_logfile);
46 $answer = "$make_name: 'a' is up to date.\n";
47 &compare_output($answer, &get_logfile(1));
51 &run_make_with_options($makefile2, "-n", &get_logfile);
52 $answer = "$make_name: 'a' is up to date.\n";
53 &compare_output($answer, &get_logfile(1));
59 &run_make_with_options($makefile2, "-t -n", &get_logfile);
61 open(DASH_N_LOG, ">>" . &get_logfile(1));
62 print DASH_N_LOG "a exists but should not!\n" if -e 'a';
63 print DASH_N_LOG "b exists but should not!\n" if -e 'b';
66 &compare_output("touch b\ntouch a\n", &get_logfile(1));
72 # Ensure -n continues to be included with recursive/re-execed make
73 # See Savannah bug #38051
75 $topmake = &get_tmpfile;
76 $submake = &get_tmpfile;
78 open(MAKEFILE, "> $topmake");
79 print MAKEFILE <<"EOF";
80 foo: ; \@\$(MAKE) -f "$submake" bar
85 # The bar target should print what would happen, but not actually run
86 open(MAKEFILE, "> $submake");
87 print MAKEFILE <<'EOF';
90 bar: ; @echo $(strip $(MAKEFLAGS))
94 &run_make_with_options($topmake, '-n --no-print-directory', &get_logfile);
95 $answer = "$make_path -f \"$submake\" bar\ntouch inc\necho n --no-print-directory\n";
96 &compare_output($answer, &get_logfile(1));