123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- #ifndef cmLocalUnixMakefileGenerator3_h
- #define cmLocalUnixMakefileGenerator3_h
- #include "cmConfigure.h"
- #include "cmDepends.h"
- #include "cmLocalCommonGenerator.h"
- #include <iosfwd>
- #include <map>
- #include <set>
- #include <string>
- #include <vector>
- class cmCustomCommand;
- class cmCustomCommandGenerator;
- class cmGeneratorTarget;
- class cmGlobalGenerator;
- class cmMakefile;
- class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator
- {
- public:
- cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf);
- ~cmLocalUnixMakefileGenerator3() override;
- void ComputeHomeRelativeOutputPath() override;
-
- void Generate() override;
-
-
- const std::string& GetHomeRelativeOutputPath();
-
- void WriteMakeRule(std::ostream& os, const char* comment,
- const std::string& target,
- const std::vector<std::string>& depends,
- const std::vector<std::string>& commands, bool symbolic,
- bool in_help = false);
-
- void WriteMakeVariables(std::ostream& makefileStream);
-
- void SetMakefileVariableSize(int s) { this->MakefileVariableSize = s; }
-
- void SetMakeCommandEscapeTargetTwice(bool b)
- {
- this->MakeCommandEscapeTargetTwice = b;
- }
-
- void SetBorlandMakeCurlyHack(bool b) { this->BorlandMakeCurlyHack = b; }
-
- static void WriteCMakeArgument(std::ostream& os, const char* s);
-
- void WriteDisclaimer(std::ostream& os);
-
- void WriteDivider(std::ostream& os);
-
- std::string GetRecursiveMakeCall(const char* makefile,
- const std::string& tgt);
-
- void AppendFlags(std::string& flags,
- const std::string& newFlags) const override;
- void AppendFlags(std::string& flags, const char* newFlags) const override;
-
- enum EchoColor
- {
- EchoNormal,
- EchoDepend,
- EchoBuild,
- EchoLink,
- EchoGenerate,
- EchoGlobal
- };
- struct EchoProgress
- {
- std::string Dir;
- std::string Arg;
- };
- void AppendEcho(std::vector<std::string>& commands, std::string const& text,
- EchoColor color = EchoNormal, EchoProgress const* = nullptr);
-
- bool GetColorMakefile() const { return this->ColorMakefile; }
- std::string GetTargetDirectory(
- cmGeneratorTarget const* target) const override;
-
- void CreateCDCommand(std::vector<std::string>& commands,
- std::string const& targetDir,
- std::string const& relDir);
- static std::string ConvertToQuotedOutputPath(const char* p,
- bool useWatcomQuote);
- std::string CreateMakeVariable(const std::string& sin,
- const std::string& s2in);
-
- bool UpdateDependencies(const char* tgtInfo, bool verbose,
- bool color) override;
-
- void ClearDependencies(cmMakefile* mf, bool verbose) override;
-
- void WriteSpecialTargetsTop(std::ostream& makefileStream);
- void WriteSpecialTargetsBottom(std::ostream& makefileStream);
- std::string GetRelativeTargetDirectory(cmGeneratorTarget* target);
-
-
- struct ImplicitDependFileMap
- : public std::map<std::string, cmDepends::DependencyVector>
- {
- };
- struct ImplicitDependLanguageMap
- : public std::map<std::string, ImplicitDependFileMap>
- {
- };
- struct ImplicitDependTargetMap
- : public std::map<std::string, ImplicitDependLanguageMap>
- {
- };
- ImplicitDependLanguageMap const& GetImplicitDepends(
- cmGeneratorTarget const* tgt);
- void AddImplicitDepends(cmGeneratorTarget const* tgt,
- const std::string& lang, const char* obj,
- const char* src);
-
- void WriteLocalAllRules(std::ostream& ruleFileStream);
- std::vector<std::string> const& GetLocalHelp() { return this->LocalHelp; }
-
- bool GetCreatePreprocessedSourceRules()
- {
- return !this->SkipPreprocessedSourceRules;
- }
- bool GetCreateAssemblySourceRules()
- {
- return !this->SkipAssemblySourceRules;
- }
-
-
-
- void GetIndividualFileTargets(std::vector<std::string>& targets);
- std::string MaybeConvertToRelativePath(std::string const& base,
- std::string const& path);
- protected:
- void WriteLocalMakefile();
-
- void WriteLocalMakefileTargets(std::ostream& ruleFileStream,
- std::set<std::string>& emitted);
-
- void WriteDirectoryInformationFile();
-
- void WriteDependLanguageInfo(std::ostream& cmakefileStream,
- cmGeneratorTarget* tgt);
-
- void WriteHelpRule(std::ostream& ruleFileStream);
-
-
- std::string ConvertToFullPath(const std::string& localPath);
- void WriteConvenienceRule(std::ostream& ruleFileStream,
- const std::string& realTarget,
- const std::string& helpTarget);
- void WriteTargetDependRule(std::ostream& ruleFileStream,
- cmGeneratorTarget* target);
- void WriteTargetCleanRule(std::ostream& ruleFileStream,
- cmGeneratorTarget* target,
- const std::vector<std::string>& files);
- void WriteTargetRequiresRule(std::ostream& ruleFileStream,
- cmGeneratorTarget* target,
- const std::vector<std::string>& objects);
- void AppendRuleDepend(std::vector<std::string>& depends,
- const char* ruleFileName);
- void AppendRuleDepends(std::vector<std::string>& depends,
- std::vector<std::string> const& ruleFiles);
- void AppendCustomDepends(std::vector<std::string>& depends,
- const std::vector<cmCustomCommand>& ccs);
- void AppendCustomDepend(std::vector<std::string>& depends,
- cmCustomCommandGenerator const& cc);
- void AppendCustomCommands(std::vector<std::string>& commands,
- const std::vector<cmCustomCommand>& ccs,
- cmGeneratorTarget* target,
- std::string const& relative);
- void AppendCustomCommand(std::vector<std::string>& commands,
- cmCustomCommandGenerator const& ccg,
- cmGeneratorTarget* target,
- std::string const& relative,
- bool echo_comment = false,
- std::ostream* content = nullptr);
- void AppendCleanCommand(std::vector<std::string>& commands,
- const std::vector<std::string>& files,
- cmGeneratorTarget* target,
- const char* filename = nullptr);
-
- bool ScanDependencies(
- const char* targetDir,
- std::map<std::string, cmDepends::DependencyVector>& validDeps);
- void CheckMultipleOutputs(bool verbose);
- private:
- std::string MaybeConvertWatcomShellCommand(std::string const& cmd);
- friend class cmMakefileTargetGenerator;
- friend class cmMakefileExecutableTargetGenerator;
- friend class cmMakefileLibraryTargetGenerator;
- friend class cmMakefileUtilityTargetGenerator;
- friend class cmGlobalUnixMakefileGenerator3;
- ImplicitDependTargetMap ImplicitDepends;
- std::string HomeRelativeOutputPath;
- struct LocalObjectEntry
- {
- cmGeneratorTarget* Target;
- std::string Language;
- LocalObjectEntry()
- : Target(nullptr)
- , Language()
- {
- }
- LocalObjectEntry(cmGeneratorTarget* t, const std::string& lang)
- : Target(t)
- , Language(lang)
- {
- }
- };
- struct LocalObjectInfo : public std::vector<LocalObjectEntry>
- {
- bool HasSourceExtension;
- bool HasPreprocessRule;
- bool HasAssembleRule;
- LocalObjectInfo()
- : HasSourceExtension(false)
- , HasPreprocessRule(false)
- , HasAssembleRule(false)
- {
- }
- };
- void GetLocalObjectFiles(
- std::map<std::string, LocalObjectInfo>& localObjectFiles);
- void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
- const char* comment, const char* output,
- LocalObjectInfo const& info);
- std::vector<std::string> LocalHelp;
-
- std::map<std::string, std::string> MakeVariableMap;
- std::map<std::string, std::string> ShortMakeVariableMap;
- int MakefileVariableSize;
- bool MakeCommandEscapeTargetTwice;
- bool BorlandMakeCurlyHack;
- bool ColorMakefile;
- bool SkipPreprocessedSourceRules;
- bool SkipAssemblySourceRules;
- };
- #endif
|