diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-11-05 21:38:35 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-11-05 21:38:35 (GMT) |
commit | 1a8e3ba1e666da622e6f9eb8bcf87ebc707eaaf6 (patch) | |
tree | 75487091a0293edeadd8e10400dfbe86f294dcc1 /Source/cmUnixMakefileGenerator.cxx | |
parent | 33dbd7acf8fe0fb897e1a41ab6a22dd71cb8e2dc (diff) | |
download | CMake-1a8e3ba1e666da622e6f9eb8bcf87ebc707eaaf6.zip CMake-1a8e3ba1e666da622e6f9eb8bcf87ebc707eaaf6.tar.gz CMake-1a8e3ba1e666da622e6f9eb8bcf87ebc707eaaf6.tar.bz2 |
ENH: use full paths for object compile rules
Diffstat (limited to 'Source/cmUnixMakefileGenerator.cxx')
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 4b7b1ad..460d6f3 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -1423,7 +1423,8 @@ void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout) // filename of the object file. Otherwise, we will use just // the filename portion. if((cmSystemTools::GetFilenamePath(source->GetFullPath()).find(m_Makefile->GetCurrentDirectory()) == 0) - || (cmSystemTools::GetFilenamePath(source->GetFullPath()).find(m_Makefile->GetCurrentOutputDirectory()) == 0)) + || (cmSystemTools::GetFilenamePath(source->GetFullPath()).find(m_Makefile-> + GetCurrentOutputDirectory()) == 0)) { sourceName = source->GetSourceName()+"."+source->GetSourceExtension(); shortName = source->GetSourceName(); @@ -1448,21 +1449,41 @@ void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout) // Only output a rule for each .o once. if(rules.find(shortName) == rules.end()) { - rules.insert(shortName); - fout << shortName.c_str() << ".o : " << source->GetFullPath().c_str() << "\n"; + std::string comment = "Build "; + std::string objectFile = shortName + ".o"; + comment += objectFile + " From "; + comment += source->GetFullPath(); + std::string compileCommand; std::string ext = source->GetSourceExtension(); - if ( ext == "cxx" || ext == "cc" || ext == "cpp" || ext == "C" || - ext =="m" || ext == "M" || ext == "mm") + if(ext == "c" ) { - fout << "\t$(CMAKE_CXX_COMPILER) $(CMAKE_CXXFLAGS) " << exportsDef.c_str() - << (shared? "$(CMAKE_SHLIB_CFLAGS) ":"") - << "$(INCLUDE_FLAGS) -c $< -o $@\n\n "; + compileCommand = "$(CMAKE_C_COMPILER) $(CMAKE_CFLAGS) "; + compileCommand += exportsDef; + if(shared) + { + compileCommand += "$(CMAKE_SHLIB_CFLAGS) "; + } + compileCommand += "$(INCLUDE_FLAGS) -c $< -o $@"; } - else if ( ext == "c" ) + else { - fout << "\t$(CMAKE_C_COMPILER) $(CMAKE_CFLAGS) " << exportsDef.c_str() - << (shared? "$(CMAKE_SHLIB_CFLAGS) ":"") << "$(INCLUDE_FLAGS) -c $< -o $@\n\n"; + compileCommand = "$(CMAKE_CXX_COMPILER) $(CMAKE_CXXFLAGS) "; + compileCommand += exportsDef; + if(shared) + { + compileCommand += "$(CMAKE_SHLIB_CFLAGS) "; + } + compileCommand += "$(INCLUDE_FLAGS) -c "; + compileCommand += source->GetFullPath(); + compileCommand += " -o "; + compileCommand += objectFile; } + this->OutputMakeRule(fout, + comment.c_str(), + objectFile.c_str(), + source->GetFullPath().c_str(), + compileCommand.c_str()); + rules.insert(shortName); } } } |