diff options
author | Brad King <brad.king@kitware.com> | 2006-08-15 16:00:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-08-15 16:00:27 (GMT) |
commit | c6f1a11480f478b430fcb798ddeac972ec17ae6a (patch) | |
tree | a9e71d302bcb44201b223dee7528fcfb726662b9 /Source | |
parent | 7169980b59c16370fa5abec8159afc5cc84a96cd (diff) | |
download | CMake-c6f1a11480f478b430fcb798ddeac972ec17ae6a.zip CMake-c6f1a11480f478b430fcb798ddeac972ec17ae6a.tar.gz CMake-c6f1a11480f478b430fcb798ddeac972ec17ae6a.tar.bz2 |
BUG: Added object language to list of object files in a local generator's directory. Fixed generation of preprocessing and assembly rules to be done only for C and C++ objects.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 5 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 23 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.h | 15 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 10 |
4 files changed, 40 insertions, 13 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 4be5cd5..255b1a3 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -1231,9 +1231,10 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule } } } - std::map<cmStdString,std::vector<cmTarget *> > const& objs = + typedef cmLocalUnixMakefileGenerator3::LocalObjectInfo LocalObjectInfo; + std::map<cmStdString, LocalObjectInfo> const& objs = lg->GetLocalObjectFiles(); - for(std::map<cmStdString,std::vector<cmTarget *> >::const_iterator o = + for(std::map<cmStdString, LocalObjectInfo>::const_iterator o = objs.begin(); o != objs.end(); ++o) { path = "... "; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 4c53470..525b791 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -288,7 +288,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // now write out the object rules // for each object file name - for (std::map<cmStdString,std::vector<cmTarget *> >::iterator lo = + for (std::map<cmStdString, LocalObjectInfo>::iterator lo = this->LocalObjectFiles.begin(); lo != this->LocalObjectFiles.end(); ++lo) { @@ -297,8 +297,20 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() "target to build an object file", lo->first.c_str(), lo->second); + // Check whether preprocessing and assembly rules make sense. + // They make sense only for C and C++ sources. + bool lang_is_c_or_cxx = false; + for(std::vector<LocalObjectEntry>::const_iterator ei = + lo->second.begin(); ei != lo->second.end(); ++ei) + { + if(ei->Language == "C" || ei->Language == "CXX") + { + lang_is_c_or_cxx = true; + } + } + // Add convenience rules for preprocessed and assembly files. - if(do_preprocess_rules || do_assembly_rules) + if(lang_is_c_or_cxx && (do_preprocess_rules || do_assembly_rules)) { std::string::size_type dot_pos = lo->first.rfind("."); std::string base = lo->first.substr(0, dot_pos); @@ -333,14 +345,15 @@ void cmLocalUnixMakefileGenerator3 ::WriteObjectConvenienceRule(std::ostream& ruleFileStream, const char* comment, const char* output, - std::vector<cmTarget*>& targets) + LocalObjectInfo const& targets) { // Recursively make the rule for each target using the object file. std::vector<std::string> commands; - for(std::vector<cmTarget*>::iterator t = targets.begin(); + for(std::vector<LocalObjectEntry>::const_iterator t = targets.begin(); t != targets.end(); ++t) { - std::string tgtMakefileName = this->GetRelativeTargetDirectory(**t); + std::string tgtMakefileName = + this->GetRelativeTargetDirectory(*(t->Target)); std::string targetName = tgtMakefileName; tgtMakefileName += "/build.make"; targetName += "/"; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 89bb642..9bb2ab7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -202,7 +202,16 @@ public: // write the target rules for the local Makefile into the stream void WriteLocalAllRules(std::ostream& ruleFileStream); - std::map<cmStdString,std::vector<cmTarget *> > GetLocalObjectFiles() + struct LocalObjectEntry + { + cmTarget* Target; + std::string Language; + LocalObjectEntry(): Target(0), Language() {} + LocalObjectEntry(cmTarget* t, const char* lang): + Target(t), Language(lang) {} + }; + class LocalObjectInfo: public std::vector<LocalObjectEntry> {}; + std::map<cmStdString, LocalObjectInfo> const& GetLocalObjectFiles() { return this->LocalObjectFiles;} // return info about progress actions @@ -276,7 +285,7 @@ protected: const std::vector<std::string>& objects); void WriteObjectConvenienceRule(std::ostream& ruleFileStream, const char* comment, const char* output, - std::vector<cmTarget*>& targets); + LocalObjectInfo const& targets); std::string GetObjectFileName(cmTarget& target, const cmSourceFile& source, @@ -336,7 +345,7 @@ private: bool SkipPreprocessedSourceRules; bool SkipAssemblySourceRules; - std::map<cmStdString,std::vector<cmTarget *> > LocalObjectFiles; + std::map<cmStdString, LocalObjectInfo> LocalObjectFiles; /* does the work for each target */ std::vector<cmMakefileTargetGenerator *> TargetGenerators; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 098aa42..558a78f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -350,7 +350,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir); } this->LocalGenerator->LocalObjectFiles[objNoTargetDir]. - push_back(this->Target); + push_back( + cmLocalUnixMakefileGenerator3::LocalObjectEntry(this->Target, lang) + ); } //---------------------------------------------------------------------------- @@ -495,9 +497,11 @@ cmMakefileTargetGenerator relativeObj.c_str(), depends, commands, false); - bool do_preprocess_rules = + bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) || + (strcmp(lang, "CXX") == 0)); + bool do_preprocess_rules = lang_is_c_or_cxx && this->LocalGenerator->GetCreatePreprocessedSourceRules(); - bool do_assembly_rules = + bool do_assembly_rules = lang_is_c_or_cxx && this->LocalGenerator->GetCreateAssemblySourceRules(); if(do_preprocess_rules || do_assembly_rules) { |