1#                                                                    -*-perl-*-
2
3$description = "The following test creates a makefile to test wildcard
4expansions and the ability to put a command on the same
5line as the target name separated by a semi-colon.";
6
7$details = "\
8This test creates 4 files by the names of 1.example,
9two.example and 3.example.  We execute three tests.  The first
10executes the print1 target which tests the '*' wildcard by
11echoing all filenames by the name of '*.example'.  The second
12test echo's all files which match '?.example' and
13[a-z0-9].example.  Lastly we clean up all of the files using
14the '*' wildcard as in the first test";
15
16open(MAKEFILE,"> $makefile");
17
18# The Contents of the MAKEFILE ...
19
20print MAKEFILE <<EOM;
21.PHONY: print1 print2 clean
22print1: ;\@echo \$(sort \$(wildcard example.*))
23print2:
24\t\@echo \$(sort \$(wildcard example.?))
25\t\@echo \$(sort \$(wildcard example.[a-z0-9]))
26\t\@echo \$(sort \$(wildcard example.[!A-Za-z_\\!]))
27clean:
28\t$delete_command \$(sort \$(wildcard example.*))
29EOM
30
31# END of Contents of MAKEFILE
32
33close(MAKEFILE);
34
35&touch("example.1");
36&touch("example.two");
37&touch("example.3");
38&touch("example.for");
39&touch("example._");
40
41# TEST #1
42# -------
43
44$answer = "example.1 example.3 example._ example.for example.two\n";
45
46&run_make_with_options($makefile,"print1",&get_logfile);
47
48&compare_output($answer,&get_logfile(1));
49
50
51# TEST #2
52# -------
53
54$answer = "example.1 example.3 example._\n"
55         ."example.1 example.3\n"
56         ."example.1 example.3\n";
57
58&run_make_with_options($makefile,"print2",&get_logfile);
59
60&compare_output($answer,&get_logfile(1));
61
62
63# TEST #3
64# -------
65
66$answer = "$delete_command example.1 example.3 example._ example.for example.two";
67if ($vos)
68{
69   $answer .= " \n";
70}
71else
72{
73   $answer .= "\n";
74}
75
76&run_make_with_options($makefile,"clean",&get_logfile);
77
78if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) {
79   $test_passed = 0;
80}
81
82&compare_output($answer,&get_logfile(1));
83
84
851;
86
87
88
89
90
91
92
93
94
95