Index: CMT/HEAD/ChangeLog
===================================================================
--- CMT/HEAD/ChangeLog	(revision 627)
+++ CMT/HEAD/ChangeLog	(revision 628)
@@ -1,2 +1,39 @@
+2013-01-11    <rybkin@lal.in2p3.fr> 499
+
+	* source/cmt_generators.cxx: In class LibraryGenerator function build,
+	depending on constituent attribute need_prototypes, set m_HASPROTOTYPES
+	accordingly and fill jar_header, java_header, library_header,
+	application_header makefiles fragments with value, in class
+	ConstituentsMakefileGenerator constructor, in function reset, handle
+	introduced fragment constituent_app_lib, in function build, set
+	m_HASPROTOTYPES according to constituent attribute need_prototypes, fill
+	introduced fragment constituent_app_lib with value
+	* source/cmt_generators.h: In class ConstituentsMakefileGenerator,
+	introduce member for fragment constituent_app_lib
+	* source/cmt_generator.h: In class CmtGenerator, introduce member m_HASPROTOTYPES
+	* source/cmt_generator.cxx: In class CmtGenerator constructor, in function
+	reset, handle introduced member m_HASPROTOTYPES
+	* source/cmt_parser.cxx: In class StandardMacroBuilder function
+	fill_for_constituent_macros, define macros <constituent>compile_dependencies,
+	<constituent>prototype_dependencies for applications, libraries
+	* mgr/fragments/constituent_app_lib: Introduce makefiles fragment for
+	applications, libraries in order to compile dependent constituents in
+	parallel
+	* mgr/fragments/constituent: Remove unused code, add empty command for
+	double-colon rules without one (so that implicit rule is not searched for)
+	* mgr/fragments/constituent_lock: idem
+	* mgr/fragments/application_header: Add rules for ${CONSTITUENT}compile,
+	${CONSTITUENT}prototype targets
+	* mgr/fragments/java_header: idem
+	* mgr/fragments/library_header: idem
+	* mgr/fragments/jar_header: idem
+	* mgr/fragments/library: Create shared library stamp in same rule as library
+	* mgr/fragments/library_no_static: Create library stamps in same rule as
+	library
+	* mgr/fragments/jar: Add empty command for double-colon rules without one (so that implicit rule is not searched for)
+	* mgr/fragments/java: Create necessary directory in compilation rule to
+	avoid race condition
+	* mgr/requirements: Declare makefiles fragment constituent_app_lib
+
 2013-01-03    <rybkin@lal.in2p3.fr> 498
 
Index: CMT/HEAD/mgr/fragments/application_header
===================================================================
--- CMT/HEAD/mgr/fragments/application_header	(revision 627)
+++ CMT/HEAD/mgr/fragments/application_header	(revision 628)
@@ -4,3 +4,15 @@
 	$(echo) "${CONSTITUENT} ok"
 
+cmt_${CONSTITUENT}_${HASPROTOTYPES} = 1
+
+#--------------------------------------
+
+ifdef cmt_${CONSTITUENT}_has_prototypes
+
+${CONSTITUENT}prototype : ${PROTOTARGET} ;
+
+endif
+
+${CONSTITUENT}compile : ${OBJS} ;
+
 #-- end of application_header
Index: CMT/HEAD/mgr/fragments/constituent
===================================================================
--- CMT/HEAD/mgr/fragments/constituent	(revision 627)
+++ CMT/HEAD/mgr/fragments/constituent	(revision 628)
@@ -3,41 +3,18 @@
 cmt_${CONSTITUENT}_${HASTARGETTAG} = 1
 
-#--------------------------------------------------------
+#--------------------------------------
 
 ifdef cmt_${CONSTITUENT}_has_target_tag
 
-#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
 cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag)_${CONSTITUENT}.make
-cmt_local_setup_${CONSTITUENT} = $(bin)setup_${CONSTITUENT}$$$$.make
 cmt_final_setup_${CONSTITUENT} = $(bin)setup_${CONSTITUENT}.make
-#cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}_${CONSTITUENT}setup.make
 cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
 
 ${CONSTITUENT}_extratags = -tag_add=target_${CONSTITUENT}
 
