| 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 qq! |
| 15 |
all: ; \@echo This makefile did not clean the dir ... good |
| 16 |
clean: ; $CMD_rmfile EXAMPLE\$(ext) |
| 17 |
!; |
| 18 |
close(MAKEFILE); |
| 19 |
|
| 20 |
# TEST #1 |
| 21 |
# ------- |
| 22 |
touch($example); |
| 23 |
|
| 24 |
run_make_with_options("${testname}.mk", "-C $workdir clean", &get_logfile); |
| 25 |
|
| 26 |
chdir $workdir; |
| 27 |
$wpath = &get_this_pwd; |
| 28 |
chdir $pwd; |
| 29 |
|
| 30 |
if (-f $example) { |
| 31 |
$test_passed = 0; |
| 32 |
} |
| 33 |
|
| 34 |
# Create the answer to what should be produced by this Makefile |
| 35 |
$answer = "$make_name: Entering directory '$wpath'\n" |
| 36 |
. "$CMD_rmfile EXAMPLE\n" |
| 37 |
. "$make_name: Leaving directory '$wpath'\n"; |
| 38 |
|
| 39 |
compare_output($answer,&get_logfile(1)); |
| 40 |
|
| 41 |
|
| 42 |
# TEST #2 |
| 43 |
# ------- |
| 44 |
# Do it again with trailing "/"; this should work the same |
| 45 |
|
| 46 |
$example .= "slash"; |
| 47 |
|
| 48 |
touch($example); |
| 49 |
|
| 50 |
run_make_with_options("${testname}.mk", "-C $workdir/ clean ext=slash", &get_logfile); |
| 51 |
|
| 52 |
chdir $workdir; |
| 53 |
$wpath = &get_this_pwd; |
| 54 |
chdir $pwd; |
| 55 |
|
| 56 |
if (-f $example) { |
| 57 |
$test_passed = 0; |
| 58 |
} |
| 59 |
|
| 60 |
# Create the answer to what should be produced by this Makefile |
| 61 |
$answer = "$make_name: Entering directory '$wpath'\n" |
| 62 |
. "$CMD_rmfile EXAMPLEslash\n" |
| 63 |
. "$make_name: Leaving directory '$wpath'\n"; |
| 64 |
|
| 65 |
&compare_output($answer,&get_logfile(1)); |
| 66 |
|
| 67 |
unlink($example); |
| 68 |
1; |