2005-01-19 01:09:05 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#ifndef cmDepends_h
|
|
|
|
#define cmDepends_h
|
|
|
|
|
|
|
|
#include "cmStandardIncludes.h"
|
|
|
|
|
2005-10-12 21:52:29 +04:00
|
|
|
class cmFileTimeComparison;
|
2006-05-25 17:47:30 +04:00
|
|
|
class cmLocalGenerator;
|
2005-10-12 21:52:29 +04:00
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
/** \class cmDepends
|
|
|
|
* \brief Dependency scanner superclass.
|
|
|
|
*
|
|
|
|
* This class is responsible for maintaining a .depends.make file in
|
|
|
|
* the build tree corresponding to an object file. Subclasses help it
|
|
|
|
* maintain dependencies for particular languages.
|
|
|
|
*/
|
|
|
|
class cmDepends
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Instances need to know the build directory name and the relative
|
|
|
|
path from the build directory to the target file. */
|
2005-05-11 21:16:45 +04:00
|
|
|
cmDepends();
|
|
|
|
|
2005-05-25 20:22:32 +04:00
|
|
|
/** at what level will the compile be done from */
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;};
|
2006-05-25 17:47:30 +04:00
|
|
|
|
|
|
|
/** Set the local generator for the directory in which we are
|
|
|
|
scanning dependencies. This is not a full local generator; it
|
|
|
|
has been setup to do relative path conversions for the current
|
|
|
|
directory. */
|
|
|
|
void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; }
|
|
|
|
|
2007-12-23 06:41:42 +03:00
|
|
|
/** Set the specific language to be scanned. */
|
|
|
|
void SetLanguage(const char* lang) { this->Language = lang; }
|
|
|
|
|
|
|
|
/** Set the target build directory. */
|
|
|
|
void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; }
|
|
|
|
|
2005-05-11 21:16:45 +04:00
|
|
|
/** should this be verbose in its output */
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetVerbose(bool verb) { this->Verbose = verb; }
|
2005-05-11 21:16:45 +04:00
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
/** Virtual destructor to cleanup subclasses properly. */
|
|
|
|
virtual ~cmDepends();
|
|
|
|
|
|
|
|
/** Write dependencies for the target file. */
|
2007-12-23 06:41:42 +03:00
|
|
|
bool Write(std::ostream &makeDepends, std::ostream &internalDepends);
|
2005-07-27 17:49:37 +04:00
|
|
|
|
2007-12-20 00:36:30 +03:00
|
|
|
/** Check dependencies for the target file. Returns true if
|
|
|
|
dependencies are okay and false if they must be generated. If
|
|
|
|
they must be generated Clear has already been called to wipe out
|
|
|
|
the old dependencies. */
|
|
|
|
bool Check(const char *makeFile, const char* internalFile);
|
2005-01-19 01:09:05 +03:00
|
|
|
|
|
|
|
/** Clear dependencies for the target file so they will be regenerated. */
|
2005-07-27 17:49:37 +04:00
|
|
|
void Clear(const char *file);
|
2005-01-19 01:09:05 +03:00
|
|
|
|
2005-10-12 21:52:29 +04:00
|
|
|
/** Set the file comparison object */
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetFileComparison(cmFileTimeComparison* fc) {
|
|
|
|
this->FileComparison = fc; }
|
2005-10-12 21:52:29 +04:00
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// Write dependencies for the target file to the given stream.
|
|
|
|
// Return true for success and false for failure.
|
2005-10-12 21:52:29 +04:00
|
|
|
virtual bool WriteDependencies(const char *src, const char* obj,
|
2007-12-20 00:36:30 +03:00
|
|
|
std::ostream& makeDepends, std::ostream& internalDepends);
|
2005-01-19 01:09:05 +03:00
|
|
|
|
|
|
|
// Check dependencies for the target file in the given stream.
|
|
|
|
// Return false if dependencies must be regenerated and true
|
|
|
|
// otherwise.
|
2005-10-12 21:52:29 +04:00
|
|
|
virtual bool CheckDependencies(std::istream& internalDepends);
|
2005-01-19 01:09:05 +03:00
|
|
|
|
2007-12-28 19:49:59 +03:00
|
|
|
// Finalize the dependency information for the target.
|
|
|
|
virtual bool Finalize(std::ostream& makeDepends,
|
|
|
|
std::ostream& internalDepends);
|
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
// The directory in which the build rule for the target file is executed.
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string CompileDirectory;
|
2005-01-19 01:09:05 +03:00
|
|
|
|
2006-05-25 17:47:30 +04:00
|
|
|
// The local generator.
|
|
|
|
cmLocalGenerator* LocalGenerator;
|
2006-05-03 18:07:08 +04:00
|
|
|
|
2005-05-06 17:58:58 +04:00
|
|
|
// Flag for verbose output.
|
2006-03-15 19:02:08 +03:00
|
|
|
bool Verbose;
|
|
|
|
cmFileTimeComparison* FileComparison;
|
2005-10-12 21:52:29 +04:00
|
|
|
|
2007-12-23 06:41:42 +03:00
|
|
|
std::string Language;
|
|
|
|
|
|
|
|
// The full path to the target's build directory.
|
|
|
|
std::string TargetDirectory;
|
|
|
|
|
2006-03-15 19:02:08 +03:00
|
|
|
size_t MaxPath;
|
|
|
|
char* Dependee;
|
|
|
|
char* Depender;
|
2005-05-06 17:58:58 +04:00
|
|
|
|
2005-01-19 01:09:05 +03:00
|
|
|
private:
|
|
|
|
cmDepends(cmDepends const&); // Purposely not implemented.
|
|
|
|
void operator=(cmDepends const&); // Purposely not implemented.
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|