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