2004-11-29 01:35:13 +00:00
|
|
|
# -*-perl-*-
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-11-29 01:35:13 +00:00
|
|
|
$description = "Test the -C option to GNU make.";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-11-29 01:35:13 +00:00
|
|
|
$details = "\
|
|
|
|
This test is similar to the clean test except that this test creates the file
|
|
|
|
to delete in the work directory instead of the current directory. Make is
|
|
|
|
called from another directory using the -C workdir option so that it can both
|
|
|
|
find the makefile and the file to delete in the work directory.";
|
|
|
|
|
|
|
|
$example = $workdir . $pathsep . "EXAMPLE";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
open(MAKEFILE,"> $makefile");
|
2016-12-23 18:33:58 +00:00
|
|
|
print MAKEFILE qq!
|
2004-11-29 01:35:13 +00:00
|
|
|
all: ; \@echo This makefile did not clean the dir ... good
|
2016-12-23 18:33:58 +00:00
|
|
|
clean: ; $CMD_rmfile EXAMPLE\$(ext)
|
|
|
|
!;
|
2004-11-29 01:35:13 +00:00
|
|
|
close(MAKEFILE);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-11-29 01:35:13 +00:00
|
|
|
# TEST #1
|
|
|
|
# -------
|
2016-12-23 18:33:58 +00:00
|
|
|
touch($example);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
run_make_with_options("${testname}.mk", "-C $workdir clean", &get_logfile);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2019-09-15 19:30:34 +00:00
|
|
|
use Cwd;
|
|
|
|
|
2004-11-29 01:35:13 +00:00
|
|
|
chdir $workdir;
|
2019-09-15 19:30:34 +00:00
|
|
|
$wpath = cwd();
|
|
|
|
chdir $cwdpath;
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-11-29 01:35:13 +00:00
|
|
|
if (-f $example) {
|
|
|
|
$test_passed = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Create the answer to what should be produced by this Makefile
|
2012-03-04 00:24:20 +00:00
|
|
|
$answer = "$make_name: Entering directory '$wpath'\n"
|
2016-12-23 18:33:58 +00:00
|
|
|
. "$CMD_rmfile EXAMPLE\n"
|
2012-03-04 00:24:20 +00:00
|
|
|
. "$make_name: Leaving directory '$wpath'\n";
|
2004-11-29 01:35:13 +00:00
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
compare_output($answer,&get_logfile(1));
|
2004-11-29 01:35:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
# TEST #2
|
|
|
|
# -------
|
|
|
|
# Do it again with trailing "/"; this should work the same
|
|
|
|
|
|
|
|
$example .= "slash";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
touch($example);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
run_make_with_options("${testname}.mk", "-C $workdir/ clean ext=slash", &get_logfile);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-05-16 19:16:52 +00:00
|
|
|
if (-f $example) {
|
|
|
|
$test_passed = 0;
|
|
|
|
}
|
|
|
|
|
1999-09-14 02:03:19 +00:00
|
|
|
# Create the answer to what should be produced by this Makefile
|
2012-03-04 00:24:20 +00:00
|
|
|
$answer = "$make_name: Entering directory '$wpath'\n"
|
2016-12-23 18:33:58 +00:00
|
|
|
. "$CMD_rmfile EXAMPLEslash\n"
|
2012-03-04 00:24:20 +00:00
|
|
|
. "$make_name: Leaving directory '$wpath'\n";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
&compare_output($answer,&get_logfile(1));
|
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
unlink($example);
|
1999-09-14 02:03:19 +00:00
|
|
|
1;
|