Index: /CMT/HEAD/ChangeLog
===================================================================
--- /CMT/HEAD/ChangeLog	(revision 433)
+++ /CMT/HEAD/ChangeLog	(revision 434)
@@ -1,2 +1,12 @@
+2008-01-18    <rybkin@lal.in2p3.fr> 339
+
+	* mgr/fragments/constituent: Do not rebuild any *.make files when QUICK
+	is defined, build all the *.make files in the binary tag directory,
+	do not use MAKEFLAGS explicitly, do not leave a lock file in /tmp
+	* mgr/fragments/constituent_lock: idem
+	* mgr/fragments/constituents_header: idem
+	* mgr/fragments/make_header: idem
+	* src/Makefile.header: idem
+	
 2008-01-14    <rybkin@lal.in2p3.fr> 338
 
Index: /CMT/HEAD/mgr/fragments/constituent
===================================================================
--- /CMT/HEAD/mgr/fragments/constituent	(revision 433)
+++ /CMT/HEAD/mgr/fragments/constituent	(revision 434)
@@ -12,5 +12,6 @@
 cmt_local_${CONSTITUENT}_makefile = /tmp/CMT_${CONSTITUENT}$(cmt_lock_pid).make
 else
-cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
+#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
+cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag)_${CONSTITUENT}.make
 cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}_${CONSTITUENT}setup.make
 cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
@@ -19,5 +20,10 @@
 ${CONSTITUENT}_extratags = -tag_add=target_${CONSTITUENT}
 
-$(cmt_local_tagfile_${CONSTITUENT}) : $(cmt_lock_setup)
+#$(cmt_local_tagfile_${CONSTITUENT}) : $(cmt_lock_setup)
+ifndef QUICK
+$(cmt_local_tagfile_${CONSTITUENT}) ::
+else
+$(cmt_local_tagfile_${CONSTITUENT}) :
+endif
 	@/bin/echo "------> (constituents.make) Rebuilding setup.make $(cmt_local_tagfile_${CONSTITUENT})"
 	@if test -f $(cmt_local_tagfile_${CONSTITUENT}); then /bin/rm -f $(cmt_local_tagfile_${CONSTITUENT}); fi ; \
@@ -34,5 +40,6 @@
 cmt_local_${CONSTITUENT}_makefile = /tmp/CMT_${CONSTITUENT}$(cmt_lock_pid).make
 else
-cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
+#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
+cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag).make
 cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}setup.make
 cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
@@ -41,5 +48,9 @@
 endif
 
+ifndef QUICK
 $(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs
+else
+$(cmt_local_${CONSTITUENT}_makefile) :: $(cmt_local_tagfile_${CONSTITUENT})
+endif
 	@echo "------> (constituents.make) Building ${CONSTITUENT}.make"; \
 	  $(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
@@ -47,5 +58,5 @@
 ${CONSTITUENT} :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
 	@echo "------> (constituents.make) Starting ${CONSTITUENT}"
-	@$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}
+	@$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}
 	@echo "------> (constituents.make) ${CONSTITUENT} done"
 
@@ -55,5 +66,5 @@
 	@-if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
 	  echo "------> (constituents.make) Starting ${CONSTITUENT}clean"; \
-	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}clean; \
+	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}clean; \
 	fi
 
@@ -64,5 +75,5 @@
 ${CONSTITUENT}install :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
 	@echo "------> (constituents.make) Starting install ${CONSTITUENT}"
-	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} install
+	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) cmt_lock_pid=$${cmt_lock_pid} install
 	@echo "------> (constituents.make) install ${CONSTITUENT} done"
 
@@ -71,5 +82,5 @@
 ${CONSTITUENT}uninstall :: $(cmt_local_${CONSTITUENT}_makefile)
 	@echo "------> (constituents.make) Starting uninstall ${CONSTITUENT}"
-	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} uninstall
+	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) cmt_lock_pid=$${cmt_lock_pid} uninstall
 	@echo "------> (constituents.make) uninstall ${CONSTITUENT} done"
 
Index: /CMT/HEAD/mgr/fragments/constituent_lock
===================================================================
--- /CMT/HEAD/mgr/fragments/constituent_lock	(revision 433)
+++ /CMT/HEAD/mgr/fragments/constituent_lock	(revision 434)
@@ -12,5 +12,6 @@
 cmt_local_${CONSTITUENT}_makefile = /tmp/CMT_${CONSTITUENT}$(cmt_lock_pid).make
 else
-cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
+#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
+cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag)_${CONSTITUENT}.make
 cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}_${CONSTITUENT}setup.make
 cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
@@ -19,5 +20,10 @@
 ${CONSTITUENT}_extratags = -tag_add=target_${CONSTITUENT}
 
-$(cmt_local_tagfile_${CONSTITUENT}) : $(cmt_lock_setup)
+#$(cmt_local_tagfile_${CONSTITUENT}) : $(cmt_lock_setup)
+ifndef QUICK
+$(cmt_local_tagfile_${CONSTITUENT}) ::
+else
+$(cmt_local_tagfile_${CONSTITUENT}) :
+endif
 	@/bin/echo "------> (constituents.make) Rebuilding setup.make $(cmt_local_tagfile_${CONSTITUENT})"
 	@if test -f $(cmt_local_tagfile_${CONSTITUENT}); then /bin/rm -f $(cmt_local_tagfile_${CONSTITUENT}); fi ; \
@@ -34,5 +40,6 @@
 cmt_local_${CONSTITUENT}_makefile = /tmp/CMT_${CONSTITUENT}$(cmt_lock_pid).make
 else
-cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
+#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
+cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag).make
 cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}setup.make
 cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
@@ -41,5 +48,9 @@
 endif
 
+ifndef QUICK
 $(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs
+else
+$(cmt_local_${CONSTITUENT}_makefile) :: $(cmt_local_tagfile_${CONSTITUENT})
+endif
 	@echo "------> (constituents.make) Building ${CONSTITUENT}.make"; \
 	  $(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
@@ -49,6 +60,6 @@
 	@${lock_command} ${CONSTITUENT}${lock_suffix}
 	@echo "------> (constituents.make) Starting ${CONSTITUENT}"
-	@$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}; \
-	status=$$?; ${unlock_command} ${CONSTITUENT}${lock_suffix}; exit $${status}
+	@$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}; \
+	retval=$$?; ${unlock_command} ${CONSTITUENT}${lock_suffix}; exit $${retval}
 	@echo "------> (constituents.make) ${CONSTITUENT} done"
 
@@ -58,5 +69,5 @@
 	@-if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
 	  echo "------> (constituents.make) Starting ${CONSTITUENT}clean"; \
-	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}clean; \
+	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}clean; \
 	fi
 
@@ -67,5 +78,5 @@
 ${CONSTITUENT}install :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
 	@echo "------> (constituents.make) Starting install ${CONSTITUENT}"
-	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} install
+	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) cmt_lock_pid=$${cmt_lock_pid} install
 	@echo "------> (constituents.make) install ${CONSTITUENT} done"
 
@@ -74,5 +85,5 @@
 ${CONSTITUENT}uninstall :: $(cmt_local_${CONSTITUENT}_makefile)
 	@echo "------> (constituents.make) Starting uninstall ${CONSTITUENT}"
-	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} uninstall
+	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) cmt_lock_pid=$${cmt_lock_pid} uninstall
 	@echo "------> (constituents.make) uninstall ${CONSTITUENT} done"
 
Index: /CMT/HEAD/mgr/fragments/constituents_header
===================================================================
--- /CMT/HEAD/mgr/fragments/constituents_header	(revision 433)
+++ /CMT/HEAD/mgr/fragments/constituents_header	(revision 434)
@@ -17,8 +17,10 @@
 cmt_local_tagfile = /tmp/CMT_$(${PACKAGE}_tag).make$(cmt_lock_pid)
 else
-cmt_local_tagfile = $(${PACKAGE}_tag).make
+#cmt_local_tagfile = $(${PACKAGE}_tag).make
+cmt_local_tagfile = $(bin)$(${PACKAGE}_tag).make
 endif
 
--include $(cmt_local_tagfile)
+#-include $(cmt_local_tagfile)
+include $(cmt_local_tagfile)
 
 ifdef READONLY
@@ -26,49 +28,59 @@
 cmt_final_setup = /tmp/CMT_${PACKAGE}setup.make
 else
-cmt_local_setup = $(bin)${PACKAGE}setup$(cmt_lock_pid).make
-cmt_final_setup = $(bin)${PACKAGE}setup.make
+#cmt_local_setup = $(bin)${PACKAGE}setup$(cmt_lock_pid).make
+cmt_local_setup = $(bin)$(package)setup$$$$.make
+#cmt_final_setup = $(bin)${PACKAGE}setup.make
+cmt_final_setup = $(bin)$(package)setup.make
 endif
 
 #--------------------------------------------------------
 
