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