-#$(cmt_local_tagfile_${CONSTITUENT}) : $(cmt_lock_setup)
-ifndef QUICK
-$(cmt_local_tagfile_${CONSTITUENT}) ::
-else
-$(cmt_local_tagfile_${CONSTITUENT}) :
-endif
-	$(echo) "(constituents.make) Rebuilding $@"; \
-	  if test -f $(cmt_local_tagfile_${CONSTITUENT}); then /bin/rm -f $(cmt_local_tagfile_${CONSTITUENT}); fi ; \
-	  $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build tag_makefile >>$(cmt_local_tagfile_${CONSTITUENT})
-	$(echo) "(constituents.make) Rebuilding $(cmt_final_setup_${CONSTITUENT})"; \
-	  test ! -f $(cmt_local_setup_${CONSTITUENT}) || \rm -f $(cmt_local_setup_${CONSTITUENT}); \
-	  trap '\rm -f $(cmt_local_setup_${CONSTITUENT})' 0 1 2 15; \
-	  $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) show setup >$(cmt_local_setup_${CONSTITUENT}) && \
-	  if [ -f $(cmt_final_setup_${CONSTITUENT}) ] && \
-	    \cmp -s $(cmt_final_setup_${CONSTITUENT}) $(cmt_local_setup_${CONSTITUENT}); then \
-	    \rm $(cmt_local_setup_${CONSTITUENT}); else \
-	    \mv -f $(cmt_local_setup_${CONSTITUENT}) $(cmt_final_setup_${CONSTITUENT}); fi
-
 else
 
-#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
 cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag).make
 cmt_final_setup_${CONSTITUENT} = $(bin)setup.make
-#cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}setup.make
 cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
 
@@ -53,18 +30,4 @@
 ${CONSTITUENT}dirs : ;
 endif
-
-#ifndef QUICK
-#ifdef STRUCTURED_OUTPUT
-# ${CONSTITUENT}dirs ::
-#	@if test ! -d $(bin)${CONSTITUENT}; then $(mkdir) -p $(bin)${CONSTITUENT}; fi
-#	$(echo) "STRUCTURED_OUTPUT="$(bin)${CONSTITUENT}
-#
-#$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs ${CONSTITUENT}dirs
-#else
-#$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs
-#endif
-#else
-#$(cmt_local_${CONSTITUENT}_makefile) :: $(cmt_local_tagfile_${CONSTITUENT})
-#endif
 
 ifdef cmt_${CONSTITUENT}_has_target_tag
@@ -114,5 +77,5 @@
 	$(echo) "(constituents.make) ${CONSTITUENT} done"
 
-clean :: ${CONSTITUENT}clean
+clean :: ${CONSTITUENT}clean ;
 
 ${CONSTITUENT}clean :: $(${CONSTITUENT}clean_dependencies) ##$(cmt_local_${CONSTITUENT}_makefile)
@@ -126,5 +89,5 @@
 ##	  /bin/rm -f $(cmt_local_${CONSTITUENT}_makefile) $(bin)${CONSTITUENT}_dependencies.make
 
-install :: ${CONSTITUENT}install
+install :: ${CONSTITUENT}install ;
 
 ${CONSTITUENT}install :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
@@ -145,5 +108,5 @@
 	$(echo) "(constituents.make) uninstall ${CONSTITUENT} done"
 
-remove_library_links :: ${CONSTITUENT}uninstall
+remove_library_links :: ${CONSTITUENT}uninstall ;
 
 ifndef PEDANTIC