-cmt_lock_setup = /tmp/lock$(cmt_lock_pid).make
-cmt_temp_tag = /tmp/tag$(cmt_lock_pid).make
+#cmt_lock_setup = /tmp/lock$(cmt_lock_pid).make
+#cmt_temp_tag = /tmp/tag$(cmt_lock_pid).make
 
-first :: $(cmt_local_tagfile)
-	@echo $(cmt_local_tagfile) ok
+#first :: $(cmt_local_tagfile)
+#	@echo $(cmt_local_tagfile) ok
+ifndef QUICK
+first :: $(cmt_final_setup) ;
+else
+first :: ;
+endif
 
 ##	@bin=`$(cmtexe) -quiet show macro_value bin`
 
-$(cmt_local_tagfile) : $(cmt_lock_setup)
-	@/bin/echo "------> (constituents.make) Rebuilding setup.make $(cmt_local_tagfile)"
-	@if test -f $(cmt_local_tagfile); then /bin/rm -f $(cmt_local_tagfile); fi
-	@$(cmtexe) -quiet -tag=$(tags) build tag_makefile >$(cmt_temp_tag)
-	@mv $(cmt_temp_tag) $(cmt_local_tagfile)
-	@bin=$(bin); \
-	  if test ! -d $${bin} ; then $(mkdir) -p $${bin} ; fi; \
-	  echo CMTCONFIG=$(CMTCONFIG); \
+#$(cmt_local_tagfile) : $(cmt_lock_setup)
+#	@echo "#CMT> Error: $@: No such file" >&2; exit 1
+$(cmt_local_tagfile) :
+	@echo "#CMT> Warning: $@: No such file" >&2; exit
+#	@echo "#CMT> Info: $@: No need to rebuild file" >&2; exit
+
+$(cmt_final_setup) : $(cmt_local_tagfile) 
+	@/bin/echo "------> (constituents.make) Rebuilding $@"
+	@if test ! -d $(@D); then $(mkdir) -p $(@D); fi; \
 	  if test -f $(cmt_local_setup); then /bin/rm -f $(cmt_local_setup); fi; \
-	  cmt_local_setup=$${bin}${PACKAGE}setup$(cmt_lock_pid).make; \
-	  cmt_final_setup=$${bin}${PACKAGE}setup.make; \
-	  trap '/bin/rm -f $${cmt_local_setup}' 0 1 2 15; \
-	  $(cmtexe) -quiet -tag=$(tags) show setup >>$${cmt_local_setup}; \
-	  if test ! -f $${cmt_final_setup}; then \
-	    mv $${cmt_local_setup} $${cmt_final_setup}; \
+	  trap '/bin/rm -f $(cmt_local_setup)' 0 1 2 15; \
+	  $(cmtexe) -quiet -tag=$(tags) show setup >>$(cmt_local_setup); \
+	  if test ! -f $@; then \
+	    mv $(cmt_local_setup) $@; \
 	  else \
-	    if /usr/bin/diff $${cmt_local_setup} $${cmt_final_setup} >/dev/null ; then \
-	      echo "$${cmt_final_setup} untouched "; \
+	    if /usr/bin/diff $(cmt_local_setup) $@ >/dev/null ; then \
+	      echo "$@ untouched"; \
 	    else \
-	      mv $${cmt_local_setup} $${cmt_final_setup}; \
+	      mv $(cmt_local_setup) $@; \
 	    fi; \
 	  fi
-	@/bin/echo setup.make ok   
+	@/bin/echo $@ ok   
+
 config :: checkuses
 	@exit 0
+checkuses : ;
 
 env.make ::
 	printenv >env.make.tmp; $(cmtexe) -quiet check files env.make.tmp env.make
 
+ifndef QUICK
 all :: build_library_links
 	@echo "------> (constituents.make) all done"
+endif
 
 javadirs ::
@@ -88,8 +100,10 @@
 
 .DEFAULT ::
-	@if test "$@" = "$(cmt_lock_setup)"; then \
-	  /bin/rm -f $(cmt_lock_setup); \
-	  touch $(cmt_lock_setup); \
-	fi
+	@echo "#CMT> Warning: $@: Using default commands" >&2; exit
+
+#	@if test "$@" = "$(cmt_lock_setup)"; then \
+	#  /bin/rm -f $(cmt_lock_setup); \
+	 # touch $(cmt_lock_setup); \
+	#fi
 
 #-- end of constituents_header ------
