• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#                                                                    -*-perl-*-
2
3$description = "Test the -C option to GNU make.";
4
5$details = "\
6This test is similar to the clean test except that this test creates the file
7to delete in the work directory instead of the current directory.  Make is
8called from another directory using the -C workdir option so that it can both
9find the makefile and the file to delete in the work directory.";
10
11$example = $workdir . $pathsep . "EXAMPLE";
12
13open(MAKEFILE,"> $makefile");
14print MAKEFILE <<EOF;
15all: ; \@echo This makefile did not clean the dir ... good
16clean: ; $delete_command EXAMPLE\$(ext)
17EOF
18close(MAKEFILE);
19
20# TEST #1
21# -------
22&touch($example);
23
24&run_make_with_options("${testname}.mk",
25	               "-C $workdir clean",
26		       &get_logfile);
27
28chdir $workdir;
29$wpath = &get_this_pwd;
30chdir $pwd;
31
32if (-f $example) {
33  $test_passed = 0;
34}
35
36# Create the answer to what should be produced by this Makefile
37$answer = "$make_name: Entering directory `$wpath'\n"
38        . "$delete_command EXAMPLE\n"
39        . "$make_name: Leaving directory `$wpath'\n";
40
41&compare_output($answer,&get_logfile(1));
42
43
44# TEST #2
45# -------
46# Do it again with trailing "/"; this should work the same
47
48$example .= "slash";
49
50&touch($example);
51
52&run_make_with_options("${testname}.mk",
53	               "-C $workdir/ clean ext=slash",
54		       &get_logfile);
55
56chdir $workdir;
57$wpath = &get_this_pwd;
58chdir $pwd;
59
60if (-f $example) {
61  $test_passed = 0;
62}
63
64# Create the answer to what should be produced by this Makefile
65$answer = "$make_name: Entering directory `$wpath'\n"
66        . "$delete_command EXAMPLEslash\n"
67        . "$make_name: Leaving directory `$wpath'\n";
68
69&compare_output($answer,&get_logfile(1));
70
711;
72