dash-f 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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.";
  10. $makefile2 = &get_tmpfile;
  11. $makefile3 = &get_tmpfile;
  12. open(MAKEFILE,"> $makefile");
  13. # The Contents of the MAKEFILE ...
  14. print MAKEFILE "all: \n";
  15. print MAKEFILE "\t\@echo This is the output from the original makefile\n";
  16. # END of Contents of MAKEFILE
  17. close(MAKEFILE);
  18. # Create a second makefile
  19. open(MAKEFILE,"> $makefile2");
  20. print MAKEFILE "TWO: \n";
  21. print MAKEFILE "\t\@echo This is the output from makefile 2\n";
  22. close(MAKEFILE);
  23. # Create a third makefile
  24. open(MAKEFILE,"> $makefile3");
  25. print MAKEFILE "THREE: \n";
  26. print MAKEFILE "\t\@echo This is the output from makefile 3\n";
  27. close(MAKEFILE);
  28. # Create the answer to what should be produced by this Makefile
  29. $answer = "This is the output from the original makefile\n";
  30. # Run make to catch the default rule
  31. &run_make_with_options($makefile,"-f $makefile2 -f $makefile3",&get_logfile,0);
  32. &compare_output($answer,&get_logfile(1));
  33. # Run Make again with the rule from the second makefile: TWO
  34. $answer = "This is the output from makefile 2\n";
  35. &run_make_with_options($makefile,"-f $makefile2 -f $makefile3 TWO",&get_logfile,0);
  36. &compare_output($answer,&get_logfile(1));
  37. # Run Make again with the rule from the third makefile: THREE
  38. $answer = "This is the output from makefile 3\n";
  39. &run_make_with_options($makefile,
  40. "-f $makefile2 -f $makefile3 THREE",
  41. &get_logfile,
  42. 0);
  43. &compare_output($answer,&get_logfile(1));
  44. # Run Make again with ALL three rules in the order 2 1 3 to make sure
  45. # that all rules are executed in the proper order
  46. $answer = "This is the output from makefile 2\n";
  47. $answer .= "This is the output from the original makefile\n";
  48. $answer .= "This is the output from makefile 3\n";
  49. &run_make_with_options($makefile,
  50. "-f $makefile2 -f $makefile3 TWO all THREE",
  51. &get_logfile,
  52. 0);
  53. &compare_output($answer,&get_logfile(1));