diff options
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator.cxx | 52 | ||||
-rw-r--r-- | Source/cmSourceFile.cxx | 5 |
2 files changed, 48 insertions, 9 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index a51a670..d732cbf 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -533,11 +533,28 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) { std::string outExt( this->GetOutputExtension((*i)->GetSourceExtension().c_str())); - if(outExt.size()) + if(outExt.size() && !(*i)->GetPropertyAsBool("EXTERNAL_OBJECT") ) { - fout << "\\\n" - << this->ConvertToMakeTarget(this->ConvertToRelativeOutputPath((*i)->GetSourceName().c_str()).c_str()) - << outExt.c_str() << " "; + fout << "\\\n"; + fout << this->ConvertToMakeTarget(this->ConvertToRelativeOutputPath((*i)->GetSourceName().c_str()).c_str()) + << outExt.c_str() << " "; + } + } + } + fout << "\n\n"; + fout << this->CreateMakeVariable(l->first.c_str(), "_EXTERNAL_OBJS") << " = "; + for(std::vector<cmSourceFile*>::iterator i = classes.begin(); + i != classes.end(); i++) + { + if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY") && + !(*i)->GetCustomCommand()) + { + std::string outExt( + this->GetOutputExtension((*i)->GetSourceExtension().c_str())); + if(outExt.size() && (*i)->GetPropertyAsBool("EXTERNAL_OBJECT") ) + { + fout << "\\\n"; + fout << this->ConvertToMakeTarget(this->ConvertToRelativeOutputPath((*i)->GetFullPath().c_str()).c_str()) << " "; } } } @@ -550,7 +567,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) !(*i)->GetCustomCommand()) { std::string outExt(this->GetOutputExtension((*i)->GetSourceExtension().c_str())); - if(outExt.size()) + if(outExt.size() && !(*i)->GetPropertyAsBool("EXTERNAL_OBJECT") ) { fout << "\\\n\"" << this->ConvertToMakeTarget(ConvertToRelativeOutputPath((*i)->GetSourceName().c_str()).c_str()) << outExt.c_str() << "\" "; @@ -558,6 +575,21 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) } } fout << "\n\n"; + fout << this->CreateMakeVariable(l->first.c_str(), "_EXTERNAL_OBJS_QUOTED") << " = "; + for(std::vector<cmSourceFile*>::iterator i = classes.begin(); + i != classes.end(); i++) + { + if(!(*i)->GetPropertyAsBool("HEADER_FILE_ONLY") && + !(*i)->GetCustomCommand()) + { + std::string outExt(this->GetOutputExtension((*i)->GetSourceExtension().c_str())); + if(outExt.size() && (*i)->GetPropertyAsBool("EXTERNAL_OBJECT") ) + { + fout << "\\\n\"" << this->ConvertToMakeTarget(ConvertToRelativeOutputPath((*i)->GetFullPath().c_str()).c_str()) << "\" "; + } + } + } + fout << "\n\n"; } } @@ -1115,8 +1147,8 @@ void cmLocalUnixMakefileGenerator::OutputLibraryRule(std::ostream& fout, } // get the objects that are used to link this library - std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") "; - std::string objsQuoted = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS_QUOTED") + ") "; + std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") $(" + this->CreateMakeVariable(name, "_EXTERNAL_OBJS") + ") "; + std::string objsQuoted = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS_QUOTED") + ") $(" + this->CreateMakeVariable(name, "_EXTERNAL_OBJS_QUOTED") + ") "; // create a variable with the objects that this library depends on std::string depend = objs + " $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")"; @@ -1382,9 +1414,10 @@ void cmLocalUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout, { needsLocalTarget = true; } - std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") "; + std::string objs = "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") $(" + this->CreateMakeVariable(name, "_EXTERNAL_OBJS") + ") "; std::string depend = "$("; depend += this->CreateMakeVariable(name, "_SRC_OBJS") + + ") $(" + this->CreateMakeVariable(name, "_EXTERNAL_OBJS") + ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")"; std::vector<std::string> rules; linkFlags += this->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS"); @@ -2661,6 +2694,8 @@ OutputBuildObjectFromSource(std::ostream& fout, return; case cmSystemTools::DEFINITION_FILE_FORMAT: return; + case cmSystemTools::OBJECT_FILE_FORMAT: + return; case cmSystemTools::RESOURCE_FILE_FORMAT: { flags = " $(INCLUDE_FLAGS) "; @@ -2677,7 +2712,6 @@ OutputBuildObjectFromSource(std::ostream& fout, case cmSystemTools::STATIC_LIBRARY_FILE_FORMAT: case cmSystemTools::SHARED_LIBRARY_FILE_FORMAT: case cmSystemTools::MODULE_FILE_FORMAT: - case cmSystemTools::OBJECT_FILE_FORMAT: case cmSystemTools::UNKNOWN_FILE_FORMAT: cmSystemTools::Error("Unexpected file type ", sourceFile.c_str()); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 1f45e92..138d5d2 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -73,6 +73,11 @@ void cmSourceFile::SetName(const char* name, const char* dir, this->SetProperty("HEADER_FILE_ONLY","0"); } m_FullPath = hname; + if ( m_SourceExtension == "obj" || m_SourceExtension == "o" || + m_SourceExtension == "lo" ) + { + this->SetProperty("EXTERNAL_OBJECT", "1"); + } return; } |