Index: CMT/HEAD/mgr/fragments/constituent_app_lib
===================================================================
--- CMT/HEAD/mgr/fragments/constituent_app_lib	(revision 628)
+++ CMT/HEAD/mgr/fragments/constituent_app_lib	(revision 628)
@@ -0,0 +1,140 @@
+#-- start of constituent_app_lib ------
+
+cmt_${CONSTITUENT}_${HASTARGETTAG} = 1
+cmt_${CONSTITUENT}_${HASPROTOTYPES} = 1
+
+#--------------------------------------
+
+ifdef cmt_${CONSTITUENT}_has_target_tag
+
+cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag)_${CONSTITUENT}.make
+cmt_final_setup_${CONSTITUENT} = $(bin)setup_${CONSTITUENT}.make
+cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
+
+${CONSTITUENT}_extratags = -tag_add=target_${CONSTITUENT}
+
+else
+
+cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag).make
+cmt_final_setup_${CONSTITUENT} = $(bin)setup.make
+cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
+
+endif
+
+not_${CONSTITUENT}compile_dependencies = { n=0; for p in $?; do m=0; for d in $(${CONSTITUENT}compile_dependencies); do if [ $$p = $$d ]; then m=1; break; fi; done; if [ $$m -eq 0 ]; then n=1; break; fi; done; [ $$n -eq 1 ]; }
+
+ifdef STRUCTURED_OUTPUT
+${CONSTITUENT}dirs :
+	@if test ! -d $(bin)${CONSTITUENT}; then $(mkdir) -p $(bin)${CONSTITUENT}; fi
+	$(echo) "STRUCTURED_OUTPUT="$(bin)${CONSTITUENT}
+else
+${CONSTITUENT}dirs : ;
+endif
+
+ifdef cmt_${CONSTITUENT}_has_target_tag
+
+ifndef QUICK
+$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}compile_dependencies) build_library_links
+	$(echo) "(constituents.make) Building ${CONSTITUENT}.make"; \
+	  $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_config -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
+else
+$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}compile_dependencies) $(cmt_build_library_linksstamp) $(use_requirements)
+	@if [ ! -f $@ ] || [ ! -f $(cmt_local_tagfile_${CONSTITUENT}) ] || \
+	  [ ! -f $(cmt_final_setup_${CONSTITUENT}) ] || \
+	  $(not_${CONSTITUENT}compile_dependencies) ; then \
+	  test -z "$(cmtmsg)" || \
+	  echo "$(CMTMSGPREFIX)" "(constituents.make) Building ${CONSTITUENT}.make"; \
+	  $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_config -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}; \
+	  fi
+endif
+
+else
+
+ifndef QUICK
+$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}compile_dependencies) build_library_links
+	$(echo) "(constituents.make) Building ${CONSTITUENT}.make"; \
+	  $(cmtexe) -f=$(bin)${CONSTITUENT}.in -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -without_cmt -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
+else
+$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}compile_dependencies) $(cmt_build_library_linksstamp) $(bin)${CONSTITUENT}.in
+	@if [ ! -f $@ ] || [ ! -f $(cmt_local_tagfile_${CONSTITUENT}) ] || \
+	  [ ! -f $(cmt_final_setup_${CONSTITUENT}) ] || \
+	  $(not_${CONSTITUENT}compile_dependencies) ; then \
+	  test -z "$(cmtmsg)" || \
+	  echo "$(CMTMSGPREFIX)" "(constituents.make) Building ${CONSTITUENT}.make"; \
+	  $(cmtexe) -f=$(bin)${CONSTITUENT}.in -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -without_cmt -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}; \
+	  fi
+endif
+
+endif
+
+#	  $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
+
+ifdef cmt_${CONSTITUENT}_has_prototypes
+
+${CONSTITUENT} :: ${CONSTITUENT}prototype ${CONSTITUENT}compile ${CONSTITUENT}install ;
+
+${CONSTITUENT}prototype : $(${CONSTITUENT}prototype_dependencies) $(cmt_local_${CONSTITUENT}_makefile) dirs ${CONSTITUENT}dirs
+	$(echo) "(constituents.make) Starting $@"
+	@if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
+	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $@; \
+	  fi
+#	@$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $@
+	$(echo) "(constituents.make) $@ done"
+
+${CONSTITUENT}compile : ${CONSTITUENT}prototype
+
+else
+
+${CONSTITUENT} :: ${CONSTITUENT}compile ${CONSTITUENT}install ;
+
+endif
+
+${CONSTITUENT}compile : $(${CONSTITUENT}compile_dependencies) $(cmt_local_${CONSTITUENT}_makefile) dirs ${CONSTITUENT}dirs
+	$(echo) "(constituents.make) Starting $@"
+	@if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
+	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $@; \
+	  fi
+#	@$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $@
+	$(echo) "(constituents.make) $@ done"
+
+clean :: ${CONSTITUENT}clean ;
+
+${CONSTITUENT}clean :: $(${CONSTITUENT}clean_dependencies) ##$(cmt_local_${CONSTITUENT}_makefile)
+	$(echo) "(constituents.make) Starting ${CONSTITUENT}clean"
+	@-if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
+	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}clean; \
+	fi
+	$(echo) "(constituents.make) ${CONSTITUENT}clean done"
+#	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}clean
+
+##	  /bin/rm -f $(cmt_local_${CONSTITUENT}_makefile) $(bin)${CONSTITUENT}_dependencies.make
+
+install :: ${CONSTITUENT}install ;
+
+${CONSTITUENT}install :: ${CONSTITUENT}compile $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
+	$(echo) "(constituents.make) Starting install ${CONSTITUENT}"
+	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $@
+	$(echo) "(constituents.make) install ${CONSTITUENT} done"
+
+uninstall : ${CONSTITUENT}uninstall
+
+$(foreach d,$(${CONSTITUENT}_dependencies),$(eval $(d)uninstall_dependencies += ${CONSTITUENT}uninstall))
+
+${CONSTITUENT}uninstall : $(${CONSTITUENT}uninstall_dependencies) ##$(cmt_local_${CONSTITUENT}_makefile)
+	$(echo) "(constituents.make) Starting uninstall ${CONSTITUENT}"
+	@if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
+	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) uninstall; \
+	  fi
+#	@$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) uninstall
+	$(echo) "(constituents.make) uninstall ${CONSTITUENT} done"
+
+remove_library_links :: ${CONSTITUENT}uninstall ;
+
+ifndef PEDANTIC
+.DEFAULT::
+	$(echo) "(constituents.make) Starting $@ ${CONSTITUENT}"
+	$(echo) Using default action for $@
+	$(echo) "(constituents.make) $@ ${CONSTITUENT} done"
+endif
+
+#-- end of constituent_app_lib ------
Index: CMT/HEAD/mgr/fragments/constituent_lock
===================================================================
--- CMT/HEAD/mgr/fragments/constituent_lock	(revision 627)
+++ CMT/HEAD/mgr/fragments/constituent_lock	(revision 628)
@@ -7,37 +7,14 @@
 ifdef cmt_${CONSTITUENT}_has_target_tag
 
