2005-11-14 15:31:13 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
$description = "Test the .INCLUDE_DIRS special variable.";
|
|
|
|
|
|
|
|
$details = "";
|
|
|
|
|
|
|
|
use Cwd;
|
|
|
|
|
|
|
|
$dir = cwd;
|
|
|
|
$dir =~ s,.*/([^/]+)$,../$1,;
|
|
|
|
|
|
|
|
# Test #1: The content of .INCLUDE_DIRS depends on the platform for which
|
|
|
|
# make was built. What we know for sure is that it shouldn't be
|
|
|
|
# empty.
|
|
|
|
#
|
|
|
|
run_make_test('
|
|
|
|
ifeq ($(.INCLUDE_DIRS),)
|
|
|
|
$(warning .INCLUDE_DIRS is empty)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all:;@:
|
|
|
|
',
|
2021-05-30 22:47:50 +00:00
|
|
|
'', '');
|
2005-11-14 15:31:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Test #2: Make sure -I paths end up in .INCLUDE_DIRS.
|
|
|
|
#
|
|
|
|
run_make_test('
|
|
|
|
ifeq ($(dir),)
|
|
|
|
$(warning dir is empty)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(filter $(dir),$(.INCLUDE_DIRS)),)
|
2021-09-05 21:11:44 +00:00
|
|
|
$(warning .INCLUDE_DIRS does not contain $(dir): $(.INCLUDE_DIRS))
|
2005-11-14 15:31:13 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all:;@:
|
|
|
|
',
|
2021-05-30 22:47:50 +00:00
|
|
|
"-I$dir dir=$dir", '');
|
2005-11-14 15:31:13 +00:00
|
|
|
|
2021-05-30 22:47:50 +00:00
|
|
|
# Find the default .INCLUDE_DIRS
|
|
|
|
create_file('defaultdirs.mk', "\$(info \$(.INCLUDE_DIRS))\nall:;\@:\n");
|
|
|
|
my $cmd = subst_make_string("#MAKEPATH# -f defaultdirs.mk");
|
|
|
|
my @dirs = `$cmd`;
|
|
|
|
my $dirs = $dirs[0];
|
|
|
|
chomp $dirs;
|
|
|
|
unlink('defaultdirs.mk');
|
|
|
|
|
|
|
|
run_make_test("
|
|
|
|
ifneq (\$(.INCLUDE_DIRS),$dirs)
|
|
|
|
\$(warning Mismatched \$(.INCLUDE_DIRS) != $dirs)
|
|
|
|
endif
|
|
|
|
all:;\@:
|
|
|
|
",
|
|
|
|
'', '');
|
|
|
|
|
|
|
|
# Verify that -I- disables content from .INCLUDE_DIRS
|
|
|
|
|
|
|
|
run_make_test("
|
|
|
|
ifneq (\$(.INCLUDE_DIRS),)
|
|
|
|
\$(warning Mismatched \$(.INCLUDE_DIRS) != )
|
|
|
|
endif
|
|
|
|
all:;\@:
|
|
|
|
",
|
|
|
|
'-I-', '');
|
|
|
|
|
|
|
|
# Prefix -I dirs to the front
|
|
|
|
mkdir('somedir', 0777);
|
|
|
|
|
|
|
|
run_make_test("
|
|
|
|
ifneq (\$(.INCLUDE_DIRS),somedir $dirs)
|
|
|
|
\$(warning Mismatched \$(.INCLUDE_DIRS) != somedir $dirs)
|
|
|
|
endif
|
|
|
|
all:;\@:
|
|
|
|
",
|
|
|
|
'-I somedir', '');
|
|
|
|
|
|
|
|
# Verify .INCLUDE_DIRS contains files after -I-
|
|
|
|
|
|
|
|
run_make_test("
|
|
|
|
ifneq (\$(.INCLUDE_DIRS),somedir)
|
|
|
|
\$(warning Mismatched \$(.INCLUDE_DIRS) != somedir)
|
|
|
|
endif
|
|
|
|
all:;\@:
|
|
|
|
",
|
|
|
|
'-I - -I somedir', '');
|
|
|
|
|
|
|
|
rmdir('somedir');
|
2005-11-14 15:31:13 +00:00
|
|
|
|
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
|
|
1;
|