1#                                                                    -*-perl-*-
2
3$description = "The following test creates a makefile to test the
4simple functionality of make.  It mimics the
5rebuilding of a product with dependencies.
6It also tests the simple definition of VPATH.";
7
8open(MAKEFILE,"> $makefile");
9
10print MAKEFILE <<EOF;
11VPATH = $workdir
12edit:  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
16main.o : main.c defs.h
17\t\@echo cc -c main.c
18kbd.o : kbd.c defs.h command.h
19\t\@echo cc -c kbd.c
20commands.o : command.c defs.h command.h
21\t\@echo cc -c commands.c
22display.o : display.c defs.h buffer.h
23\t\@echo cc -c display.c
24insert.o : insert.c defs.h buffer.h
25\t\@echo cc -c insert.c
26EOF
27
28close(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
43cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n";
44
45# COMPARE RESULTS
46
47if (&compare_output($answer,&get_logfile(1))) {
48  unlink @files_to_touch;
49}
50
511;
52