-#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
 cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag)_${CONSTITUENT}.make
-cmt_local_setup_${CONSTITUENT} = $(bin)setup_${CONSTITUENT}$$$$.make
 cmt_final_setup_${CONSTITUENT} = $(bin)setup_${CONSTITUENT}.make
-#cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}_${CONSTITUENT}setup.make
 cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
 
 ${CONSTITUENT}_extratags = -tag_add=target_${CONSTITUENT}
 
-#$(cmt_local_tagfile_${CONSTITUENT}) : $(cmt_lock_setup)
-ifndef QUICK
-$(cmt_local_tagfile_${CONSTITUENT}) ::
-else
-$(cmt_local_tagfile_${CONSTITUENT}) :
-endif
-	$(echo) "(constituents.make) Rebuilding $@"; \
-	  if test -f $(cmt_local_tagfile_${CONSTITUENT}); then /bin/rm -f $(cmt_local_tagfile_${CONSTITUENT}); fi ; \
-	  $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build tag_makefile >>$(cmt_local_tagfile_${CONSTITUENT})
-	$(echo) "(constituents.make) Rebuilding $(cmt_final_setup_${CONSTITUENT})"; \
-	  test ! -f $(cmt_local_setup_${CONSTITUENT}) || \rm -f $(cmt_local_setup_${CONSTITUENT}); \
-	  trap '\rm -f $(cmt_local_setup_${CONSTITUENT})' 0 1 2 15; \
-	  $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) show setup >$(cmt_local_setup_${CONSTITUENT}) && \
-	  if [ -f $(cmt_final_setup_${CONSTITUENT}) ] && \
-	    \cmp -s $(cmt_final_setup_${CONSTITUENT}) $(cmt_local_setup_${CONSTITUENT}); then \
-	    \rm $(cmt_local_setup_${CONSTITUENT}); else \
-	    \mv -f $(cmt_local_setup_${CONSTITUENT}) $(cmt_final_setup_${CONSTITUENT}); fi
-
 else
 
-#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
 cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag).make
 cmt_final_setup_${CONSTITUENT} = $(bin)setup.make
-#cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}setup.make
 cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
 
@@ -53,18 +30,4 @@
 ${CONSTITUENT}dirs : ;
 endif
-
-#ifndef QUICK
-#ifdef STRUCTURED_OUTPUT
-# ${CONSTITUENT}dirs ::
-#	@if test ! -d $(bin)${CONSTITUENT}; then $(mkdir) -p $(bin)${CONSTITUENT}; fi
-#	$(echo) "STRUCTURED_OUTPUT="$(bin)${CONSTITUENT}
-#
-#$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs ${CONSTITUENT}dirs
-#else
-#$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs
-#endif
-#else
-#$(cmt_local_${CONSTITUENT}_makefile) :: $(cmt_local_tagfile_${CONSTITUENT})
-#endif
 
 ifdef cmt_${CONSTITUENT}_has_target_tag
@@ -129,5 +92,5 @@
 ##	  /bin/rm -f $(cmt_local_${CONSTITUENT}_makefile) $(bin)${CONSTITUENT}_dependencies.make
 
-install :: ${CONSTITUENT}install
+install :: ${CONSTITUENT}install ;
 
 ${CONSTITUENT}install :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
