VirtualBox

source: kBuild/trunk/src/kmk/tests/scripts/features/vpath@ 969

Last change on this file since 969 was 969, checked in by bird, 18 years ago

Fixing some svn props.

  • Property svn:eol-style set to LF
File size: 2.4 KB
Line 
1$description = "The following test creates a makefile to test the \n"
2 ."vpath directive which allows you to specify a search \n"
3 ."path for a particular class of filenames, those that\n"
4 ."match a particular pattern.";
5
6$details = "This tests the vpath directive by specifying search directories\n"
7 ."for one class of filenames with the form: vpath pattern directories"
8 ."\nIn this test, we specify the working directory for all files\n"
9 ."that end in c or h. We also test the variables $@ (which gives\n"
10 ."target name) and $^ (which is a list of all dependencies \n"
11 ."including the directories in which they were found). It also\n"
12 ."uses the function firstword used to extract just the first\n"
13 ."dependency from the entire list.";
14
15open(MAKEFILE,"> $makefile");
16
17# The Contents of the MAKEFILE ...
18
19print MAKEFILE "vpath %.c foo\n";
20print MAKEFILE "vpath %.c $workdir\n";
21print MAKEFILE "vpath %.h $workdir\n";
22print MAKEFILE "objects = main.o kbd.o commands.o display.o insert.o\n";
23print MAKEFILE "edit: \$(objects)\n";
24print MAKEFILE "\t\@echo cc -o \$@ \$^\n";
25print MAKEFILE "main.o : main.c defs.h\n";
26print MAKEFILE "\t\@echo cc -c \$(firstword \$^)\n";
27print MAKEFILE "kbd.o : kbd.c defs.h command.h\n";
28print MAKEFILE "\t\@echo cc -c kbd.c\n";
29print MAKEFILE "commands.o : command.c defs.h command.h\n";
30print MAKEFILE "\t\@echo cc -c commands.c\n";
31print MAKEFILE "display.o : display.c defs.h buffer.h\n";
32print MAKEFILE "\t\@echo cc -c display.c\n";
33print MAKEFILE "insert.o : insert.c defs.h buffer.h\n";
34print MAKEFILE "\t\@echo cc -c insert.c\n";
35
36# END of Contents of MAKEFILE
37
38close(MAKEFILE);
39
40
41@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
42 "$workdir${pathsep}kbd.c","$workdir${pathsep}command.h",
43 "$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
44 "$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c",
45 "$workdir${pathsep}command.c");
46
47&touch(@files_to_touch);
48
49&run_make_with_options($makefile,"",&get_logfile);
50
51# Create the answer to what should be produced by this Makefile
52$answer = "cc -c $workdir${pathsep}main.c\ncc -c kbd.c\ncc -c commands.c\n"
53 ."cc -c display.c\n"
54 ."cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o "
55 ."insert.o\n";
56
57if (&compare_output($answer,&get_logfile(1)))
58{
59 unlink @files_to_touch;
60}
61
621;
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette