2004-11-29 01:35:13 +00:00
|
|
|
# -*-perl-*-
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2023-01-01 21:25:39 +00:00
|
|
|
$description = "Test the -C option to GNU Make.";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
use File::Spec;
|
2004-11-29 01:35:13 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
# Pre-set $makefile to be in a subdirectory
|
|
|
|
$makefile = 'Makefile';
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
my $_srcdir = 'src';
|
|
|
|
mkdir($_srcdir, 0775);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
my $_incdir = 'inc';
|
|
|
|
mkdir($_incdir, 0775);
|
2004-11-29 01:35:13 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
my $_mkpath = File::Spec->catfile($_srcdir, $makefile);
|
|
|
|
create_file($_mkpath, "include \$(file)\nall: ;\n");
|
2004-11-29 01:35:13 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
# TEST #1
|
|
|
|
# -------
|
|
|
|
run_make_test('', "-C $_srcdir --no-print-directory",
|
|
|
|
"#MAKE#: 'all' is up to date.");
|
2004-11-29 01:35:13 +00:00
|
|
|
|
|
|
|
# TEST #2
|
|
|
|
# -------
|
|
|
|
# Do it again with trailing "/"; this should work the same
|
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
run_make_test(undef, "-C $_srcdir/ --no-print-directory",
|
|
|
|
"#MAKE#: 'all' is up to date.");
|
|
|
|
|
|
|
|
# Test stringing together multiple -C options
|
|
|
|
|
|
|
|
run_make_test(undef, "-C $_incdir -C .. -C $_srcdir --no-print-directory",
|
|
|
|
"#MAKE#: 'all' is up to date.");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
# SV 63552 - Ensure -I is considered after -C
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
my $_incfile = 'test';
|
|
|
|
my $_incpath = File::Spec->catfile($_incdir, $_incfile);
|
|
|
|
create_file($_incpath, '$(info included)');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
my $_incopt = File::Spec->catfile('..', $_incdir);
|
2004-05-16 19:16:52 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
run_make_test(undef, "-C src -I $_incopt --no-print-directory file=$_incfile",
|
|
|
|
"included\n#MAKE#: 'all' is up to date.");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
unlink($_incpath);
|
|
|
|
rmdir($_incdir);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2022-12-24 14:26:24 +00:00
|
|
|
unlink($_mkpath);
|
|
|
|
rmdir($_srcdir);
|
1999-09-14 02:03:19 +00:00
|
|
|
1;
|