CMake/Source/cmLocalUnixMakefileGenerator.h

240 lines
10 KiB
C
Raw Normal View History

2002-08-31 00:01:48 +04:00
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
2002-08-31 00:01:48 +04:00
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.
2002-08-31 00:01:48 +04:00
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 cmLocalUnixMakefileGenerator_h
#define cmLocalUnixMakefileGenerator_h
#include "cmLocalGenerator.h"
2002-12-10 17:28:05 +03:00
class cmDependInformation;
2002-08-31 00:01:48 +04:00
class cmMakeDepend;
class cmTarget;
class cmSourceFile;
/** \class cmLocalUnixMakefileGenerator
* \brief Write a LocalUnix makefiles.
*
* cmLocalUnixMakefileGenerator produces a LocalUnix makefile from its
* member m_Makefile.
*/
class cmLocalUnixMakefileGenerator : public cmLocalGenerator
{
public:
///! Set cache only and recurse to false by default.
cmLocalUnixMakefileGenerator();
virtual ~cmLocalUnixMakefileGenerator();
/**
* Generate the makefile for this directory. fromTheTop indicates if this
* is being invoked as part of a global Generate or specific to this
* directory. The difference is that when done from the Top we might skip
* some steps to save time, such as dependency generation for the
* makefiles. This is done by a direct invocation from make.
*/
virtual void Generate(bool fromTheTop);
/**
* Output the depend information for all the classes
* in the makefile. These would have been generated
* by the class cmMakeDepend.
*/
virtual bool OutputObjectDepends(std::ostream&);
/**
* Output the check depend information for all the classes
* in the makefile. These would have been generated
* by the class cmMakeDepend.
*/
virtual void OutputCheckDepends(std::ostream&);
/**
* Set to true if the shell being used is the windows shell.
* This controls if statements in the makefile and the SHELL variable.
* The default is false.
*/
void SetWindowsShell(bool v) {m_WindowsShell = v;}
///! Set the string used to include one makefile into another default is include.
void SetIncludeDirective(const char* s) { m_IncludeDirective = s; }
///! Set the flag used to keep the make program silent.
void SetMakeSilentFlag(const char* s) { m_MakeSilentFlag = s; }
///! Set max makefile variable size, default is 0 which means unlimited.
void SetMakefileVariableSize(int s) { m_MakefileVariableSize = s; }
///! If ignore lib prefix is true, then do not strip lib from the name of a library.
void SetIgnoreLibPrefix(bool s) { m_IgnoreLibPrefix = s; }
/**
* If true, then explicitly pass MAKEFLAGS on the make all target for makes
* that do not use environment variables.
*
*/
void SetPassMakeflags(bool s){m_PassMakeflags = s;}
2002-08-31 00:01:48 +04:00
protected:
void ConfigureOutputPaths();
2002-12-10 17:28:05 +03:00
void AddDependenciesToSourceFile(cmDependInformation const*info,
cmSourceFile *i,
std::set<cmDependInformation const*> *visited);
2002-08-31 00:01:48 +04:00
virtual void ProcessDepends(const cmMakeDepend &md);
virtual void OutputMakefile(const char* file, bool withDepends);
virtual void OutputTargetRules(std::ostream& fout);
void OutputLibraryRule(std::ostream& fout,
const char* name,
const cmTarget &t,
const char* createRule,
const char* comment,
const char* linkFlags
);
2002-08-31 00:01:48 +04:00
virtual void OutputSharedLibraryRule(std::ostream&, const char* name,
const cmTarget &);
virtual void OutputModuleLibraryRule(std::ostream&, const char* name,
const cmTarget &);
virtual void OutputStaticLibraryRule(std::ostream&, const char* name,
const cmTarget &);
virtual void OutputExecutableRule(std::ostream&, const char* name,
const cmTarget &);
virtual void OutputUtilityRule(std::ostream&, const char* name,
const cmTarget &);
virtual void OutputTargets(std::ostream&);
virtual void OutputSubDirectoryRules(std::ostream&);
virtual void OutputDependLibs(std::ostream&);
virtual void OutputLibDepend(std::ostream&, const char*);
virtual void OutputExeDepend(std::ostream&, const char*);
virtual void OutputCustomRules(std::ostream&);
virtual void OutputMakeVariables(std::ostream&);
virtual void OutputMakeRules(std::ostream&);
virtual void OutputSourceObjectBuildRules(std::ostream& fout);
virtual void OutputBuildObjectFromSource(std::ostream& fout,
const char* shortName,
const cmSourceFile& source,
const char* extraCompileFlags,
bool sharedTarget);
virtual void BuildInSubDirectory(std::ostream& fout,
const char* directory,
const char* target1,
const char* target2,
bool silent = false);
virtual void BuildInSubDirectoryWindows(std::ostream& fout,
const char* directory,
const char* target1,
const char* target2,
bool silent = false);
///! order == 0, then all subdirs are output, 1 = post order, 2 = preorder
2002-08-31 00:01:48 +04:00
virtual void OutputSubDirectoryVars(std::ostream& fout,
const char* var,
const char* target,
const char* target1,
const char* target2,
const char* depend,
const std::vector<std::pair<cmStdString, bool> >&
2002-08-31 00:01:48 +04:00
SubDirectories,
bool silent = false, int order = 0);
2002-08-31 00:01:48 +04:00
virtual void OutputMakeRule(std::ostream&,
const char* comment,
const char* target,
const char* depends,
const std::vector<std::string>& commands);
virtual void OutputMakeRule(std::ostream&,
const char* comment,
const char* target,
const std::vector<std::string>& depends,
const char* command);
virtual void OutputMakeRule(std::ostream&,
const char* comment,
const char* target,
const std::vector<std::string>& depends,
const std::vector<std::string>& commands);
2002-08-31 00:01:48 +04:00
virtual void OutputMakeRule(std::ostream&,
const char* comment,
const char* target,
const char* depends,
const char* command,
const char* command2 = 0,
const char* command3 = 0,
const char* command4 = 0);
virtual void OutputBuildTargetInDirWindows(std::ostream& fout,
const char* path,
const char* library,
const char* fullpath);
2002-08-31 00:01:48 +04:00
virtual void OutputBuildTargetInDir(std::ostream& fout,
const char* path,
const char* library,
const char* fullpath);
2002-08-31 00:01:48 +04:00
///! return true if the two paths are the same
virtual bool SamePath(const char* path1, const char* path2);
2003-06-03 18:30:23 +04:00
std::string CreatePreBuildRules(const cmTarget &target,
const char* targetName);
std::string CreatePreLinkRules(const cmTarget &target,
const char* targetName);
std::string CreatePostBuildRules(const cmTarget &target,
const char* targetName);
virtual std::string CreateMakeVariable(const char* s, const char* s2);
2002-08-31 00:01:48 +04:00
///! if the OS is case insensitive then return a lower case of the path.
virtual std::string LowerCasePath(const char* path);
/** Convert path to a format vaild for the left or right side of a
target: dependencies line in a makefile. */
virtual std::string ConvertToMakeTarget(const char*);
/** Get the base name of the target's file, without path or extension. */
std::string GetBaseTargetName(const char* n, const cmTarget& t);
/** Get the names associated with a library target. */
void GetLibraryNames(const char* n, const cmTarget& t,
std::string& name,
std::string& soName,
std::string& realName,
std::string& baseName);
/** Output an echo command to the Makefile */
void OutputEcho(std::ostream& fout, const char *msg);
/**
* Convert source file name to a safe object file name. Safe here means that
* it will not clash with compilers or linkers.
*/
std::string& CreateSafeUniqueObjectFileName(const char* sin);
2002-08-31 00:01:48 +04:00
protected:
int m_MakefileVariableSize;
std::map<cmStdString, cmStdString> m_MakeVariableMap;
std::map<cmStdString, cmStdString> m_ShortMakeVariableMap;
std::map<cmStdString, cmStdString> m_UniqueObjectNamesMap;
std::string m_IncludeDirective;
std::string m_MakeSilentFlag;
2002-08-31 00:01:48 +04:00
std::string m_ExecutableOutputPath;
std::string m_LibraryOutputPath;
bool m_PassMakeflags;
2002-08-31 00:01:48 +04:00
private:
};
#endif