diff options
author | Daniel Franke <franke.daniel@gmail.com> | 2010-06-13 12:05:01 -0400 |
---|---|---|
committer | Daniel Franke <dfranke@gcc.gnu.org> | 2010-06-13 12:05:01 -0400 |
commit | d8ddea4044ee8212d5fe305e8e2a547700cd7b8f (patch) | |
tree | 7a5503c8e4ec3840ceca10f783c86bdc8998d3d0 /gcc/fortran/scanner.c | |
parent | 2d9ca17ba98b2fcf77b8df192634a27f8e5d4d5b (diff) | |
download | gcc-d8ddea4044ee8212d5fe305e8e2a547700cd7b8f.zip gcc-d8ddea4044ee8212d5fe305e8e2a547700cd7b8f.tar.gz gcc-d8ddea4044ee8212d5fe305e8e2a547700cd7b8f.tar.bz2 |
re PR fortran/31588 (gfortran should be able to output Makefile dependencies with -M* options)
2010-06-13 Daniel Franke <franke.daniel@gmail.com>
PR fortran/31588
PR fortran/43954
* gfortranspec.c (lang_specific_driver): Removed deprecation
warning for -M.
* lang.opt: Add options -M, -MM, -MD, -MMD, -MF, -MG, -MP, -MT, -MQ.
* lang-specs.h (CPP_FORWARD_OPTIONS): Add -M* options.
* cpp.h (gfc_cpp_makedep): New.
(gfc_cpp_add_dep): New.
(gfc_cpp_add_target): New.
* cpp.c (gfc_cpp_option): Add deps* members.
(gfc_cpp_makedep): New.
(gfc_cpp_add_dep): New.
(gfc_cpp_add_target): New.
(gfc_cpp_init_options): Initialize new options.
(gfc_cpp_handle_option): Handle new options.
(gfc_cpp_post_options): Map new options to libcpp-options.
(gfc_cpp_init): Handle deferred -MQ and -MT options.
(gfc_cpp_done): If requested, write dependencies to file.
* module.c (gfc_dump_module): Add a module filename as target.
* scanner.c (open_included_file): New parameter system; add the
included file as dependency.
(gfc_open_included_file): Add the included file as dependency.
(gfc_open_intrinsic_module): Likewise.
* invoke.texi: Removed deprecation warning for -M.
* gfortran.texi: Removed Makefile-dependencies project.
From-SVN: r160684
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r-- | gcc/fortran/scanner.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 7b4ab24..a8ab235 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -390,7 +390,8 @@ gfc_release_include_path (void) static FILE * -open_included_file (const char *name, gfc_directorylist *list, bool module) +open_included_file (const char *name, gfc_directorylist *list, + bool module, bool system) { char *fullname; gfc_directorylist *p; @@ -407,7 +408,12 @@ open_included_file (const char *name, gfc_directorylist *list, bool module) f = gfc_open_file (fullname); if (f != NULL) - return f; + { + if (gfc_cpp_makedep ()) + gfc_cpp_add_dep (fullname, system); + + return f; + } } return NULL; @@ -421,28 +427,37 @@ open_included_file (const char *name, gfc_directorylist *list, bool module) FILE * gfc_open_included_file (const char *name, bool include_cwd, bool module) { - FILE *f; + FILE *f = NULL; - if (IS_ABSOLUTE_PATH (name)) - return gfc_open_file (name); - - if (include_cwd) + if (IS_ABSOLUTE_PATH (name) || include_cwd) { f = gfc_open_file (name); - if (f != NULL) - return f; + if (f && gfc_cpp_makedep ()) + gfc_cpp_add_dep (name, false); } - return open_included_file (name, include_dirs, module); + if (!f) + f = open_included_file (name, include_dirs, module, false); + + return f; } FILE * gfc_open_intrinsic_module (const char *name) { + FILE *f = NULL; + if (IS_ABSOLUTE_PATH (name)) - return gfc_open_file (name); + { + f = gfc_open_file (name); + if (f && gfc_cpp_makedep ()) + gfc_cpp_add_dep (name, true); + } + + if (!f) + f = open_included_file (name, intrinsic_modules_dirs, true, true); - return open_included_file (name, intrinsic_modules_dirs, true); + return f; } |