Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmDependsFortran.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmDependsFortran_h
13 #define cmDependsFortran_h
14
15 #include "cmDepends.h"
16
17 class cmDependsFortranInternals;
18 class cmDependsFortranSourceInfo;
19
20 /** \class cmDependsFortran
21  * \brief Dependency scanner for Fortran object files.
22  */
23 class cmDependsFortran: public cmDepends
24 {
25 public:
26   /** Checking instances need to know the build directory name and the
27       relative path from the build directory to the target file.  */
28   cmDependsFortran();
29
30   /** Scanning need to know the build directory name, the relative
31       path from the build directory to the target file, the source
32       file from which to start scanning, the include file search
33       path, and the target directory.  */
34   cmDependsFortran(cmLocalGenerator* lg);
35
36   /** Virtual destructor to cleanup subclasses properly.  */
37   virtual ~cmDependsFortran();
38
39   /** Callback from build system after a .mod file has been generated
40       by a Fortran90 compiler to copy the .mod file to the
41       corresponding stamp file.  */
42   static bool CopyModule(const std::vector<std::string>& args);
43
44   /** Determine if a mod file and the corresponding mod.stamp file
45       are representing  different module information. */
46   static bool  ModulesDiffer(const char* modFile, const char* stampFile,
47                              const char* compilerId);
48
49   /** Method to find an included file in the include path.  Fortran
50       always searches the directory containing the including source
51       first.  */
52   bool FindIncludeFile(const char* dir, const char* includeName,
53                        std::string& fileName);
54
55 protected:
56   // Finalize the dependency information for the target.
57   virtual bool Finalize(std::ostream& makeDepends,
58                         std::ostream& internalDepends);
59
60   // Find all the modules required by the target.
61   void LocateModules();
62   void MatchLocalModules();
63   void MatchRemoteModules(std::istream& fin, const char* stampDir);
64   void ConsiderModule(const char* name, const char* stampDir);
65   bool FindModule(std::string const& name, std::string& module);
66
67   // Implement writing/checking methods required by superclass.
68   virtual bool WriteDependencies(
69     const std::set<std::string>& sources, const std::string& file,
70     std::ostream& makeDepends, std::ostream& internalDepends);
71
72   // Actually write the depenencies to the streams.
73   bool WriteDependenciesReal(const char *obj,
74                              cmDependsFortranSourceInfo const& info,
75                              const char* mod_dir, const char* stamp_dir,
76                              std::ostream& makeDepends,
77                              std::ostream& internalDepends);
78
79   // The source file from which to start scanning.
80   std::string SourceFile;
81
82   std::vector<std::string> PPDefinitions;
83
84   // Internal implementation details.
85   cmDependsFortranInternals* Internal;
86
87 private:
88   cmDependsFortran(cmDependsFortran const&); // Purposely not implemented.
89   void operator=(cmDependsFortran const&); // Purposely not implemented.
90 };
91
92 #endif