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