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