Index: /CMT/HEAD/ChangeLog
===================================================================
--- /CMT/HEAD/ChangeLog	(revision 575)
+++ /CMT/HEAD/ChangeLog	(revision 576)
@@ -1,2 +1,16 @@
+2011-05-10    <rybkin@lal.in2p3.fr> 458
+
+	* source/cmt_system.cxx: In class CmtSystem, in functions quote, mangle,
+	correct conversion specification in sprintf
+	* source/cmt_use.cxx: In class Use, in function	set_auto_imports, idem
+	* mgr/fragments/nmake/constituent: Generate constituent Makefile from input
+	requirements file (with -f, -without_cmt options) for constituent without
+	associated tag
+	* mgr/fragments/nmake/constituent_lock: idem
+	* mgr/Unix.make: Invoke compiler as c++ for any Darwin platform, do not
+	use recent GNU Make features, specify arch i386 or x86_64 explicitly for
+	relevant Darwin platforms
+	* mgr/GNUmakefile: Use ln with -f option
+	
 2011-05-04    <rybkin@lal.in2p3.fr> 457
 
Index: /CMT/HEAD/mgr/GNUmakefile
===================================================================
--- /CMT/HEAD/mgr/GNUmakefile	(revision 575)
+++ /CMT/HEAD/mgr/GNUmakefile	(revision 576)
@@ -26,5 +26,5 @@
 ifneq ($(wildcard $(cmtexe)),)
 all :: cmt
-	$(silent)\cd $(bin) && { [ -L cmt ] || [ $(notdir $(cmtexe)) = cmt ] || \ln -s $(notdir $(cmtexe)) cmt; }
+	$(silent)\cd $(bin) && { [ -L cmt ] || [ $(notdir $(cmtexe)) = cmt ] || \ln -sf $(notdir $(cmtexe)) cmt; }
 #	$(silent)\cd $(bin) && \rm -f cmt && ln -s cmt.exe cmt
 	$(echo) all ok
@@ -40,5 +40,5 @@
 all :: cmt post_build done
 endif
-	$(silent)\cd $(bin) && { [ -L cmt ] || [ $(notdir $(cmtexe)) = cmt ] || \ln -s $(notdir $(cmtexe)) cmt; }
+	$(silent)\cd $(bin) && { [ -L cmt ] || [ $(notdir $(cmtexe)) = cmt ] || \ln -sf $(notdir $(cmtexe)) cmt; }
 #	$(silent)\cd $(bin) && \rm -f cmt && ln -s cmt.exe cmt
 	$(echo) all ok
Index: /CMT/HEAD/mgr/Unix.make
===================================================================
--- /CMT/HEAD/mgr/Unix.make	(revision 575)
+++ /CMT/HEAD/mgr/Unix.make	(revision 576)
@@ -51,5 +51,5 @@
 endif
 
-ifeq ($(CMTBIN),Darwin)
+ifneq (,$(findstring Darwin,$(CMTBIN)))
 cpp       = c++ -O2
 endif
@@ -79,11 +79,15 @@
 ifneq (,$(findstring i386,$(CMTBIN)))
 _mode = 32
-else ifneq (,$(findstring i486,$(CMTBIN)))
+endif
+ifneq (,$(findstring i486,$(CMTBIN)))
 _mode = 32
-else ifneq (,$(findstring i586,$(CMTBIN)))
+endif
+ifneq (,$(findstring i586,$(CMTBIN)))
 _mode = 32
-else ifneq (,$(findstring i686,$(CMTBIN)))
+endif
+ifneq (,$(findstring i686,$(CMTBIN)))
 _mode = 32
-else ifneq (,$(findstring x86_64,$(CMTBIN)))
+endif
+ifneq (,$(findstring x86_64,$(CMTBIN)))
 _mode = 64
 endif
@@ -107,6 +111,21 @@
 ifeq ($(_mode),32)
     TARGET_ARCH = -m32
-else ifeq ($(_mode),64)
+endif
+ifeq ($(_mode),64)
     TARGET_ARCH = -m64
+endif
+endif
+
+#
+# Specify mode explicitly for Darwin
+# (on Mac OS X 10.6, uname -m may show i386
+# while c++ builds for x86_64 by default)
+#
+ifneq (,$(findstring Darwin,$(CMTBIN)))
+ifeq ($(_mode),32)
+    TARGET_ARCH = -arch i386
+endif
+ifeq ($(_mode),64)
+    TARGET_ARCH = -arch x86_64
 endif
 endif
@@ -139,5 +158,6 @@
 format_dependencies = $(CMTROOT)/mgr/cmt_format_deps.sh
 build_dependencies = :
-else ifneq (,$(findstring Darwin,$(CMTBIN)))
+endif
+ifneq (,$(findstring Darwin,$(CMTBIN)))
 cppdepflags = -MM
 format_dependencies = $(CMTROOT)/mgr/cmt_format_deps.sh
