Commit 182d89a3 by Neil Booth Committed by Neil Booth

re PR preprocessor/7358 (Changes to Sun's make Dependencies)

	PR preprocessor/7358
	* c-opts.c (check_deps_environment_vars): Ignore main file
	for SUNPRO_DEPENDENCIES.
	* cppfiles.c (stack_include_file): Ignore main file if
	appropriate.
	* cpplib.h (struct cpp_options): New member in deps.
	* doc/cppenv.texi: Update.

From-SVN: r56333
parent 8bfb1467
2002-08-15 Neil Booth <neil@daikokuya.co.uk>
PR preprocessor/7358
* c-opts.c (check_deps_environment_vars): Ignore main file
for SUNPRO_DEPENDENCIES.
* cppfiles.c (stack_include_file): Ignore main file if
appropriate.
* cpplib.h (struct cpp_options): New member in deps.
* doc/cppenv.texi: Update.
2002-08-14 Neil Booth <neil@daikokuya.co.uk> 2002-08-14 Neil Booth <neil@daikokuya.co.uk>
PR preprocessor/7526 PR preprocessor/7526
......
...@@ -1467,7 +1467,8 @@ c_common_finish () ...@@ -1467,7 +1467,8 @@ c_common_finish ()
DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to
and DEPS_TARGET is the target to mention in the deps. They also and DEPS_TARGET is the target to mention in the deps. They also
result in dependency information being appended to the output file result in dependency information being appended to the output file
rather than overwriting it. */ rather than overwriting it, and like Sun's compiler
SUNPRO_DEPENDENCIES suppresses the dependency on the main file. */
static void static void
check_deps_environment_vars () check_deps_environment_vars ()
{ {
...@@ -1480,7 +1481,10 @@ check_deps_environment_vars () ...@@ -1480,7 +1481,10 @@ check_deps_environment_vars ()
{ {
GET_ENVIRONMENT (spec, "SUNPRO_DEPENDENCIES"); GET_ENVIRONMENT (spec, "SUNPRO_DEPENDENCIES");
if (spec) if (spec)
{
cpp_opts->deps.style = DEPS_SYSTEM; cpp_opts->deps.style = DEPS_SYSTEM;
cpp_opts->deps.ignore_main_file = true;
}
} }
if (spec) if (spec)
......
...@@ -318,9 +318,12 @@ stack_include_file (pfile, inc) ...@@ -318,9 +318,12 @@ stack_include_file (pfile, inc)
sysp = MAX ((pfile->map ? pfile->map->sysp : 0), sysp = MAX ((pfile->map ? pfile->map->sysp : 0),
(inc->foundhere ? inc->foundhere->sysp : 0)); (inc->foundhere ? inc->foundhere->sysp : 0));
/* For -M, add the file to the dependencies on its first inclusion. */ /* Add the file to the dependencies on its first inclusion. */
if (CPP_OPTION (pfile, deps.style) > !!sysp && !inc->include_count) if (CPP_OPTION (pfile, deps.style) > !!sysp && !inc->include_count)
{
if (pfile->buffer || CPP_OPTION (pfile, deps.ignore_main_file) == 0)
deps_add_dep (pfile->deps, inc->name); deps_add_dep (pfile->deps, inc->name);
}
/* Not in cache? */ /* Not in cache? */
if (! inc->buffer) if (! inc->buffer)
......
...@@ -387,6 +387,9 @@ struct cpp_options ...@@ -387,6 +387,9 @@ struct cpp_options
/* Generate phony targets for each dependency apart from the first /* Generate phony targets for each dependency apart from the first
one. */ one. */
bool phony_targets; bool phony_targets;
/* If true, no dependency is generated on the main file. */
bool ignore_main_file;
} deps; } deps;
/* Target-specific features set by the front end or client. */ /* Target-specific features set by the front end or client. */
......
...@@ -72,7 +72,8 @@ with an optional @option{-MT} switch too. ...@@ -72,7 +72,8 @@ with an optional @option{-MT} switch too.
@cindex dependencies for make as output @cindex dependencies for make as output
This variable is the same as @env{DEPENDENCIES_OUTPUT} (see above), This variable is the same as @env{DEPENDENCIES_OUTPUT} (see above),
except that system header files are not ignored, so it implies except that system header files are not ignored, so it implies
@option{-M} rather than @option{-MM}. @option{-M} rather than @option{-MM}. However, the dependence on the
main input file is omitted.
@ifset cppmanual @ifset cppmanual
@xref{Invocation}. @xref{Invocation}.
@end ifset @end ifset
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment