Index: /CMT/v1r25-branch/ChangeLog
===================================================================
--- /CMT/v1r25-branch/ChangeLog	(revision 636)
+++ /CMT/v1r25-branch/ChangeLog	(revision 637)
@@ -1,2 +1,49 @@
+2013-01-03    <rybkin@lal.in2p3.fr> 498
+
+	* source/cmt_constituent.cxx: In class constituents_action_iterator,
+	set constituent attribute need_check to true, if specified, for applications
+	only
+	* source/cmt_generator.h: In class CmtGenerator, introduce member
+	m_ISCHECKGROUP
+	* source/cmt_generator.cxx: idem
+	* source/cmt_generators.cxx: In class ConstituentsMakefileGenerator
+	function build, depending on whether constituent belongs to check group,
+	set m_ISCHECKGROUP appropriately and fill check_application_header
+	makefiles fragments with value
+	* mgr/fragments/check_application_header: For applications belonging to
+	check group, ensure that application is built before running check
+	* mgr/fragments/nmake/check_application_header: idem
+	* mgr/fragments/check_application: In application Makefile, remove
+	check target dependency on application, handled in constituents Makefile,
+	improve control of Make verbosity
+	* mgr/fragments/check_java: idem
+	* mgr/fragments/nmake/check_application: idem
+	* mgr/fragments/nmake/check_java: idem
+	
+2012-11-23    <rybkin@lal.in2p3.fr> 497
+
+	* source/cmt_generators.cxx: In class DocumentGenerator function build,
+	add template LINE for fragments document's header, trailer, add template
+	OUTPUTNAME for fragments dependency, document's fragment
+	
+2012-11-07    <rybkin@lal.in2p3.fr> 496
+
+	* source/cmt_symbol.cxx: Introduce helper function process_cmd_output to
+	process command output similar to `shell' function of GNU Make. Make use of
+	this function in functions resolve_value, resolve_value_for_macros,
+	suppress_OS_delimiters in order to allow for possibly multi-line output of
+	commands in command substitution (introduced with backquotes)
+	
+2012-09-21    <rybkin@lal.in2p3.fr> 495
+
+	* source/cmt_std.h: Replace macro linux with __linux__, latter being
+	predefined by gcc with or without -ansi option
+	
+2012-08-04    <rybkin@lal.in2p3.fr> 494
+
+	* source/cmt_parser.cxx: In class StandardMacroBuilder, in function
+	fill_for_all_constituents, parse includes acquired via include_dirs
+	statement for all imported uses (were otherwise left unparsed)
+	
 2012-05-15    <rybkin@lal.in2p3.fr> 493
 
@@ -106,7 +153,7 @@
 	parse comment lines
 	* source/cmt_string.h: In class cmt_string, introduce constructor from
-	character array with
+	character array with n elements
 	* source/cmt_string.cxx: In class cmt_string, implement constructor from
-	character array with
+	character array with n elements
 	* source/cmt_parser.cxx: In class Cmt function vector_to_string, make sure
 	separator is not prepended at beginning
Index: /CMT/v1r25-branch/mgr/fragments/check_application
===================================================================
--- /CMT/v1r25-branch/mgr/fragments/check_application	(revision 636)
+++ /CMT/v1r25-branch/mgr/fragments/check_application	(revision 637)
@@ -3,8 +3,9 @@
 check :: ${CONSTITUENT}check ;
 
-${CONSTITUENT}check :: ${CONSTITUENT}
-	$(${CONSTITUENT}_pre_check)
-	$(bin)${CONSTITUENT}${application_suffix} $(${CONSTITUENT}_check_args)
-	$(${CONSTITUENT}_post_check)
+#${CONSTITUENT}check :: ${CONSTITUENT}
+${CONSTITUENT}check ::
+	$(silent) $(${CONSTITUENT}_pre_check)
+	$(silent) $(bin)${CONSTITUENT}${application_suffix} $(${CONSTITUENT}_check_args)
+	$(silent) $(${CONSTITUENT}_post_check)
 
 #-- end of check_application ------
Index: /CMT/v1r25-branch/mgr/fragments/check_application_header
===================================================================
--- /CMT/v1r25-branch/mgr/fragments/check_application_header	(revision 636)
+++ /CMT/v1r25-branch/mgr/fragments/check_application_header	(revision 637)
@@ -1,3 +1,7 @@
 #-- start of check_application_header ------
+
+cmt_${CONSTITUENT}_${ISCHECKGROUP} = 1
+
+#--------------------------------------
 
 check :: ${CONSTITUENT}check
@@ -7,5 +11,9 @@
 #${CONSTITUENT}check : ${CONSTITUENT} $(cmt_local_${CONSTITUENT}_makefile)
 #${CONSTITUENT}check : $(cmt_local_${CONSTITUENT}_makefile)
+ifdef cmt_${CONSTITUENT}_is_check_group
+${CONSTITUENT}check : ${CONSTITUENT}
+else
 ${CONSTITUENT}check :
+endif
 	@if test ! -f $(cmt_local_${CONSTITUENT}_makefile); then \
 	  $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}; \
Index: /CMT/v1r25-branch/mgr/fragments/check_java
===================================================================
--- /CMT/v1r25-branch/mgr/fragments/check_java	(revision 636)
+++ /CMT/v1r25-branch/mgr/fragments/check_java	(revision 637)
@@ -1,9 +1,11 @@
 #-- start of check_java ------
 
-check :: ${CONSTITUENT}check
+check :: ${CONSTITUENT}check ;
 
-${CONSTITUENT}check :: ${CONSTITUENT}
-	cd $(bin); $(${CONSTITUENT}_pre_check)
-	cd $(bin); java $(java_run_options) $(${CONSTITUENT}_run_options) ${CONSTITUENT} $(${CONSTITUENT}_check_args)
-	cd $(bin); $(${CONSTITUENT}_post_check)
+#${CONSTITUENT}check :: ${CONSTITUENT}
+${CONSTITUENT}check ::
+	$(silent) cd $(bin); $(${CONSTITUENT}_pre_check)
+	$(silent) cd $(bin); java $(java_run_options) $(${CONSTITUENT}_run_options) ${CONSTITUENT} $(${CONSTITUENT}_check_args)
+	$(silent) cd $(bin); $(${CONSTITUENT}_post_check)
+
 #-- end of check_java ------
Index: /CMT/v1r25-branch/mgr/fragments/nmake/check_application
===================================================================
--- /CMT/v1r25-branch/mgr/fragments/nmake/check_application	(revision 636)
+++ /CMT/v1r25-branch/mgr/fragments/nmake/check_application	(revision 637)
@@ -1,7 +1,11 @@
+#-- start of check_application ------
 
-check :: ${CONSTITUENT}check
+check :: ${CONSTITUENT}check ;
 
-${CONSTITUENT}check :: ${CONSTITUENT}
-	$(${CONSTITUENT}_pre_check)
-	$(bin)${CONSTITUENT}$(application_suffix) $(${CONSTITUENT}_check_args)
-	$(${CONSTITUENT}_post_check)
+#${CONSTITUENT}check :: ${CONSTITUENT}
+${CONSTITUENT}check ::
+	$(silent) $(${CONSTITUENT}_pre_check)
+	$(silent) $(bin)${CONSTITUENT}$(application_suffix) $(${CONSTITUENT}_check_args)
+	$(silent) $(${CONSTITUENT}_post_check)
+
+#-- end of check_application ------
Index: /CMT/v1r25-branch/mgr/fragments/nmake/check_application_header
===================================================================
--- /CMT/v1r25-branch/mgr/fragments/nmake/check_application_header	(revision 636)
+++ /CMT/v1r25-branch/mgr/fragments/nmake/check_application_header	(revision 637)
@@ -1,3 +1,7 @@
 #-- start of check_application_header ------
+
+cmt_${CONSTITUENT}_${ISCHECKGROUP} = 1
+
+#--------------------------------------
 
 check :: ${CONSTITUENT}check
@@ -7,5 +11,9 @@
 #${CONSTITUENT}check : ${CONSTITUENT} $(cmt_local_${CONSTITUENT}_makefile)
 #${CONSTITUENT}check : $(cmt_local_${CONSTITUENT}_makefile)
+!if defined (cmt_${CONSTITUENT}_is_check_group)
+${CONSTITUENT}check : ${CONSTITUENT}
+!else
 ${CONSTITUENT}check :
+!endif
 	@if not exist $(cmt_local_${CONSTITUENT}_makefile) $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build -nmake constituent_makefile -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
 	$(echo) "(constituents.nmake) Starting $@"
Index: /CMT/v1r25-branch/mgr/fragments/nmake/check_java
===================================================================
--- /CMT/v1r25-branch/mgr/fragments/nmake/check_java	(revision 636)
+++ /CMT/v1r25-branch/mgr/fragments/nmake/check_java	(revision 637)
@@ -1,7 +1,11 @@
+#-- start of check_java ------
 
-check :: ${CONSTITUENT}check
+check :: ${CONSTITUENT}check ;
 
-${CONSTITUENT}check :: ${CONSTITUENT}
-	$(${CONSTITUENT}_pre_check)
-	java ${CONSTITUENT} $(${CONSTITUENT}_check_args)
-	$(${CONSTITUENT}_post_check)
+#${CONSTITUENT}check :: ${CONSTITUENT}
+${CONSTITUENT}check ::
+	$(silent) $(${CONSTITUENT}_pre_check)
+	$(silent) java ${CONSTITUENT} $(${CONSTITUENT}_check_args)
+	$(silent) $(${CONSTITUENT}_post_check)
+
+#-- end of check_java ------
Index: /CMT/v1r25-branch/source/cmt_constituent.cxx
===================================================================
--- /CMT/v1r25-branch/source/cmt_constituent.cxx	(revision 636)
+++ /CMT/v1r25-branch/source/cmt_constituent.cxx	(revision 637)
@@ -176,5 +176,8 @@
     else if (w == "-check")
       {
-        m_constituent.need_check = true;
+        if (m_constituent.type == Application)
+          {
+	    m_constituent.need_check = true;
+          }
       }
     else if (w == "-triggers")
Index: /CMT/v1r25-branch/source/cmt_generator.cxx
===================================================================
--- /CMT/v1r25-branch/source/cmt_generator.cxx	(revision 636)
+++ /CMT/v1r25-branch/source/cmt_generator.cxx	(revision 637)
@@ -86,4 +86,5 @@
   m_HASTARGETTAG.set ("HASTARGETTAG");
   m_HASDEPENDENCIES.set ("HASDEPENDENCIES");
+  m_ISCHECKGROUP.set ("ISCHECKGROUP");
 }
 
@@ -125,4 +126,5 @@
   m_HASTARGETTAG = "";
   m_HASDEPENDENCIES = "";
+  m_ISCHECKGROUP = "";
   m_PACKINCLUDES = "";
   m_PACKOS9      = false;
Index: /CMT/v1r25-branch/source/cmt_generator.h
===================================================================
--- /CMT/v1r25-branch/source/cmt_generator.h	(revision 636)
+++ /CMT/v1r25-branch/source/cmt_generator.h	(revision 637)
@@ -133,4 +133,5 @@
   Variable m_HASTARGETTAG;
   Variable m_HASDEPENDENCIES;
+  Variable m_ISCHECKGROUP;
 };
 
Index: /CMT/v1r25-branch/source/cmt_generators.cxx
===================================================================
--- /CMT/v1r25-branch/source/cmt_generators.cxx	(revision 636)
+++ /CMT/v1r25-branch/source/cmt_generators.cxx	(revision 637)
@@ -1114,8 +1114,9 @@
     {
       FragmentHandle header_fragment (header);
-      header_fragment.copy (m_output_file, constituent.variables, 3, 
+      header_fragment.copy (m_output_file, constituent.variables, 4, 
 			    &m_CONSTITUENT,
                             &m_CONSTITUENTSUFFIX,
-                            &m_OBJS);
+                            &m_OBJS,
+			    &m_LINE);
     }
   else
@@ -1183,4 +1184,5 @@
       SourceFile& file = m_source_files[i];
       const cmt_string& file_name = file.name ();
+      m_OUTPUTNAME = file.output ();
       m_FULLNAME = file_name;
       CmtSystem::get_dot_suffix (file_name, suffix);
@@ -1193,5 +1195,5 @@
       m_FILESUFFIX.value = suffix;
       //CmtSystem::get_dot_suffix (m_FILENAME.value, m_FILESUFFIX.value);
-      CmtSystem::get_suffix (m_FILENAME.value, m_FILEEXTENSION .value);
+      CmtSystem::get_suffix (m_FILENAME.value, m_FILEEXTENSION.value);
       /*
       if (!CmtSystem::test_file (file_name) && !CmtSystem::test_directory (file_name))
@@ -1206,7 +1208,8 @@
 	  // ensure that ${CONSTITUENT}_dependencies.make gets rebuilt
 	  // whenever source file OR its dependencies change
-	  if (!dependency_fragment.copy (m_output_file, constituent.variables, 9,
+	  if (!dependency_fragment.copy (m_output_file, constituent.variables, 10,
 					 &m_FILEPATH,
 					 &m_SUFFIX,
+					 &m_OUTPUTNAME,
 					 &m_CONSTITUENT,
 					 &m_CONSTITUENTSUFFIX,
@@ -1218,7 +1221,8 @@
 	}
       
-      fragment.copy (m_output_file, constituent.variables, 9,
+      fragment.copy (m_output_file, constituent.variables, 10,
                      &m_FILEPATH,
                      &m_SUFFIX,
+		     &m_OUTPUTNAME,
                      &m_CONSTITUENT,
                      &m_CONSTITUENTSUFFIX,
@@ -1234,8 +1238,9 @@
     {
       FragmentHandle trailer_fragment (trailer);
-      trailer_fragment.copy (m_output_file, constituent.variables, 3, 
+      trailer_fragment.copy (m_output_file, constituent.variables, 4, 
 			     &m_CONSTITUENT,
                              &m_CONSTITUENTSUFFIX,
-                             &m_OBJS);
+			     &m_OBJS,
+			     &m_LINE);
     }
 
@@ -2768,9 +2773,16 @@
           if (constituent.need_check)
             {
+	      if (constituent.group != 0 && 
+		  constituent.group->name () == "check")
+		m_ISCHECKGROUP = "is_check_group";
+	      else
+		m_ISCHECKGROUP = "is_not_check_group";
+
               check_application_header_fragment.copy (m_output_file, 
-						      constituent.variables, 3,
+						      constituent.variables, 4,
 						      &m_PACKAGE,
 						      &m_CONSTITUENT,
-                                                      &m_CONSTITUENTSUFFIX);
+                                                      &m_CONSTITUENTSUFFIX,
+						      &m_ISCHECKGROUP);
             }
         }
Index: /CMT/v1r25-branch/source/cmt_parser.cxx
===================================================================
--- /CMT/v1r25-branch/source/cmt_parser.cxx	(revision 636)
+++ /CMT/v1r25-branch/source/cmt_parser.cxx	(revision 637)
@@ -9399,4 +9399,6 @@
 	    Use* u = imports[i];
 	    
+	    Include::parse_all (u);
+
 	    u->fill_includes_macro (buffer);
 	    u->fill_macro (buffer, "cflags");
Index: /CMT/v1r25-branch/source/cmt_std.h
===================================================================
--- /CMT/v1r25-branch/source/cmt_std.h	(revision 636)
+++ /CMT/v1r25-branch/source/cmt_std.h	(revision 637)
@@ -10,5 +10,5 @@
 
 #ifndef WIN32
-#ifndef linux
+#ifndef __linux__
 #ifndef __CYGWIN__
 #ifndef __APPLE__
Index: /CMT/v1r25-branch/source/cmt_symbol.cxx
===================================================================
--- /CMT/v1r25-branch/source/cmt_symbol.cxx	(revision 636)
+++ /CMT/v1r25-branch/source/cmt_symbol.cxx	(revision 637)
@@ -223,4 +223,28 @@
 #endif
 }
+/**
+ * similar to processing
+ * `shell' function of GNU Make does
+ *  on command output
+ */
+static void process_cmd_output (cmt_string& text)
+{
+  //cerr << "process_cmd_output (begin): [" << text << "]" << endl;
+  // remove trailing (carriage-return and) newline(s)
+  int nl = text.size ();
+  while (nl > 0 && text[nl - 1] == '\n')
+    {
+      nl--;
+      if (nl > 0 && text[nl - 1] == '\r')
+	nl--;
+    }
+  if (nl != text.size ())
+    text.erase (nl);
+
+  // convert each newline (or carriage-return / newline pair) to a single space
+  text.replace_all ("\r\n", " ");
+  text.replace_all ("\n", " ");
+  //cerr << "process_cmd_output (end): [" << text << "]" << endl;
+}
 
 /**
@@ -318,4 +342,5 @@
           CmtSystem::execute (command, result);
           
+	  /*
           int pos;
           pos = result.find ('\n');
@@ -323,8 +348,10 @@
           pos = result.find ('\r');
           if (pos != cmt_string::npos) result.erase (pos);
-          
+	  */          
+	  process_cmd_output (result);
+
           if (Cmt::get_debug ())
             {
-              cout << "   Executing [" << command << "] to expand a symbol value =>[" 
+              cout << "resolve_value: Executing [" << command << "] to expand a symbol value =>[" 
                    << result << "]" << endl;
             }
@@ -462,4 +489,5 @@
           CmtSystem::execute (command, result);
           
+	  /*
           int pos;
           pos = result.find ('\n');
@@ -467,4 +495,6 @@
           pos = result.find ('\r');
           if (pos != cmt_string::npos) result.erase (pos);
+	  */
+	  process_cmd_output (result);
           
           if (Cmt::get_debug ())
@@ -596,4 +626,5 @@
           CmtSystem::execute (command, result);
           
+	  /*
           int pos;
           pos = result.find ('\n');
@@ -601,4 +632,6 @@
           pos = result.find ('\r');
           if (pos != cmt_string::npos) result.erase (pos);
+	  */          
+	  process_cmd_output (result);
           
           if (Cmt::get_debug ())