Index: /CMT/HEAD/mgr/fragments/nmake/constituent
===================================================================
--- /CMT/HEAD/mgr/fragments/nmake/constituent	(revision 575)
+++ /CMT/HEAD/mgr/fragments/nmake/constituent	(revision 576)
@@ -58,4 +58,6 @@
 #!endif
 
+!if defined (cmt_${CONSTITUENT}_has_target_tag)
+
 !if "$(QUICK)" == "" || !exist ($(cmt_local_${CONSTITUENT}_makefile)) || !exist ($(cmt_local_tagfile_${CONSTITUENT})) || !exist ($(cmt_final_setup_${CONSTITUENT}))
 $(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies)
@@ -68,4 +70,18 @@
 !else
 $(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) ;
+!endif
+
+!else
+
+!if "$(QUICK)" == "" || !exist ($(cmt_local_${CONSTITUENT}_makefile)) || !exist ($(cmt_local_tagfile_${CONSTITUENT})) || !exist ($(cmt_final_setup_${CONSTITUENT}))
+$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies)
+	$(echo) (constituents.nmake) Building ${CONSTITUENT}.nmake
+	@set include=$(include)
+	@set lib=$(lib)
+	@$(cmtexe) -f=$(bin)${CONSTITUENT}.in -tag=$(tags) $(${CONSTITUENT}_extratags) build -nmake constituent_makefile -without_cmt -out=$@ ${CONSTITUENT}
+!else
+$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) ;
+!endif
+
 !endif
 
Index: /CMT/HEAD/mgr/fragments/nmake/constituent_lock
===================================================================
--- /CMT/HEAD/mgr/fragments/nmake/constituent_lock	(revision 575)
+++ /CMT/HEAD/mgr/fragments/nmake/constituent_lock	(revision 576)
@@ -58,4 +58,6 @@
 #!endif
 
+!if defined (cmt_${CONSTITUENT}_has_target_tag)
+
 !if "$(QUICK)" == "" || !exist ($(cmt_local_${CONSTITUENT}_makefile)) || !exist ($(cmt_local_tagfile_${CONSTITUENT})) || !exist ($(cmt_final_setup_${CONSTITUENT}))
 $(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies)
@@ -68,4 +70,18 @@
 !else
 $(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) ;
+!endif
+
+!else
+
+!if "$(QUICK)" == "" || !exist ($(cmt_local_${CONSTITUENT}_makefile)) || !exist ($(cmt_local_tagfile_${CONSTITUENT})) || !exist ($(cmt_final_setup_${CONSTITUENT}))
+$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies)
+	$(echo) (constituents.nmake) Building ${CONSTITUENT}.nmake
+	@set include=$(include)
+	@set lib=$(lib)
+	@$(cmtexe) -f=$(bin)${CONSTITUENT}.in -tag=$(tags) $(${CONSTITUENT}_extratags) build -nmake constituent_makefile -without_cmt -out=$@ ${CONSTITUENT}
+!else
+$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) ;
+!endif
+
 !endif
 
Index: /CMT/HEAD/source/cmt_system.cxx
===================================================================
--- /CMT/HEAD/source/cmt_system.cxx	(revision 575)
+++ /CMT/HEAD/source/cmt_system.cxx	(revision 576)
@@ -2193,5 +2193,5 @@
   if (0 == buffer)
     {
-      char num[32]; sprintf (num, "%u", allocated + 1);
+      char num[32]; sprintf (num, "%lu", allocated + 1);
       cmt_string msg ("Cannot allocate ");
       msg += num;
@@ -2274,5 +2274,5 @@
   if (0 == buffer)
     {
-      char num[32]; sprintf (num, "%u", allocated + 1);
+      char num[32]; sprintf (num, "%lu", allocated + 1);
       cmt_string msg ("Cannot allocate ");
       msg += num;
Index: /CMT/HEAD/source/cmt_use.cxx
===================================================================
--- /CMT/HEAD/source/cmt_use.cxx	(revision 575)
+++ /CMT/HEAD/source/cmt_use.cxx	(revision 576)
@@ -4150,5 +4150,5 @@
 	  if (Cmt::get_debug ())
 	    {
-	      char num[32]; sprintf (num, "%#x", sub_uses[i]);
+	      char num[32]; sprintf (num, "%p", sub_uses[i]);
 	      char index[32]; sprintf (index, "%d", sub_uses[i]->m_index);
 	      s += "[";
@@ -4165,5 +4165,5 @@
 	      if (Cmt::get_debug ())
 		{
-		  char num[32]; sprintf (num, "%#x", au);
+		  char num[32]; sprintf (num, "%p", au);
 		  char index[32]; sprintf (index, "%d", au->m_index);
 		  s += "[";
