summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-04-11 14:29:51 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-04-11 14:29:51 (GMT)
commitea4a3d5e7b1758548577e868c6840bdcbf320f69 (patch)
tree054cfdc942b3727cc5e3aa1f11cc3914dd4555b2
parent4988ad93c06d62186025b8061e01b06aa9c201f4 (diff)
downloadCMake-ea4a3d5e7b1758548577e868c6840bdcbf320f69.zip
CMake-ea4a3d5e7b1758548577e868c6840bdcbf320f69.tar.gz
CMake-ea4a3d5e7b1758548577e868c6840bdcbf320f69.tar.bz2
ENH: clean up utility rule generation
-rw-r--r--Source/cmUnixMakefileGenerator.cxx29
-rw-r--r--Source/cmUnixMakefileGenerator.h2
2 files changed, 30 insertions, 1 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 28fc5f2..7e77b5b 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -785,6 +785,27 @@ void cmUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
cc);
}
+
+
+void cmUnixMakefileGenerator::OutputUtilityRule(std::ostream& fout,
+ const char* name,
+ const cmTarget &t)
+{
+ std::string customCommands = this->CreateTargetRules(t, name);
+ const char* cc = 0;
+ if(customCommands.size() > 0)
+ {
+ cc = customCommands.c_str();
+ }
+ std::string comment = "Rule to build Utility ";
+ comment += name;
+ this->OutputMakeRule(fout,
+ comment.c_str(),
+ name,
+ 0,
+ cc);
+}
+
void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
@@ -810,6 +831,8 @@ void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
this->OutputExecutableRule(fout, l->first.c_str(), l->second);
break;
case cmTarget::UTILITY:
+ this->OutputUtilityRule(fout, l->first.c_str(), l->second);
+ break;
// This is handled by the OutputCustomRules method
case cmTarget::INSTALL_FILES:
// This is handled by the OutputInstallRules method
@@ -1386,7 +1409,11 @@ void cmUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
tgt->second.GetCustomCommands().begin();
cr != tgt->second.GetCustomCommands().end(); ++cr)
{
- if ( cr->GetSourceName() != tgt->first )
+ // if the source for the custom command is the same name
+ // as the target, then to not create a rule in the makefile for
+ // the custom command, as the command will be fired when the other target
+ // is built.
+ if ( cr->GetSourceName().compare(tgt->first) !=0)
{
cmSourceGroup& sourceGroup =
m_Makefile->FindSourceGroup(cr->GetSourceName().c_str(),
diff --git a/Source/cmUnixMakefileGenerator.h b/Source/cmUnixMakefileGenerator.h
index 4a7016f..03875e7 100644
--- a/Source/cmUnixMakefileGenerator.h
+++ b/Source/cmUnixMakefileGenerator.h
@@ -98,6 +98,8 @@ protected:
const cmTarget &);
virtual void OutputExecutableRule(std::ostream&, const char* name,
const cmTarget &);
+ virtual void OutputUtilityRule(std::ostream&, const char* name,
+ const cmTarget &);
virtual void OutputTargets(std::ostream&);
virtual void OutputSubDirectoryRules(std::ostream&);