Implemented the .INCLUDE_DIRS special variable. It expands to a list

of directories that make searches for included makefiles.
This commit is contained in:
Boris Kolpackov 2005-11-14 15:31:13 +00:00
parent 82103b1a49
commit 3dd1faa5c8
6 changed files with 71 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2005-11-14 Boris Kolpackov <boris@kolpackov.net>
* read.c (construct_include_path): Set the .INCLUDE_DIRS special
variable.
* doc/make.texi (Special Variables): Document .INCLUDE_DIRS.
* NEWS: Add .INCLUDE_DIRS to the list of new special variables.
2005-10-26 Paul Smith <psmith@gnu.org>
* read.c (record_files): Don't set deps flags if there are no deps.

2
NEWS
View File

@ -66,6 +66,8 @@ Version 3.81beta3
load average accordingly.
* New special variables available in this release:
- .INCLUDE_DIRS: Expands to a list of directories that make searches
for included makefiles.
- .FEATURES: Contains a list of special features available in this
version of GNU make.
- .DEFAULT_GOAL: Set the name of the default goal make will

View File

@ -1390,6 +1390,11 @@ Supports the @code{-L} (@code{--check-symlink-times}) flag.
@end table
@vindex .INCLUDE_DIRS @r{(list of include directories)}
@item .INCLUDE_DIRS
Expands to a list of directories that @code{make} searches for
included makefiles (@pxref{Include, , Including Other Makefiles}).
@end table
@node Remaking Makefiles, Overriding Makefiles, Special Variables, Makefiles

7
read.c
View File

@ -2917,7 +2917,8 @@ construct_include_path (char **arg_dirs)
dirs[idx] = 0;
/* Now compute the maximum length of any name in it. */
/* Now compute the maximum length of any name in it. Also add each
dir to the .INCLUDE_DIRS variable. */
max_incl_len = 0;
for (i = 0; i < idx; ++i)
@ -2930,6 +2931,10 @@ construct_include_path (char **arg_dirs)
dirs[i] = savestring (dirs[i], len - 1);
if (len > max_incl_len)
max_incl_len = len;
/* Append to .INCLUDE_DIRS. */
do_variable_definition (NILF, ".INCLUDE_DIRS", dirs[i],
o_default, f_append, 0);
}
include_directories = dirs;

View File

@ -1,3 +1,8 @@
2005-11-14 Boris Kolpackov <boris@kolpackov.net>
* scripts/variables/INCLUDE_DIRS: Add a test for the .INCLUDE_DIRS
special variable.
2005-10-24 Paul D. Smith <psmith@gnu.org>
* scripts/misc/general4: Test '$$' in prerequisites list.

View File

@ -0,0 +1,46 @@
# -*-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:;@:
',
'',
'');
# 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)),)
$(warning .INCLUDE_DIRS does not contain $(dir))
endif
.PHONY: all
all:;@:
',
"-I$dir dir=$dir",
'');
# This tells the test driver that the perl test script executed properly.
1;