general2 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # -*-perl-*-
  2. $description = "The following test creates a makefile to test the
  3. simple functionality of make. It is the same as
  4. general_test1 except that this one tests the
  5. definition of a variable to hold the object filenames.";
  6. open(MAKEFILE,"> $makefile");
  7. # The contents of the Makefile ...
  8. print MAKEFILE <<EOF;
  9. VPATH = $workdir
  10. objects = main.o kbd.o commands.o display.o insert.o
  11. edit: \$(objects)
  12. \t\@echo cc -o edit \$(objects)
  13. main.o : main.c defs.h
  14. \t\@echo cc -c main.c
  15. kbd.o : kbd.c defs.h command.h
  16. \t\@echo cc -c kbd.c
  17. commands.o : command.c defs.h command.h
  18. \t\@echo cc -c commands.c
  19. display.o : display.c defs.h buffer.h
  20. \t\@echo cc -c display.c
  21. insert.o : insert.c defs.h buffer.h
  22. \t\@echo cc -c insert.c
  23. EOF
  24. close(MAKEFILE);
  25. @files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
  26. "$workdir${pathsep}kbd.c","$workdir${pathsep}command.h",
  27. "$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
  28. "$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c",
  29. "$workdir${pathsep}command.c");
  30. &touch(@files_to_touch);
  31. &run_make_with_options($makefile,"",&get_logfile);
  32. # Create the answer to what should be produced by this Makefile
  33. $answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c
  34. cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n";
  35. if (&compare_output($answer,&get_logfile(1))) {
  36. unlink @files_to_touch;
  37. }
  38. 1;