Index: /CMT/HEAD/ChangeLog
===================================================================
--- /CMT/HEAD/ChangeLog	(revision 427)
+++ /CMT/HEAD/ChangeLog	(revision 428)
@@ -1,2 +1,15 @@
+2007-10-31    <rybkin@lal.in2p3.fr> 334
+
+	* source/cmt_parser.cxx: idem
+	* source/cmt_commands.cxx: idem
+	* source/cmt_generator.h: idem
+	* source/cmt_generator.cxx: idem
+	* source/cmt_generators.h: idem
+	* source/cmt_generators.cxx: Implement the new -out=file option of the
+	cmt build constituent_makefile command
+	* mgr/fragments/constituent: Make use of the new -out=file option of the
+	cmt build constituent_makefile command to allow simultaneous builds for multiple
+	binary tags
+
 2007-09-01    <rybkin@lal.in2p3.fr> 333
 
Index: /CMT/HEAD/mgr/fragments/constituent
===================================================================
--- /CMT/HEAD/mgr/fragments/constituent	(revision 427)
+++ /CMT/HEAD/mgr/fragments/constituent	(revision 428)
@@ -43,6 +43,5 @@
 $(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs
 	@echo "------> (constituents.make) Building ${CONSTITUENT}.make"; \
-	  $(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile ${CONSTITUENT} ; \
-	  if test ! "$(bin)" = "./"; then /bin/mv -f ${CONSTITUENT}.make $(cmt_local_${CONSTITUENT}_makefile); fi
+	  $(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
 
 ${CONSTITUENT} :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
Index: /CMT/HEAD/source/cmt_commands.cxx
===================================================================
--- /CMT/HEAD/source/cmt_commands.cxx	(revision 427)
+++ /CMT/HEAD/source/cmt_commands.cxx	(revision 428)
@@ -559,8 +559,16 @@
       if (arg == "constituent_makefile")
 	{
-	  if (argc > 0)
-	    {
-	      fill_one_argument ();
+	  //	  if (argc > 0)
+	  if (argc == 1 || (argc == 2 && cmt_string (argv[0]).substr (0, 5) == "-out="))
+	    {
+	      //fill_one_argument ();
+	      fill_arguments ();
 	      cmt.m_action = action_build_constituent_makefile;
+	    }
+	  else if (argc > 0)
+	    {
+	      if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong arguments" << endl;
+	      cmt.m_action = action_build_constituent_makefile;
+	      help_action = action_help;
 	    }
 	  else
Index: /CMT/HEAD/source/cmt_generator.cxx
===================================================================
--- /CMT/HEAD/source/cmt_generator.cxx	(revision 427)
+++ /CMT/HEAD/source/cmt_generator.cxx	(revision 428)
@@ -219,5 +219,6 @@
 //--------------------------------------------------
 bool CmtGenerator::prepare_output (const cmt_string& package,
-                                   const Constituent& constituent)
+				   const Constituent& constituent,
+				   const cmt_string& file)
 {
   m_PACKAGE = package;
@@ -238,4 +239,6 @@
     }
   
+  if (file != "") m_output_file_name = file;
+
   m_output_file_name += "new";
 
@@ -692,5 +695,6 @@
 
 //--------------------------------------------------
-int Generator::build_constituent_makefile (const Constituent& constituent)
+int Generator::build_constituent_makefile (const Constituent& constituent,
+					   const cmt_string& file)
 {
   const cmt_string& package = Cmt::get_current_package ();
@@ -699,11 +703,11 @@
     {
     case Application:
-      ApplicationContext.build (package, constituent);
+      ApplicationContext.build (package, constituent, file);
       break;
     case Library:
-      LibraryContext.build (package, constituent);
+      LibraryContext.build (package, constituent, file);
       break;
     case Document:
-      DocumentContext.build (package, constituent);
+      DocumentContext.build (package, constituent, file);
       break;
     }
@@ -713,8 +717,29 @@
 
 //--------------------------------------------------
-void Generator::build_constituent_makefile (const cmt_string& name)
-{
+void Generator::build_constituent_makefile (const CmtSystem::cmt_string_vector& arguments)
+{
+  cmt_string name;
+  cmt_string file;
+
+  if (arguments.size () == 1)
+    {
+      file = "";
+      name = arguments[0];
+    }
+  else if (arguments.size () == 2) // arguments[0].substr (0, 5) == "-out="
+    {
+      cmt_string arg = arguments[0];
+      arg.erase (0, 5);
+      file = arg;
+      name = arguments[1];
+    }
+  else
+    {
+      cerr << "#CMT> build constituent_makefile : wrong arguments" << endl;
+      return;
+    }
+
   const Constituent* constituent = Constituent::find (name);
-  if (constituent != 0) build_constituent_makefile (*constituent);
+  if (constituent != 0) build_constituent_makefile (*constituent, file);
 }
 
Index: /CMT/HEAD/source/cmt_generator.h
===================================================================
--- /CMT/HEAD/source/cmt_generator.h	(revision 427)
+++ /CMT/HEAD/source/cmt_generator.h	(revision 428)
@@ -50,5 +50,6 @@
   void reset ();
   bool prepare_output (const cmt_string& package,
-                       const Constituent& constituent);
+                       const Constituent& constituent,
+		       const cmt_string& file = "");
   void commit (const cmt_string& name);
   static void check (const cmt_string& name);
@@ -160,6 +161,7 @@
 
     // Build the makefile fragment for one constituent
-  static int build_constituent_makefile (const Constituent& constituent);
-  static void build_constituent_makefile (const cmt_string& name);
+  static int build_constituent_makefile (const Constituent& constituent,
+					 const cmt_string& file = "");
+  static void build_constituent_makefile (const CmtSystem::cmt_string_vector& arguments);
 
   static void build_default_makefile ();
Index: /CMT/HEAD/source/cmt_generators.cxx
===================================================================
--- /CMT/HEAD/source/cmt_generators.cxx	(revision 427)
+++ /CMT/HEAD/source/cmt_generators.cxx	(revision 428)
@@ -10,4 +10,5 @@
 #include "cmt_symbol.h"
 #include "cmt_log.h"
+#include <assert.h>
 
 //--------------------------------------------------
@@ -395,5 +396,6 @@
 //--------------------------------------------------
 void LibraryGenerator::build (const cmt_string& package,
-                              const Constituent& constituent)
+			      const Constituent& constituent,
+			      const cmt_string& file_name)
 {
   static cmt_string lib;
@@ -408,5 +410,5 @@
   reset ();
 
-  if (!prepare_output (package, constituent)) return;
+  if (!prepare_output (package, constituent, file_name)) return;
 
   switch (constituent.type)
@@ -856,5 +858,6 @@
 //--------------------------------------------------
 void DocumentGenerator::build (const cmt_string& package,
-                               const Constituent& constituent)
+			       const Constituent& constituent,
+			       const cmt_string& file_name)
 {
   static cmt_string names;
@@ -869,5 +872,5 @@
   reset ();
 
-  if (!prepare_output (package, constituent)) return;
+  if (!prepare_output (package, constituent, file_name)) return;
 
   is_library = false;
Index: /CMT/HEAD/source/cmt_generators.h
===================================================================
--- /CMT/HEAD/source/cmt_generators.h	(revision 427)
+++ /CMT/HEAD/source/cmt_generators.h	(revision 428)
@@ -35,5 +35,6 @@
   DocumentGenerator ();
   void build (const cmt_string& package,
-              const Constituent& constituent);
+              const Constituent& constituent,
+	      const cmt_string& file = "");
 
 private:
@@ -51,5 +52,6 @@
   LibraryGenerator ();
   void build (const cmt_string& package,
-              const Constituent& constituent);
+              const Constituent& constituent,
+	      const cmt_string& file = "");
 
 protected:
Index: /CMT/HEAD/source/cmt_parser.cxx
===================================================================
--- /CMT/HEAD/source/cmt_parser.cxx	(revision 427)
+++ /CMT/HEAD/source/cmt_parser.cxx	(revision 428)
@@ -1641,5 +1641,5 @@
     {
       set_standard_macros ();
-      Generator::build_constituent_makefile (ap.arguments[0]);
+      Generator::build_constituent_makefile (ap.arguments);
     }
 }
