xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/features/mult_targets (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos$description = "The following test creates a makefile to test that a \n "
2*69606e3fSchristos              ."rule with multiple targets is equivalent to writing \n"
3*69606e3fSchristos              ."many rules, each with one target, and all identical aside\n"
4*69606e3fSchristos              ."from that.";
5*69606e3fSchristos
6*69606e3fSchristos$details = "A makefile is created with one rule and two targets.  Make \n"
7*69606e3fSchristos          ."is called twice, once for each target, and the output which \n"
8*69606e3fSchristos          ."contains the target name with \$@ is looked at for the changes.\n"
9*69606e3fSchristos          ."This test also tests the substitute function by replacing \n"
10*69606e3fSchristos          ."the word output with nothing in the target name giving either\n"
11*69606e3fSchristos          ."an output of \"I am little\" or \"I am big\"";
12*69606e3fSchristos
13*69606e3fSchristosopen(MAKEFILE,"> $makefile");
14*69606e3fSchristos
15*69606e3fSchristos# The Contents of the MAKEFILE ...
16*69606e3fSchristos
17*69606e3fSchristosprint MAKEFILE "bigoutput littleoutput: test.h\n";
18*69606e3fSchristosprint MAKEFILE "\t\@echo I am \$(subst output,,\$@)\n";
19*69606e3fSchristos
20*69606e3fSchristos# END of Contents of MAKEFILE
21*69606e3fSchristos
22*69606e3fSchristosclose(MAKEFILE);
23*69606e3fSchristos
24*69606e3fSchristos&touch("test.h");
25*69606e3fSchristos
26*69606e3fSchristos&run_make_with_options($makefile,"bigoutput",&get_logfile);
27*69606e3fSchristos
28*69606e3fSchristos
29*69606e3fSchristos# Create the answer to what should be produced by this Makefile
30*69606e3fSchristos$answer = "I am big\n";
31*69606e3fSchristos
32*69606e3fSchristos&compare_output($answer,&get_logfile(1));
33*69606e3fSchristos
34*69606e3fSchristos&run_make_with_options($makefile,"littleoutput",&get_logfile);
35*69606e3fSchristos$answer = "I am little\n";
36*69606e3fSchristos&compare_output($answer,&get_logfile(1));
37*69606e3fSchristos
38*69606e3fSchristosunlink "test.h";
39*69606e3fSchristos
40*69606e3fSchristos1;
41*69606e3fSchristos
42*69606e3fSchristos
43*69606e3fSchristos
44*69606e3fSchristos
45*69606e3fSchristos
46*69606e3fSchristos
47