xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/misc/general1 (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos#                                                                    -*-perl-*-
2*69606e3fSchristos
3*69606e3fSchristos$description = "The following test creates a makefile to test the
4*69606e3fSchristossimple functionality of make.  It mimics the
5*69606e3fSchristosrebuilding of a product with dependencies.
6*69606e3fSchristosIt also tests the simple definition of VPATH.";
7*69606e3fSchristos
8*69606e3fSchristosopen(MAKEFILE,"> $makefile");
9*69606e3fSchristos
10*69606e3fSchristosprint MAKEFILE <<EOF;
11*69606e3fSchristosVPATH = $workdir
12*69606e3fSchristosedit:  main.o kbd.o commands.o display.o \\
13*69606e3fSchristos       insert.o
14*69606e3fSchristos\t\@echo cc -o edit main.o kbd.o commands.o display.o \\
15*69606e3fSchristos                  insert.o
16*69606e3fSchristosmain.o : main.c defs.h
17*69606e3fSchristos\t\@echo cc -c main.c
18*69606e3fSchristoskbd.o : kbd.c defs.h command.h
19*69606e3fSchristos\t\@echo cc -c kbd.c
20*69606e3fSchristoscommands.o : command.c defs.h command.h
21*69606e3fSchristos\t\@echo cc -c commands.c
22*69606e3fSchristosdisplay.o : display.c defs.h buffer.h
23*69606e3fSchristos\t\@echo cc -c display.c
24*69606e3fSchristosinsert.o : insert.c defs.h buffer.h
25*69606e3fSchristos\t\@echo cc -c insert.c
26*69606e3fSchristosEOF
27*69606e3fSchristos
28*69606e3fSchristosclose(MAKEFILE);
29*69606e3fSchristos
30*69606e3fSchristos
31*69606e3fSchristos@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
32*69606e3fSchristos               "$workdir${pathsep}kbd.c","$workdir${pathsep}command.h",
33*69606e3fSchristos               "$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
34*69606e3fSchristos               "$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c",
35*69606e3fSchristos	       "$workdir${pathsep}command.c");
36*69606e3fSchristos
37*69606e3fSchristos&touch(@files_to_touch);
38*69606e3fSchristos
39*69606e3fSchristos&run_make_with_options($makefile,"",&get_logfile);
40*69606e3fSchristos
41*69606e3fSchristos# Create the answer to what should be produced by this Makefile
42*69606e3fSchristos$answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c
43*69606e3fSchristoscc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n";
44*69606e3fSchristos
45*69606e3fSchristos# COMPARE RESULTS
46*69606e3fSchristos
47*69606e3fSchristosif (&compare_output($answer,&get_logfile(1))) {
48*69606e3fSchristos  unlink @files_to_touch;
49*69606e3fSchristos}
50*69606e3fSchristos
51*69606e3fSchristos1;
52