- Enhance .POSIX to set -e when invoking shells, as demanded by a
[make.git] / tests / scripts / options / dash-f
blob3aa47460761d51120dc03c4211bcaef58a5adc55
1 $description = "The following test tests that if you specify greater \n"
2               ."than one '-f makefilename' on the command line, \n"
3               ."that make concatenates them.  This test creates three \n"
4               ."makefiles and specifies all of them with the -f option \n"
5               ."on the command line.  To make sure they were concatenated, \n"
6               ."we then call make with the rules from the concatenated \n"
7               ."makefiles one at a time.  Finally, it calls all three \n"
8               ."rules in one call to make and checks that the output\n"
9               ."is in the correct order.";
11 $makefile2 = &get_tmpfile;
12 $makefile3 = &get_tmpfile;
14 open(MAKEFILE,"> $makefile");
16 # The Contents of the MAKEFILE ...
18 print MAKEFILE "all: \n";
19 print MAKEFILE "\t\@echo This is the output from the original makefile\n";
21 # END of Contents of MAKEFILE
23 close(MAKEFILE);
25 # Create a second makefile
26 open(MAKEFILE,"> $makefile2");
27 print MAKEFILE "TWO: \n";
28 print MAKEFILE "\t\@echo This is the output from makefile 2\n";
29 close(MAKEFILE);
31 # Create a third makefile
32 open(MAKEFILE,"> $makefile3");
33 print MAKEFILE "THREE: \n";
34 print MAKEFILE "\t\@echo This is the output from makefile 3\n";
35 close(MAKEFILE);
38 # Create the answer to what should be produced by this Makefile
39 $answer = "This is the output from the original makefile\n";
41 # Run make to catch the default rule
42 &run_make_with_options($makefile,"-f $makefile2 -f $makefile3",&get_logfile,0);
44 &compare_output($answer,&get_logfile(1));
47 # Run Make again with the rule from the second makefile: TWO
48 $answer = "This is the output from makefile 2\n";
50 &run_make_with_options($makefile,"-f $makefile2 -f $makefile3 TWO",&get_logfile,0);
52 &compare_output($answer,&get_logfile(1));
53      
55 # Run Make again with the rule from the third makefile: THREE
57 $answer = "This is the output from makefile 3\n";
58 &run_make_with_options($makefile,
59                        "-f $makefile2 -f $makefile3 THREE",
60                        &get_logfile,
61                        0);
62 &compare_output($answer,&get_logfile(1));
65 # Run Make again with ALL three rules in the order 2 1 3 to make sure
66 # that all rules are executed in the proper order
68 $answer = "This is the output from makefile 2\n";
69 $answer .= "This is the output from the original makefile\n";
70 $answer .= "This is the output from makefile 3\n";
71 &run_make_with_options($makefile,
72                        "-f $makefile2 -f $makefile3 TWO all THREE",
73                        &get_logfile,
74                        0);
75 &compare_output($answer,&get_logfile(1));
76