Browse Source

ENH: Added custom rule support to cmUnixMakefileGenerator.

Brad King 25 years ago
parent
commit
278bcbd7be
2 changed files with 23 additions and 0 deletions
  1. 22 0
      Source/cmUnixMakefileGenerator.cxx
  2. 1 0
      Source/cmUnixMakefileGenerator.h

+ 22 - 0
Source/cmUnixMakefileGenerator.cxx

@@ -59,6 +59,7 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
   this->OutputExecutableRules(fout);
   this->OutputSubDirectoryRules(fout);
   this->OutputDepends(fout);
+  this->OutputCustomRules(fout);
 }
 
 // Output the LIBRARY and SRC_OBJS list based on
@@ -366,3 +367,24 @@ void cmUnixMakefileGenerator::OutputDepends(std::ostream& fout)
       }
     }
 }
+
+
+// Output each custom rule in the following format:
+// m_Result: m_Depends[0] m_Depends[1] ...
+//   (tab)   m_Command
+void cmUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
+{
+  for(std::vector<cmMakefile::customCommand>::const_iterator c =
+        m_Makefile->GetCustomCommands().begin();
+      c != m_Makefile->GetCustomCommands().end(); ++c)
+    {
+    fout << c->m_Result.c_str() << ":";
+    for(std::vector<std::string>::const_iterator d = c->m_Depends.begin();
+        d != c->m_Depends.end(); ++ d)
+      {
+      fout << " " << d->c_str();
+      }
+    fout << "\n\t" << c->m_Command.c_str() << "\n\n";
+    }
+  
+}

+ 1 - 0
Source/cmUnixMakefileGenerator.h

@@ -49,6 +49,7 @@ protected:
   void OutputSubDirectoryRules(std::ostream&);
   void OutputDependInformation(std::ostream&);
   void OutputDependLibraries(std::ostream&);
+  void OutputCustomRules(std::ostream&);
 };
 
 #endif