summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBerk Geveci <berk.geveci@kitware.com>2001-06-28 19:08:50 (GMT)
committerBerk Geveci <berk.geveci@kitware.com>2001-06-28 19:08:50 (GMT)
commit19bd2c0c29cc0ed480f0fd16855dfe641ec2bbb1 (patch)
tree4fbb786ebf73cddf7f6db27cfb6876bfbca21e16
parent61acb47f5458c1b3e3c909e31867240a8219efaf (diff)
downloadCMake-19bd2c0c29cc0ed480f0fd16855dfe641ec2bbb1.zip
CMake-19bd2c0c29cc0ed480f0fd16855dfe641ec2bbb1.tar.gz
CMake-19bd2c0c29cc0ed480f0fd16855dfe641ec2bbb1.tar.bz2
Special rules for out-of-package source files.
-rw-r--r--Source/cmUnixMakefileGenerator.cxx58
1 files changed, 57 insertions, 1 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index bd75c6f..d007868 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -236,6 +236,9 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
{
fout << "include cmake.depends\n";
}
+
+
+
}
@@ -890,6 +893,7 @@ void cmUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
fout << "# End of source group \"" << name.c_str() << "\"\n\n";
}
}
+
}
@@ -1102,6 +1106,22 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
".cxx.o",
0,
"${CMAKE_CXX_COMPILER} ${CMAKE_CXXFLAGS} ${INCLUDE_FLAGS} -c $< -o $@");
+ this->OutputMakeRule(fout,
+ "# build cplusplus file",
+ ".cpp.o",
+ 0,
+ "${CMAKE_CXX_COMPILER} ${CMAKE_CXXFLAGS} ${INCLUDE_FLAGS} -c $< -o $@");
+ this->OutputMakeRule(fout,
+ "# build cplusplus file",
+ ".cc.o",
+ 0,
+ "${CMAKE_CXX_COMPILER} ${CMAKE_CXXFLAGS} ${INCLUDE_FLAGS} -c $< -o $@");
+ this->OutputMakeRule(fout,
+ "# build cplusplus file",
+ ".C.o",
+ 0,
+ "${CMAKE_CXX_COMPILER} ${CMAKE_CXXFLAGS} ${INCLUDE_FLAGS} -c $< -o $@");
+
// only include the cmake.depends and not the Makefile, as
// building one will cause the other to be built
this->OutputMakeRule(fout,
@@ -1156,6 +1176,42 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
"Makefile cmake.depends",
0);
+
+ // Write special rules for source files coming from other packages
+ // (not in the current build or source directories)
+
+ fout << "# Write special rules for source files coming from other packages\n";
+ fout << "# (not in the current build or source directories)\n";
+
+ // Iterate over every target.
+ std::map<std::string, cmTarget>& targets = m_Makefile->GetTargets();
+ for(std::map<std::string, cmTarget>::const_iterator target = targets.begin();
+ target != targets.end(); ++target)
+ {
+ // Iterate over every source for this target.
+ const std::vector<cmSourceFile>& sources = target->second.GetSourceFiles();
+ for(std::vector<cmSourceFile>::const_iterator source = sources.begin();
+ source != sources.end(); ++source)
+ {
+ if(!source->IsAHeaderFileOnly() &&
+ (cmSystemTools::GetFilenamePath(source->GetFullPath())
+ != m_Makefile->GetCurrentOutputDirectory()) &&
+ (cmSystemTools::GetFilenamePath(source->GetFullPath())
+ != m_Makefile->GetCurrentDirectory()))
+ {
+ fout << cmSystemTools::GetFilenameName(source->GetSourceName()) << ".o : " << source->GetFullPath() << "\n";
+ std::string ext = source->GetSourceExtension();
+ if ( ext == "cxx" || ext == "cc" || ext == "cpp" || ext == "C" )
+ {
+ fout << "\t${CMAKE_CXX_COMPILER} ${CMAKE_CXXFLAGS} ${INCLUDE_FLAGS} -c $< -o $@\n\n";
+ }
+ else if ( ext == "c" )
+ {
+ fout << "\t${CMAKE_C_COMPILER} ${CMAKE_CFLAGS} ${INCLUDE_FLAGS} -c $< -o $@\n\n";
+ }
+ }
+ }
+ }
}
void cmUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
@@ -1194,7 +1250,7 @@ void cmUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
m_Makefile->ExpandVariablesInString(replace);
fout << "\t" << replace.c_str() << "\n\n";
}
- fout << "\n\n\n";
+ fout << "\n";
}