Index: /CMT/HEAD/mgr/fragments/make_header
===================================================================
--- /CMT/HEAD/mgr/fragments/make_header	(revision 433)
+++ /CMT/HEAD/mgr/fragments/make_header	(revision 434)
@@ -29,5 +29,6 @@
 cmt_local_tagfile_${CONSTITUENT} = /tmp/CMT_$(${PACKAGE}_tag)_${CONSTITUENT}.make$(cmt_lock_pid)
 else
-cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
+#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
+cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag)_${CONSTITUENT}.make
 endif
 
@@ -41,5 +42,6 @@
 cmt_local_tagfile_${CONSTITUENT} = /tmp/CMT_$(${PACKAGE}_tag).make$(cmt_lock_pid)
 else
-cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
+#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
+cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag).make
 endif
 
Index: /CMT/HEAD/src/Makefile.header
===================================================================
--- /CMT/HEAD/src/Makefile.header	(revision 433)
+++ /CMT/HEAD/src/Makefile.header	(revision 434)
@@ -21,5 +21,11 @@
 cmt_local_tagfile = /tmp/CMT_$(tag).make$$$$
 else
-cmt_local_tagfile = $(tag).make
+cmt_local_tagfile = $(bin)$(tag).make
+endif
+
+ifdef READONLY
+cmt_constituents_makefile = /tmp/CMT_$(tag)_constituents.make$$$$
+else
+cmt_constituents_makefile = $(bin)constituents.make
 endif
 
@@ -27,14 +33,20 @@
 #  Generic entry points for all targets
 #
-all :: check_config
+ifndef QUICK
+all :: check_config ;
+else
+all :: no_check_config ;
+endif
 
 check_config ::
-	@$(cmtexe) check configuration; status=$$?; \
-	if test $${status} = 0; then \
-	  /bin/rm -f $(cmt_local_tagfile); \
-	  $(MAKE) --no-print-directory $(MAKEFLAGS) target="first config all" common_target; \
+	@$(cmtexe) check configuration; retval=$$?; \
+	if test $${retval} = 0; then \
+	  $(MAKE) --no-print-directory target="first config all" common_target; \
 	else \
 	  echo "#CMT> There are configuration errors. Please correct them before running gmake"; \
 	fi
+
+no_check_config ::
+	@$(MAKE) --no-print-directory target="first config all" common_target
 
 binclean ::
@@ -57,4 +69,5 @@
 #  Capture all possible targets
 #
+ifdef READONLY
 common_target ::
 	@tmpdir=/tmp; \
@@ -79,5 +92,30 @@
 	  fi; \
 	  exit $${status}
+else
+common_target : $(cmt_constituents_makefile)
+	@$(MAKE) --no-print-directory -f $< cmt_lock_pid=$(cmt_lock_pid) $(target)
+endif
 
+$(cmt_constituents_makefile) : $(cmt_local_tagfile)
+	@echo "------> (Makefile.header) Rebuilding $@"; \
+	  if test ! -d $(@D) ; then $(mkdir) -p $(@D); fi; \
+	  $(cmtexe) -quiet -tag=$(tags) build constituents_makefile -out=$@; \
+	  retval=$$?; \
+	  if test $${retval} != 0; then \
+	  echo "#CMT> Error generating constituents makefile" >&2; \
+	  /bin/rm -f $@; fi; \
+	  exit $${retval}
+
+ifndef QUICK
+$(cmt_local_tagfile) ::
+else
+$(cmt_local_tagfile) :
+endif
+	@/bin/echo "------> (Makefile.header) Rebuilding $@"; \
+	  if test -f $@; then rm -f $@; fi; \
+	  if test ! -d $(@D); then $(mkdir) -p $(@D); fi; \
+	  echo CMTCONFIG=$(CMTCONFIG) ; \
+	  $(cmtexe) -quiet -tag=$(tags) build tag_makefile >$@ \
+ 	  && /bin/echo $@ ok   
 
 #
@@ -120,2 +158,5 @@
 
 
+# explicit rule not to remake
+${CMTROOT}/src/Makefile.header : ;
+${CMTROOT}/src/Makefile.core : ;
