2006-02-14 18:36:04 +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 cmMakefileTargetGenerator_h
|
|
|
|
#define cmMakefileTargetGenerator_h
|
|
|
|
|
|
|
|
#include "cmLocalUnixMakefileGenerator3.h"
|
|
|
|
|
|
|
|
class cmCustomCommand;
|
|
|
|
class cmDependInformation;
|
|
|
|
class cmDepends;
|
|
|
|
class cmGeneratedFileStream;
|
|
|
|
class cmGlobalGenerator;
|
|
|
|
class cmLocalUnixMakefileGenerator3;
|
|
|
|
class cmMakeDepend;
|
|
|
|
class cmMakefile;
|
|
|
|
class cmTarget;
|
|
|
|
class cmSourceFile;
|
|
|
|
|
|
|
|
/** \class cmMakefileTargetGenerator
|
|
|
|
* \brief Support Routines for writing makefiles
|
|
|
|
*
|
|
|
|
*/
|
2006-03-28 17:54:01 +04:00
|
|
|
class cmMakefileTargetGenerator
|
2006-02-14 18:36:04 +03:00
|
|
|
{
|
|
|
|
public:
|
2006-02-15 20:32:43 +03:00
|
|
|
// constructor to set the ivars
|
|
|
|
cmMakefileTargetGenerator();
|
|
|
|
virtual ~cmMakefileTargetGenerator() {};
|
|
|
|
|
2006-02-14 18:36:04 +03:00
|
|
|
// construct using this factory call
|
|
|
|
static cmMakefileTargetGenerator *New(cmLocalUnixMakefileGenerator3 *lg,
|
|
|
|
cmStdString tgtName,
|
|
|
|
cmTarget *tgt);
|
|
|
|
|
|
|
|
/* the main entry point for this class. Writes the Makefiles associated
|
|
|
|
with this target */
|
|
|
|
virtual void WriteRuleFiles() = 0;
|
2006-03-28 17:54:01 +04:00
|
|
|
|
2006-07-11 17:55:27 +04:00
|
|
|
/* the main entry point for this class. Writes the Makefiles associated
|
|
|
|
with this target */
|
|
|
|
virtual void WriteProgressVariables(unsigned long total,
|
|
|
|
unsigned long ¤t);
|
|
|
|
|
|
|
|
/* return the number of actions that have progress reporting on them */
|
|
|
|
virtual unsigned long GetNumberOfProgressActions() {
|
|
|
|
return this->NumberOfProgressActions;}
|
|
|
|
|
|
|
|
const char *GetTargetName() { return this->TargetName.c_str(); }
|
|
|
|
|
2006-02-14 18:36:04 +03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// create the file and directory etc
|
|
|
|
void CreateRuleFile();
|
2006-03-28 17:54:01 +04:00
|
|
|
|
2006-06-01 19:45:51 +04:00
|
|
|
// outputs the rules for object files and custom commands used by
|
|
|
|
// this target
|
|
|
|
void WriteTargetBuildRules();
|
2006-02-14 18:36:04 +03:00
|
|
|
|
|
|
|
// write some common code at the top of build.make
|
|
|
|
void WriteCommonCodeRules();
|
2006-06-01 19:45:51 +04:00
|
|
|
void WriteTargetLanguageFlags();
|
2006-02-14 18:36:04 +03:00
|
|
|
|
|
|
|
// write the provide require rules for this target
|
|
|
|
void WriteTargetRequiresRules();
|
|
|
|
|
|
|
|
// write the clean rules for this target
|
|
|
|
void WriteTargetCleanRules();
|
|
|
|
|
|
|
|
// write the depend rules for this target
|
|
|
|
void WriteTargetDependRules();
|
|
|
|
|
|
|
|
// write the rules for an object
|
|
|
|
void WriteObjectRuleFiles(cmSourceFile& source);
|
|
|
|
|
|
|
|
// write the build rule for an object
|
|
|
|
void WriteObjectBuildFile(std::string &obj,
|
2006-03-28 17:54:01 +04:00
|
|
|
const char *lang,
|
2006-02-14 18:36:04 +03:00
|
|
|
cmSourceFile& source,
|
|
|
|
std::vector<std::string>& depends);
|
2006-03-28 17:54:01 +04:00
|
|
|
|
2006-02-14 18:36:04 +03:00
|
|
|
// write the depend.make file for an object
|
|
|
|
void WriteObjectDependRules(cmSourceFile& source,
|
|
|
|
std::vector<std::string>& depends);
|
2006-03-28 17:54:01 +04:00
|
|
|
|
2006-06-01 19:45:51 +04:00
|
|
|
// write the build rule for a custom command
|
2006-02-14 18:36:04 +03:00
|
|
|
void GenerateCustomRuleFile(const cmCustomCommand& cc);
|
2006-03-28 17:54:01 +04:00
|
|
|
|
2006-02-14 18:36:04 +03:00
|
|
|
// write out the variable that lists the objects for this target
|
|
|
|
void WriteObjectsVariable(std::string& variableName,
|
|
|
|
std::string& variableNameExternal);
|
2006-06-16 00:17:11 +04:00
|
|
|
void WriteObjectsString(std::string& buildObjs);
|
2006-03-28 17:54:01 +04:00
|
|
|
|
2006-06-01 19:45:51 +04:00
|
|
|
// write the driver rule to build target outputs
|
|
|
|
void WriteTargetDriverRule(const char* main_output, bool relink);
|
|
|
|
|
2006-09-29 00:40:35 +04:00
|
|
|
void DriveCustomCommands(std::vector<std::string>& depends);
|
|
|
|
|
2006-02-14 18:36:04 +03:00
|
|
|
// Return the a string with -F flags on apple
|
|
|
|
std::string GetFrameworkFlags();
|
2006-03-28 17:54:01 +04:00
|
|
|
|
2006-02-14 18:36:04 +03:00
|
|
|
// append intertarget dependencies
|
|
|
|
void AppendTargetDepends(std::vector<std::string>& depends);
|
|
|
|
|
|
|
|
virtual void CloseFileStreams();
|
2006-03-28 17:54:01 +04:00
|
|
|
void RemoveForbiddenFlags(const char* flagVar, const char* linkLang,
|
2006-03-14 22:03:16 +03:00
|
|
|
std::string& linkFlags);
|
2006-02-14 18:36:04 +03:00
|
|
|
cmStdString TargetName;
|
|
|
|
cmTarget *Target;
|
|
|
|
cmLocalUnixMakefileGenerator3 *LocalGenerator;
|
|
|
|
cmGlobalGenerator *GlobalGenerator;
|
|
|
|
cmMakefile *Makefile;
|
2006-03-28 17:54:01 +04:00
|
|
|
|
2006-09-29 00:40:35 +04:00
|
|
|
bool DriveCustomCommandsOnDepends;
|
|
|
|
|
2006-02-14 18:36:04 +03:00
|
|
|
// the full path to the build file
|
|
|
|
std::string BuildFileName;
|
|
|
|
std::string BuildFileNameFull;
|
|
|
|
|
2006-07-11 17:55:27 +04:00
|
|
|
// the full path to the progress file
|
|
|
|
std::string ProgressFileName;
|
|
|
|
std::string ProgressFileNameFull;
|
|
|
|
unsigned long NumberOfProgressActions;
|
|
|
|
|
2006-02-14 18:36:04 +03:00
|
|
|
// the path to the directory the build file is in
|
|
|
|
std::string TargetBuildDirectory;
|
|
|
|
std::string TargetBuildDirectoryFull;
|
|
|
|
|
|
|
|
// the stream for the build file
|
|
|
|
cmGeneratedFileStream *BuildFileStream;
|
|
|
|
|
|
|
|
// the stream for the flag file
|
|
|
|
std::string FlagFileNameFull;
|
|
|
|
cmGeneratedFileStream *FlagFileStream;
|
|
|
|
|
|
|
|
// the stream for the info file
|
|
|
|
std::string InfoFileNameFull;
|
|
|
|
cmGeneratedFileStream *InfoFileStream;
|
|
|
|
|
|
|
|
// files to clean
|
|
|
|
std::vector<std::string> CleanFiles;
|
|
|
|
|
|
|
|
// objects used by this target
|
|
|
|
std::vector<std::string> Objects;
|
|
|
|
std::vector<std::string> ExternalObjects;
|
2006-03-28 17:54:01 +04:00
|
|
|
std::set<std::string> ExtraContent;
|
2006-02-14 18:36:04 +03:00
|
|
|
|
|
|
|
// Set of object file names that will be built in this directory.
|
2006-03-15 19:02:08 +03:00
|
|
|
std::set<cmStdString> ObjectFiles;
|
2006-02-14 18:36:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
//==================================================================
|
2006-03-28 17:54:01 +04:00
|
|
|
// Convenience routines that do nothing more than forward to
|
2006-02-14 18:36:04 +03:00
|
|
|
// implementaitons
|
2006-03-28 17:54:01 +04:00
|
|
|
std::string Convert(const char* source,
|
|
|
|
cmLocalGenerator::RelativeRoot relative,
|
|
|
|
cmLocalGenerator::OutputFormat output =
|
2006-02-14 18:36:04 +03:00
|
|
|
cmLocalGenerator::UNCHANGED,
|
2006-03-28 17:54:01 +04:00
|
|
|
bool optional = false)
|
2006-02-14 18:36:04 +03:00
|
|
|
{
|
|
|
|
return this->LocalGenerator->Convert(source, relative, output, optional);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|