1 # -*-perl-*- 2 3 $description = "The following test creates a makefile to test the 4 simple functionality of make. It mimics the 5 rebuilding of a product with dependencies. 6 It also tests the simple definition of VPATH."; 7 8 open(MAKEFILE,"> $makefile"); 9 10 print MAKEFILE <<EOF; 11 VPATH = $workdir 12 edit: main.o kbd.o commands.o display.o \\ 13 insert.o 14 \t\@echo cc -o edit main.o kbd.o commands.o display.o \\ 15 insert.o 16 main.o : main.c defs.h 17 \t\@echo cc -c main.c 18 kbd.o : kbd.c defs.h command.h 19 \t\@echo cc -c kbd.c 20 commands.o : command.c defs.h command.h 21 \t\@echo cc -c commands.c 22 display.o : display.c defs.h buffer.h 23 \t\@echo cc -c display.c 24 insert.o : insert.c defs.h buffer.h 25 \t\@echo cc -c insert.c 26 EOF 27 28 close(MAKEFILE); 29 30 31 @files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h", 32 "$workdir${pathsep}kbd.c","$workdir${pathsep}command.h", 33 "$workdir${pathsep}commands.c","$workdir${pathsep}display.c", 34 "$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c", 35 "$workdir${pathsep}command.c"); 36 37 &touch(@files_to_touch); 38 39 &run_make_with_options($makefile,"",&get_logfile); 40 41 # Create the answer to what should be produced by this Makefile 42 $answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c 43 cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n"; 44 45 # COMPARE RESULTS 46 47 if (&compare_output($answer,&get_logfile(1))) { 48 unlink @files_to_touch; 49 } 50 51 1; 52