From 3dd1faa5c849dbeb59a88653068c010699ce86f7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 14 Nov 2005 15:31:13 +0000 Subject: Implemented the .INCLUDE_DIRS special variable. It expands to a list of directories that make searches for included makefiles. --- ChangeLog | 7 ++++++ NEWS | 2 ++ doc/make.texi | 5 ++++ read.c | 7 +++++- tests/ChangeLog | 5 ++++ tests/scripts/variables/INCLUDE_DIRS | 46 ++++++++++++++++++++++++++++++++++++ 6 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 tests/scripts/variables/INCLUDE_DIRS diff --git a/ChangeLog b/ChangeLog index 7565fb0..6445cc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-11-14 Boris Kolpackov + + * 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 * read.c (record_files): Don't set deps flags if there are no deps. diff --git a/NEWS b/NEWS index e6b3322..01e9016 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/doc/make.texi b/doc/make.texi index cc5f061..62ad82e 100644 --- a/doc/make.texi +++ b/doc/make.texi @@ -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 diff --git a/read.c b/read.c index 9fbfd35..894bf6f 100644 --- a/read.c +++ b/read.c @@ -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; diff --git a/tests/ChangeLog b/tests/ChangeLog index c936301..d30f0c9 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2005-11-14 Boris Kolpackov + + * scripts/variables/INCLUDE_DIRS: Add a test for the .INCLUDE_DIRS + special variable. + 2005-10-24 Paul D. Smith * scripts/misc/general4: Test '$$' in prerequisites list. diff --git a/tests/scripts/variables/INCLUDE_DIRS b/tests/scripts/variables/INCLUDE_DIRS new file mode 100644 index 0000000..c9662e9 --- /dev/null +++ b/tests/scripts/variables/INCLUDE_DIRS @@ -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; -- cgit v1.2.3