@@ -148,5 +111,5 @@
 	$(echo) "(constituents.make) uninstall ${CONSTITUENT} done"
 
-remove_library_links :: ${CONSTITUENT}uninstall
+remove_library_links :: ${CONSTITUENT}uninstall ;
 
 ifndef PEDANTIC
Index: CMT/HEAD/mgr/fragments/jar
===================================================================
--- CMT/HEAD/mgr/fragments/jar	(revision 627)
+++ CMT/HEAD/mgr/fragments/jar	(revision 628)
@@ -8,7 +8,7 @@
 ${CONSTITUENT}installname = ${CONSTITUENT}.jar
 
-${CONSTITUENT} :: ${CONSTITUENT}install
+${CONSTITUENT} :: ${CONSTITUENT}install ;
 
-install :: ${CONSTITUENT}install
+install :: ${CONSTITUENT}install ;
 
 ${CONSTITUENT}install :: $(install_dir)/$(${CONSTITUENT}installname)
@@ -29,5 +29,5 @@
 ##${CONSTITUENT}clean :: ${CONSTITUENT}uninstall
 
-uninstall :: ${CONSTITUENT}uninstall
+uninstall :: ${CONSTITUENT}uninstall ;
 
 ${CONSTITUENT}uninstall ::
@@ -41,6 +41,6 @@
 
 ${CONSTITUENT}clean ::
-	$(cleanup_silent) /bin/rm -rf $(javabin)/${CONSTITUENT}
-	$(cleanup_silent) /bin/rm -f $(javabin)/${CONSTITUENT}.jar
+	$(cleanup_silent) /bin/rm -rf $(javabin)${CONSTITUENT}
+	$(cleanup_silent) /bin/rm -f $(javabin)${CONSTITUENT}.jar
 
 #-- end of jar ------
Index: CMT/HEAD/mgr/fragments/jar_header
===================================================================
--- CMT/HEAD/mgr/fragments/jar_header	(revision 627)
+++ CMT/HEAD/mgr/fragments/jar_header	(revision 628)
@@ -2,8 +2,20 @@
 
 ${CONSTITUENT}javadirs ::
-	$(silent) if test ! -d $(javabin)/${CONSTITUENT} ; then $(mkdir) -p $(javabin)${CONSTITUENT} ; fi
+	$(silent) if test ! -d $(javabin)${CONSTITUENT} ; then $(mkdir) -p $(javabin)${CONSTITUENT} ; fi
 
 ${CONSTITUENT} :: ${CONSTITUENT}javadirs $(javabin)${CONSTITUENT}.jar
 	$(echo) "${CONSTITUENT} ok"
 
+cmt_${CONSTITUENT}_${HASPROTOTYPES} = 1
+
+#--------------------------------------
+
+ifdef cmt_${CONSTITUENT}_has_prototypes
+
+${CONSTITUENT}prototype : ${PROTOTARGET} ;
+
+endif
+
+${CONSTITUENT}compile : ${OBJS} ;
+
 #-- end of jar_header ------
Index: CMT/HEAD/mgr/fragments/java
===================================================================
--- CMT/HEAD/mgr/fragments/java	(revision 627)
+++ CMT/HEAD/mgr/fragments/java	(revision 628)
@@ -3,5 +3,6 @@
 ${OUTPUTNAME} : ${FULLNAME}
 	$(java_echo) $@
-	$(java_silent)cd $(src); $(javacomp) -d $(javabin)/${CONSTITUENT} $(use_javaflags) $(${CONSTITUENT}_javaflags) $(${NAME}_javaflags) ${FULLNAME}
+	$(java_silent) [ -d $(javabin)${CONSTITUENT} ] || $(mkdir) -p $(javabin)${CONSTITUENT}
+	$(java_silent)cd $(src); $(javacomp) -d $(javabin)${CONSTITUENT} $(use_javaflags) $(${CONSTITUENT}_javaflags) $(${NAME}_javaflags) ${FULLNAME}
 
 #-- end of java ------
Index: CMT/HEAD/mgr/fragments/java_header
===================================================================
--- CMT/HEAD/mgr/fragments/java_header	(revision 627)
+++ CMT/HEAD/mgr/fragments/java_header	(revision 628)
@@ -2,8 +2,20 @@
 
 ${CONSTITUENT}javadirs ::
