xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/options/dash-f (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos$description = "The following test tests that if you specify greater \n"
2*69606e3fSchristos              ."than one '-f makefilename' on the command line, \n"
3*69606e3fSchristos              ."that make concatenates them.  This test creates three \n"
4*69606e3fSchristos              ."makefiles and specifies all of them with the -f option \n"
5*69606e3fSchristos              ."on the command line.  To make sure they were concatenated, \n"
6*69606e3fSchristos              ."we then call make with the rules from the concatenated \n"
7*69606e3fSchristos              ."makefiles one at a time.  Finally, it calls all three \n"
8*69606e3fSchristos              ."rules in one call to make and checks that the output\n"
9*69606e3fSchristos              ."is in the correct order.";
10*69606e3fSchristos
11*69606e3fSchristos$makefile2 = &get_tmpfile;
12*69606e3fSchristos$makefile3 = &get_tmpfile;
13*69606e3fSchristos
14*69606e3fSchristosopen(MAKEFILE,"> $makefile");
15*69606e3fSchristos
16*69606e3fSchristos# The Contents of the MAKEFILE ...
17*69606e3fSchristos
18*69606e3fSchristosprint MAKEFILE "all: \n";
19*69606e3fSchristosprint MAKEFILE "\t\@echo This is the output from the original makefile\n";
20*69606e3fSchristos
21*69606e3fSchristos# END of Contents of MAKEFILE
22*69606e3fSchristos
23*69606e3fSchristosclose(MAKEFILE);
24*69606e3fSchristos
25*69606e3fSchristos# Create a second makefile
26*69606e3fSchristosopen(MAKEFILE,"> $makefile2");
27*69606e3fSchristosprint MAKEFILE "TWO: \n";
28*69606e3fSchristosprint MAKEFILE "\t\@echo This is the output from makefile 2\n";
29*69606e3fSchristosclose(MAKEFILE);
30*69606e3fSchristos
31*69606e3fSchristos# Create a third makefile
32*69606e3fSchristosopen(MAKEFILE,"> $makefile3");
33*69606e3fSchristosprint MAKEFILE "THREE: \n";
34*69606e3fSchristosprint MAKEFILE "\t\@echo This is the output from makefile 3\n";
35*69606e3fSchristosclose(MAKEFILE);
36*69606e3fSchristos
37*69606e3fSchristos
38*69606e3fSchristos# Create the answer to what should be produced by this Makefile
39*69606e3fSchristos$answer = "This is the output from the original makefile\n";
40*69606e3fSchristos
41*69606e3fSchristos# Run make to catch the default rule
42*69606e3fSchristos&run_make_with_options($makefile,"-f $makefile2 -f $makefile3",&get_logfile,0);
43*69606e3fSchristos
44*69606e3fSchristos&compare_output($answer,&get_logfile(1));
45*69606e3fSchristos
46*69606e3fSchristos
47*69606e3fSchristos# Run Make again with the rule from the second makefile: TWO
48*69606e3fSchristos$answer = "This is the output from makefile 2\n";
49*69606e3fSchristos
50*69606e3fSchristos&run_make_with_options($makefile,"-f $makefile2 -f $makefile3 TWO",&get_logfile,0);
51*69606e3fSchristos
52*69606e3fSchristos&compare_output($answer,&get_logfile(1));
53*69606e3fSchristos
54*69606e3fSchristos
55*69606e3fSchristos# Run Make again with the rule from the third makefile: THREE
56*69606e3fSchristos
57*69606e3fSchristos$answer = "This is the output from makefile 3\n";
58*69606e3fSchristos&run_make_with_options($makefile,
59*69606e3fSchristos                       "-f $makefile2 -f $makefile3 THREE",
60*69606e3fSchristos                       &get_logfile,
61*69606e3fSchristos                       0);
62*69606e3fSchristos&compare_output($answer,&get_logfile(1));
63*69606e3fSchristos
64*69606e3fSchristos
65*69606e3fSchristos# Run Make again with ALL three rules in the order 2 1 3 to make sure
66*69606e3fSchristos# that all rules are executed in the proper order
67*69606e3fSchristos
68*69606e3fSchristos$answer = "This is the output from makefile 2\n";
69*69606e3fSchristos$answer .= "This is the output from the original makefile\n";
70*69606e3fSchristos$answer .= "This is the output from makefile 3\n";
71*69606e3fSchristos&run_make_with_options($makefile,
72*69606e3fSchristos                       "-f $makefile2 -f $makefile3 TWO all THREE",
73*69606e3fSchristos		       &get_logfile,
74*69606e3fSchristos                       0);
75*69606e3fSchristos&compare_output($answer,&get_logfile(1));
76*69606e3fSchristos
77*69606e3fSchristos
78*69606e3fSchristos
79*69606e3fSchristos
80*69606e3fSchristos
81*69606e3fSchristos
82*69606e3fSchristos
83*69606e3fSchristos
84*69606e3fSchristos
85*69606e3fSchristos
86