Home | History | Annotate | Download | only in options
      1 #                                                                    -*-perl-*-
      2 
      3 $description = "Test the -C option to GNU make.";
      4 
      5 $details = "\
      6 This test is similar to the clean test except that this test creates the file
      7 to delete in the work directory instead of the current directory.  Make is
      8 called from another directory using the -C workdir option so that it can both
      9 find the makefile and the file to delete in the work directory.";
     10 
     11 $example = $workdir . $pathsep . "EXAMPLE";
     12 
     13 open(MAKEFILE,"> $makefile");
     14 print MAKEFILE <<EOF;
     15 all: ; \@echo This makefile did not clean the dir ... good
     16 clean: ; $delete_command EXAMPLE\$(ext)
     17 EOF
     18 close(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 
     28 chdir $workdir;
     29 $wpath = &get_this_pwd;
     30 chdir $pwd;
     31 
     32 if (-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 
     56 chdir $workdir;
     57 $wpath = &get_this_pwd;
     58 chdir $pwd;
     59 
     60 if (-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 
     71 1;
     72