-	$(silent) if test ! -d $(javabin)/${CONSTITUENT} ; then $(mkdir) -p $(javabin)${CONSTITUENT} ; fi
+	$(silent) if test ! -d $(javabin)${CONSTITUENT} ; then $(mkdir) -p $(javabin)${CONSTITUENT} ; fi
 
 ${CONSTITUENT} :: ${CONSTITUENT}javadirs $(javabin)${CONSTITUENT}.jar
 	$(echo) "${CONSTITUENT} ok"
+
+cmt_${CONSTITUENT}_${HASPROTOTYPES} = 1
+
+#--------------------------------------
+
+ifdef cmt_${CONSTITUENT}_has_prototypes
+
+${CONSTITUENT}prototype : ${PROTOTARGET} ;
+
+endif
+
+${CONSTITUENT}compile : ${OBJS} ;
 
 $(javabin)${CONSTITUENT}.jar :: ${OBJS}
@@ -16,7 +28,7 @@
 ${CONSTITUENT}installname = ${CONSTITUENT}.jar
 
-${CONSTITUENT} :: ${CONSTITUENT}install
+${CONSTITUENT} :: ${CONSTITUENT}install ;
 
-install :: ${CONSTITUENT}install
+install :: ${CONSTITUENT}install ;
 
 ${CONSTITUENT}install :: $(install_dir)/$(${CONSTITUENT}installname)
@@ -37,5 +49,5 @@
 ##${CONSTITUENT}clean :: ${CONSTITUENT}uninstall
 
-uninstall :: ${CONSTITUENT}uninstall
+uninstall :: ${CONSTITUENT}uninstall ;
 
 ${CONSTITUENT}uninstall ::
Index: CMT/HEAD/mgr/fragments/library
===================================================================
--- CMT/HEAD/mgr/fragments/library	(revision 627)
+++ CMT/HEAD/mgr/fragments/library	(revision 628)
@@ -30,4 +30,5 @@
 	$(lib_echo) "shared library $@"
 	$(lib_silent) if test "$(makecmd)"; then QUIET=; else QUIET=1; fi; QUIET=$${QUIET} bin="$(bin)" ld="$(shlibbuilder)" ldflags="$(shlibflags)" suffix=$(shlibsuffix) libprefix=$(library_prefix) libsuffix=$(library_suffix) $(make_shlib) "$(tags)" ${CONSTITUENT} $(${CONSTITUENT}_shlibflags)
+	$(lib_silent) cat /dev/null >$(${CONSTITUENT}shstamp)
 
 $(${CONSTITUENT}shstamp) :: $(${CONSTITUENT}libname).$(shlibsuffix)
Index: CMT/HEAD/mgr/fragments/library_header
===================================================================
--- CMT/HEAD/mgr/fragments/library_header	(revision 627)
+++ CMT/HEAD/mgr/fragments/library_header	(revision 628)
@@ -9,3 +9,15 @@
 	$(echo) "${CONSTITUENT} ok"
 
+cmt_${CONSTITUENT}_${HASPROTOTYPES} = 1
+
+#--------------------------------------
+
+ifdef cmt_${CONSTITUENT}_has_prototypes
+
+${CONSTITUENT}prototype : ${PROTOTARGET} ;
+
+endif
+
+${CONSTITUENT}compile : ${OBJS} ;
+
 #-- end of libary_header ----------------
Index: CMT/HEAD/mgr/fragments/library_no_static
===================================================================
--- CMT/HEAD/mgr/fragments/library_no_static	(revision 627)
+++ CMT/HEAD/mgr/fragments/library_no_static	(revision 628)
@@ -31,4 +31,6 @@
 	$(lib_echo) "shared library $@"
 	$(lib_silent) $(shlibbuilder) $(shlibflags) -o $@ ${OBJS} $(${CONSTITUENT}_shlibflags)
+	$(lib_silent) cat /dev/null >$(${CONSTITUENT}stamp) && \
+	  cat /dev/null >$(${CONSTITUENT}shstamp)
 
 $(${CONSTITUENT}shstamp) :: $(${CONSTITUENT}libname).$(shlibsuffix)
Index: CMT/HEAD/mgr/requirements
===================================================================
--- CMT/HEAD/mgr/requirements	(revision 627)
+++ CMT/HEAD/mgr/requirements	(revision 628)
@@ -586,4 +586,5 @@
 make_fragment constituent
 make_fragment constituent_lock
+make_fragment constituent_app_lib
 make_fragment constituents_trailer
 
Index: CMT/HEAD/source/cmt_generator.cxx
===================================================================
--- CMT/HEAD/source/cmt_generator.cxx	(revision 627)
+++ CMT/HEAD/source/cmt_generator.cxx	(revision 628)
@@ -86,4 +86,5 @@
   m_HASTARGETTAG.set ("HASTARGETTAG");
   m_HASDEPENDENCIES.set ("HASDEPENDENCIES");
