include 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # -*-mode: perl; rm-trailing-spaces: nil-*-
  2. $description = "Test various forms of the GNU make `include' command.";
  3. $details = "Test include, -include, sinclude and various regressions involving them.
  4. Test extra whitespace at the end of the include, multiple -includes and
  5. sincludes (should not give an error) and make sure that errors are reported
  6. for targets that were also -included.";
  7. $makefile2 = &get_tmpfile;
  8. open(MAKEFILE,"> $makefile");
  9. # The contents of the Makefile ...
  10. print MAKEFILE <<EOF;
  11. \#Extra space at the end of the following file name
  12. include $makefile2
  13. all: ; \@echo There should be no errors for this makefile.
  14. -include nonexistent.mk
  15. -include nonexistent.mk
  16. sinclude nonexistent.mk
  17. sinclude nonexistent-2.mk
  18. -include makeit.mk
  19. sinclude makeit.mk
  20. error: makeit.mk
  21. EOF
  22. close(MAKEFILE);
  23. open(MAKEFILE,"> $makefile2");
  24. print MAKEFILE "ANOTHER: ; \@echo This is another included makefile\n";
  25. close(MAKEFILE);
  26. # Create the answer to what should be produced by this Makefile
  27. &run_make_with_options($makefile, "all", &get_logfile);
  28. $answer = "There should be no errors for this makefile.\n";
  29. &compare_output($answer, &get_logfile(1));
  30. &run_make_with_options($makefile, "ANOTHER", &get_logfile);
  31. $answer = "This is another included makefile\n";
  32. &compare_output($answer, &get_logfile(1));
  33. # Try to build the "error" target; this will fail since we don't know
  34. # how to create makeit.mk, but we should also get a message (even though
  35. # the -include suppressed it during the makefile read phase, we should
  36. # see one during the makefile run phase).
  37. # The fix to this caused more problems than the error, so I removed it.
  38. # pds -- 22 Jan 2000
  39. #&run_make_with_options($makefile, "error", &get_logfile, 512);
  40. #$answer = "$make_name: *** No rule to make target `makeit.mk', needed by `error'.\n";
  41. #&compare_output($answer, &get_logfile(1));
  42. 1;