+  m_HASPROTOTYPES.set ("HASPROTOTYPES");
   m_ISCHECKGROUP.set ("ISCHECKGROUP");
 }
@@ -126,4 +127,5 @@
   m_HASTARGETTAG = "";
   m_HASDEPENDENCIES = "";
+  m_HASPROTOTYPES = "";
   m_ISCHECKGROUP = "";
   m_PACKINCLUDES = "";
Index: CMT/HEAD/source/cmt_generator.h
===================================================================
--- CMT/HEAD/source/cmt_generator.h	(revision 627)
+++ CMT/HEAD/source/cmt_generator.h	(revision 628)
@@ -133,4 +133,5 @@
   Variable m_HASTARGETTAG;
   Variable m_HASDEPENDENCIES;
+  Variable m_HASPROTOTYPES;
   Variable m_ISCHECKGROUP;
 };
Index: CMT/HEAD/source/cmt_generators.cxx
===================================================================
--- CMT/HEAD/source/cmt_generators.cxx	(revision 627)
+++ CMT/HEAD/source/cmt_generators.cxx	(revision 628)
@@ -468,5 +468,5 @@
 			      const cmt_string& file_name)
 {
-  static cmt_string lib;
+  //static cmt_string lib;
   static cmt_string allsources;
   static cmt_string file;
@@ -499,11 +499,21 @@
   need_prototypes = constituent.need_prototypes;
 
+  if (constituent.need_prototypes)
+    {
+      m_HASPROTOTYPES = "has_prototypes";
+    }
+  else
+    {
+      m_HASPROTOTYPES = "has_no_prototypes";
+    }
+
   //  cout << m_TITLE << " " << m_CONSTITUENT << endl;
   CmtMessage::info (m_TITLE + " " + m_CONSTITUENT);
 
+  /*
   lib  = "$(";
   lib += m_CONSTITUENT;
   lib += "lib)";
-
+  */
   //
   // Prepare the include paths
@@ -639,15 +649,19 @@
       if (is_library)
         {
-          jar_header_fragment.copy (m_output_file, constituent.variables, 3, 
+          jar_header_fragment.copy (m_output_file, constituent.variables, 5,
 				    &m_CONSTITUENT, 
                                     &m_CONSTITUENTSUFFIX,
-                                    &m_OBJS);
+				    &m_OBJS,
+				    &m_PROTOTARGET,
+				    &m_HASPROTOTYPES);
         }
       else
         {
-          java_header_fragment.copy (m_output_file, constituent.variables, 3, 
+          java_header_fragment.copy (m_output_file, constituent.variables, 5,
 				     &m_CONSTITUENT,
                                      &m_CONSTITUENTSUFFIX,
-                                     &m_OBJS);
+				     &m_OBJS,
+				     &m_PROTOTARGET,
+				     &m_HASPROTOTYPES);
         }
     }
@@ -656,15 +670,19 @@
       if (is_library)
         {
-          library_header_fragment.copy (m_output_file, constituent.variables, 3,
+          library_header_fragment.copy (m_output_file, constituent.variables, 5,
                                         &m_CONSTITUENT,
                                         &m_CONSTITUENTSUFFIX,
-                                        &m_PROTOTARGET);
+					&m_OBJS,
+					&m_PROTOTARGET,
+					&m_HASPROTOTYPES);
         }
       else
         {
-          application_header_fragment.copy (m_output_file, constituent.variables, 3,
-                                            &m_CONSTITUENT, 
-                                            &m_CONSTITUENTSUFFIX, 
-					    &m_PROTOTARGET);
+          application_header_fragment.copy (m_output_file, constituent.variables, 5,
+                                            &m_CONSTITUENT,
+                                            &m_CONSTITUENTSUFFIX,
+					    &m_OBJS,
+					    &m_PROTOTARGET,
+					    &m_HASPROTOTYPES);
         }
     }
@@ -806,9 +824,9 @@
       if (need_dependencies)
 	{
-      dependencies_fragment.copy (m_output_file, 
-                                  constituent.variables, 3,
-                                  &m_CONSTITUENT, 
-                                  &m_CONSTITUENTSUFFIX, 
-                                  &m_LINE);
+	  dependencies_fragment.copy (m_output_file, 
+				      constituent.variables, 3,
+				      &m_CONSTITUENT, 
+				      &m_CONSTITUENTSUFFIX, 
+				      &m_LINE);
 	}
     }
@@ -2601,4 +2619,5 @@
   constituent_fragment.set ("constituent");
   constituent_lock_fragment.set ("constituent_lock");
+  constituent_app_lib_fragment.set ("constituent_app_lib");
   check_application_header_fragment.set ("check_application_header");
 }
@@ -2612,4 +2631,5 @@
   constituent_fragment.reset ();
   constituent_lock_fragment.reset ();
+  constituent_app_lib_fragment.reset ();
   check_application_header_fragment.reset ();
 }
@@ -2738,8 +2758,7 @@
 	    {
 	    case Application:
-	      m_HASDEPENDENCIES = "has_dependencies";
-	      break;
 	    case Library:
 	      m_HASDEPENDENCIES = "has_dependencies";
+	      m_HASPROTOTYPES = constituent.need_prototypes ? "has_prototypes" : "has_no_prototypes" ;
 	      break;
 	    case Document:
@@ -2758,4 +2777,17 @@
 					      &m_HASDEPENDENCIES,
 					      &m_HASTARGETTAG);
+	    }
+	  else if (constituent.type == Application ||
+		   constituent.type == Library)
+	    {
+	      constituent_app_lib_fragment.copy (m_output_file, constituent.variables,
+						 7,
+						 &m_PACKAGE,
+						 &m_CONSTITUENT, 
+						 &m_CONSTITUENTSUFFIX,
+						 &m_LINE,
+						 &m_HASDEPENDENCIES,
+						 &m_HASTARGETTAG,
+						 &m_HASPROTOTYPES);
 	    }
 	  else
Index: CMT/HEAD/source/cmt_generators.h
===================================================================
--- CMT/HEAD/source/cmt_generators.h	(revision 627)
+++ CMT/HEAD/source/cmt_generators.h	(revision 628)
@@ -220,4 +220,5 @@
   FragmentHandle constituent_fragment;
   FragmentHandle constituent_lock_fragment;
+  FragmentHandle constituent_app_lib_fragment;
   FragmentHandle check_application_header_fragment;
 };
Index: CMT/HEAD/source/cmt_parser.cxx
===================================================================
--- CMT/HEAD/source/cmt_parser.cxx	(revision 627)
+++ CMT/HEAD/source/cmt_parser.cxx	(revision 628)
@@ -9620,4 +9620,67 @@
 	SyntaxParser::parse_requirements_line (temp, current_use);
       }
+
+    for (int i = 0; i < constituents.size (); i++)
+      {
+	const Constituent& constituent = constituents[i];
+	if (constituent.type == Document) continue;
+	const cmt_string macro_name = constituent.name + "compile_dependencies";
+	if (!Symbol::is_selected (macro_name))
+	  {
+	    temp = "macro_append ";
+	    temp += macro_name;
+	    temp += " \"";
+
+	    const Symbol* deps_macro = Symbol::find (constituent.name + "_dependencies");
+	    if (deps_macro != 0)
+	      {
+		const cmt_string deps_value (deps_macro->resolve_macro_value ());
+		CmtSystem::cmt_string_vector words;
+		CmtSystem::split (deps_value, " \t", words);
+		for (int i = 0; i < words.size (); i++)
+		  {
+		    const cmt_string& word = words[i];
+		    const Constituent* dep = Constituent::find (word);
+		    if (dep == 0)
+		      {
+			if (CmtMessage::active (Verbose))
+			  CmtMessage::warning
+			    (CmtError::get_error_name (CmtError::configuration_error)
+			     + ": " + word + ": non-constituent name in macro "
+			     + constituent.name + "_dependencies value");
+			continue;
+		      }
+		    switch (dep->type)
+		      {
+		      case Application:
+		      case Library:
+			if (dep->need_prototypes)
+			  temp += " " + word + "prototype";
+			break;
+		      case Document:
+			temp += " " + word;
+			break;
+		      }
+		  }
+	      }
+
+	    temp += "\"";
+	    
+	    SyntaxParser::parse_requirements_line (temp, current_use);
+	  }
+	if (constituent.need_prototypes)
+	  {
+	    const cmt_string macro_name = constituent.name + "prototype_dependencies";
+	    if (!Symbol::is_selected (macro_name))
+	      {
+		temp = "macro_append ";
+		temp += macro_name;
+		temp += " \" $(";
+		temp += constituent.name + "compile_dependencies)\"";
+	    
+		SyntaxParser::parse_requirements_line (temp, current_use);
+	      }
+	  }
+      }
   }
 
