Index: trunk/src/kmk/Makefile.am
===================================================================
--- trunk/src/kmk/Makefile.am	(revision 1914)
+++ trunk/src/kmk/Makefile.am	(revision 1915)
@@ -135,5 +135,5 @@
 	-DCONFIG_WITH_WHICH \
 	-DCONFIG_WITH_EVALPLUS \
-	-DCONFIG_WITH_MAKE_STATS \
+	-DCONFIG_WITH_MINIMAL_STATS \
 	-DCONFIG_WITH_COMMANDS_FUNC \
 	-DCONFIG_PRETTY_COMMAND_PRINTING \
Index: trunk/src/kmk/Makefile.kmk
===================================================================
--- trunk/src/kmk/Makefile.kmk	(revision 1914)
+++ trunk/src/kmk/Makefile.kmk	(revision 1915)
@@ -165,5 +165,5 @@
 	CONFIG_WITH_WHICH \
 	CONFIG_WITH_EVALPLUS \
-	CONFIG_WITH_MAKE_STATS \
+	CONFIG_WITH_MINIMAL_STATS \
 	CONFIG_WITH_COMMANDS_FUNC \
 	CONFIG_PRETTY_COMMAND_PRINTING \
Index: trunk/src/kmk/dir.c
===================================================================
--- trunk/src/kmk/dir.c	(revision 1914)
+++ trunk/src/kmk/dir.c	(revision 1915)
@@ -47,4 +47,8 @@
 #endif
 /* bird: end */
+
+#ifdef CONFIG_WITH_STRCACHE2
+# include <stddef.h>
+#endif
 
 /* In GNU systems, <dirent.h> defines this macro for us.  */
Index: trunk/src/kmk/file.c
===================================================================
--- trunk/src/kmk/file.c	(revision 1914)
+++ trunk/src/kmk/file.c	(revision 1915)
@@ -28,4 +28,7 @@
 #include "debug.h"
 #include "hash.h"
+#ifdef CONFIG_WITH_STRCACHE2
+# include <stddef.h>
+#endif
 
 
Index: trunk/src/kmk/function.c
===================================================================
--- trunk/src/kmk/function.c	(revision 1914)
+++ trunk/src/kmk/function.c	(revision 1915)
@@ -3724,5 +3724,5 @@
 #endif  /* CONFIG_WITH_OS2_LIBPATH */
 
-#ifdef CONFIG_WITH_MAKE_STATS
+#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
 /* Retrieve make statistics. */
 static char *
@@ -3734,4 +3734,5 @@
   if (!argv[0] || (!argv[0][0] && !argv[1]))
     {
+# ifdef CONFIG_WITH_MAKE_STATS
       len = sprintf (buf, "alloc-cur: %5ld %6luKB (/%3luMB)  hash: %5lu %2lu%%",
                      make_stats_allocations,
@@ -3741,4 +3742,5 @@
                      (make_stats_ht_collisions * 100) / make_stats_ht_lookups);
       o = variable_buffer_output (o, buf, len);
+#endif
     }
   else
@@ -3751,5 +3753,8 @@
           if (i != 0)
             o = variable_buffer_output (o, " ", 1);
-          if (!strcmp(argv[i], "allocations"))
+          if (0)
+              continue;
+# ifdef CONFIG_WITH_MAKE_STATS
+          else if (!strcmp(argv[i], "allocations"))
             val = make_stats_allocations;
           else if (!strcmp(argv[i], "allocated"))
@@ -3763,4 +3768,5 @@
           else if (!strcmp(argv[i], "ht_collisions_pct"))
             val = (make_stats_ht_collisions * 100) / make_stats_ht_lookups;
+#endif
           else
             {
@@ -3773,4 +3779,5 @@
         }
     }
+
   return o;
 }
Index: trunk/src/kmk/hash.c
===================================================================
--- trunk/src/kmk/hash.c	(revision 1914)
+++ trunk/src/kmk/hash.c	(revision 1915)
@@ -137,8 +137,6 @@
 #endif
 
-  ht->ht_lookups++;
-#ifdef CONFIG_WITH_MAKE_STATS
-  make_stats_ht_lookups++;
-#endif
+  MAKE_STATS (ht->ht_lookups++);
+  MAKE_STATS_3 (make_stats_ht_lookups++);
   for (;;)
     {
@@ -159,8 +157,6 @@
 	  if ((*ht->ht_compare) (key, *slot) == 0)
 	    return slot;
-	  ht->ht_collisions++;
-#ifdef CONFIG_WITH_MAKE_STATS
-	  make_stats_ht_collisions++;
-#endif
+	  MAKE_STATS (ht->ht_collisions++);
+	  MAKE_STATS_3 (make_stats_ht_collisions++);
 	}
       if (!hash_2)
@@ -186,8 +182,6 @@
 #endif
 
-  ht->ht_lookups++;
-#ifdef CONFIG_WITH_MAKE_STATS
-  make_stats_ht_lookups++;
-#endif
+  MAKE_STATS (ht->ht_lookups++);
+  MAKE_STATS_3 (make_stats_ht_lookups++);
 
   /* first iteration unrolled. */
@@ -203,8 +197,6 @@
         return slot;
 
-      ht->ht_collisions++;
-#ifdef CONFIG_WITH_MAKE_STATS
-      make_stats_ht_collisions++;
-#endif
+      MAKE_STATS (ht->ht_collisions++);
+      MAKE_STATS_3 (make_stats_ht_collisions++);
     }
   else
@@ -233,8 +225,6 @@
 	    return slot;
 
-	  ht->ht_collisions++;
-#ifdef CONFIG_WITH_MAKE_STATS
-	  make_stats_ht_collisions++;
-#endif
+	  MAKE_STATS (ht->ht_collisions++);
+	  MAKE_STATS_3 (make_stats_ht_collisions++);
 	}
 
Index: trunk/src/kmk/main.c
===================================================================
--- trunk/src/kmk/main.c	(revision 1914)
+++ trunk/src/kmk/main.c	(revision 1915)
@@ -329,5 +329,5 @@
 #endif /* KMK */
 
-#ifdef CONFIG_WITH_MAKE_STATS
+#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
 /* When set, we'll gather expensive statistics like for the heap. */
 
@@ -489,5 +489,5 @@
     { 'S', flag_off, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag,
       "no-keep-going" },
-#ifdef KMK
+#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
     { CHAR_MAX+14, flag, (char *) &make_expensive_statistics, 1, 1, 1, 0, 0,
        "statistics" },
@@ -829,5 +829,6 @@
   errno = 0;
   if (nice (nice_level) == -1 && errno != 0)
-    fprintf (stderr, "warning: nice (%d) failed: %s\n", nice, strerror (errno));
+    fprintf (stderr, "warning: nice (%d) failed: %s\n",
+             nice_level, strerror (errno));
 #endif
 }
@@ -1840,8 +1841,8 @@
     {
       struct stat st;
-      if ((   stat ("Makefile.kup", &st) == 0
-           && S_ISREG (st.st_mode) )
-       || (   stat ("makefile.kup", &st) == 0
-           && S_ISREG (st.st_mode) )
+      if ((   (   stat ("Makefile.kup", &st) == 0
+               && S_ISREG (st.st_mode) )
+           || (   stat ("makefile.kup", &st) == 0
+               && S_ISREG (st.st_mode) ) )
        && stat ("Makefile.kmk", &st) < 0
        && stat ("makefile.kmk", &st) < 0)
@@ -3531,6 +3532,8 @@
     define_variable ("KMK_OPTS_AFFINITY", sizeof("KMK_OPTS_AFFINITY") - 1,
                      val, o_default, 1);
+#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
     define_variable ("KMK_OPTS_STATISTICS", sizeof("KMK_OPTS_STATISTICS") - 1,
                      make_expensive_statistics ? "1" : "0", o_default, 1);
+# endif
   }
 #endif
@@ -3604,5 +3607,5 @@
   if (!remote_description || *remote_description == '\0')
     printf (_("\n%sThis program is built for %s/%s/%s [" __DATE__ " " __TIME__ "]\n"),
-            precede, KBUILD_HOST, KBUILD_HOST_ARCH, KBUILD_HOST_CPU, remote_description);
+            precede, KBUILD_HOST, KBUILD_HOST_ARCH, KBUILD_HOST_CPU);
   else
     printf (_("\n%sThis program is built for %s/%s/%s (%s) [" __DATE__ " " __TIME__ "]\n"),
Index: trunk/src/kmk/make.h
===================================================================
--- trunk/src/kmk/make.h	(revision 1914)
+++ trunk/src/kmk/make.h	(revision 1915)
@@ -660,5 +660,5 @@
 extern int pretty_command_printing;
 #endif
-#ifdef CONFIG_WITH_MAKE_STATS
+#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
 extern int make_expensive_statistics;
 #endif
@@ -880,4 +880,11 @@
 # endif
 
+# define MAKE_STATS_3(expr) do { expr; } while (0)
+# define MAKE_STATS_2(expr) do { expr; } while (0)
+# define MAKE_STATS(expr)   do { expr; } while (0)
+#else
+# define MAKE_STATS_3(expr) do { } while (0)
+# define MAKE_STATS_2(expr) do { } while (0)
+# define MAKE_STATS(expr)   do { } while (0)
 #endif
 
Index: trunk/src/kmk/strcache2.c
===================================================================
--- trunk/src/kmk/strcache2.c	(revision 1914)
+++ trunk/src/kmk/strcache2.c	(revision 1915)
@@ -686,5 +686,5 @@
   assert (!cache->case_insensitive);
 
-  cache->lookup_count++;
+  MAKE_STATS (cache->lookup_count++);
 
   /* Lookup the entry in the hash table, hoping for an
@@ -696,5 +696,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_1st_count++;
+  MAKE_STATS (cache->collision_1st_count++);
 
   entry = entry->next;
@@ -703,5 +703,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_2nd_count++;
+  MAKE_STATS (cache->collision_2nd_count++);
 
   /* Loop the rest.  */
@@ -713,5 +713,5 @@
       if (strcache2_is_equal (cache, entry, str, length, hash))
         return (const char *)(entry + 1);
-      cache->collision_3rd_count++;
+      MAKE_STATS (cache->collision_3rd_count++);
     }
   /* not reached */
@@ -734,5 +734,5 @@
 #endif /* NDEBUG */
 
-  cache->lookup_count++;
+  MAKE_STATS (cache->lookup_count++);
 
   /* Lookup the entry in the hash table, hoping for an
@@ -744,5 +744,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_1st_count++;
+  MAKE_STATS (cache->collision_1st_count++);
 
   entry = entry->next;
@@ -751,5 +751,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_2nd_count++;
+  MAKE_STATS (cache->collision_2nd_count++);
 
   /* Loop the rest.  */
@@ -761,5 +761,5 @@
       if (strcache2_is_equal (cache, entry, str, length, hash))
         return (const char *)(entry + 1);
-      cache->collision_3rd_count++;
+      MAKE_STATS (cache->collision_3rd_count++);
     }
   /* not reached */
@@ -776,5 +776,5 @@
   assert (!cache->case_insensitive);
 
-  cache->lookup_count++;
+  MAKE_STATS (cache->lookup_count++);
 
   /* Lookup the entry in the hash table, hoping for an
@@ -786,5 +786,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_1st_count++;
+  MAKE_STATS (cache->collision_1st_count++);
 
   entry = entry->next;
@@ -793,5 +793,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_2nd_count++;
+  MAKE_STATS (cache->collision_2nd_count++);
 
   /* Loop the rest. */
@@ -803,5 +803,5 @@
       if (strcache2_is_equal (cache, entry, str, length, hash))
         return (const char *)(entry + 1);
-      cache->collision_3rd_count++;
+      MAKE_STATS (cache->collision_3rd_count++);
     }
   /* not reached */
@@ -820,5 +820,5 @@
   assert (!cache->case_insensitive);
 
-  cache->lookup_count++;
+  MAKE_STATS (cache->lookup_count++);
 
   /* Lookup the entry in the hash table, hoping for an
@@ -830,5 +830,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_1st_count++;
+  MAKE_STATS (cache->collision_1st_count++);
 
   entry = entry->next;
@@ -837,5 +837,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_2nd_count++;
+  MAKE_STATS (cache->collision_2nd_count++);
 
   /* Loop the rest. */
@@ -847,5 +847,5 @@
       if (strcache2_is_equal (cache, entry, str, length, hash))
         return (const char *)(entry + 1);
-      cache->collision_3rd_count++;
+      MAKE_STATS (cache->collision_3rd_count++);
     }
   /* not reached */
@@ -868,5 +868,5 @@
 #endif /* NDEBUG */
 
-  cache->lookup_count++;
+  MAKE_STATS (cache->lookup_count++);
 
   /* Lookup the entry in the hash table, hoping for an
@@ -878,5 +878,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_1st_count++;
+  MAKE_STATS (cache->collision_1st_count++);
 
   entry = entry->next;
@@ -885,5 +885,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_2nd_count++;
+  MAKE_STATS (cache->collision_2nd_count++);
 
   /* Loop the rest. */
@@ -895,5 +895,5 @@
       if (strcache2_is_equal (cache, entry, str, length, hash))
         return (const char *)(entry + 1);
-      cache->collision_3rd_count++;
+      MAKE_STATS (cache->collision_3rd_count++);
     }
   /* not reached */
@@ -910,5 +910,5 @@
   assert (!cache->case_insensitive);
 
-  cache->lookup_count++;
+  MAKE_STATS (cache->lookup_count++);
 
   /* Lookup the entry in the hash table, hoping for an
@@ -920,5 +920,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_1st_count++;
+  MAKE_STATS (cache->collision_1st_count++);
 
   entry = entry->next;
@@ -927,5 +927,5 @@
   if (strcache2_is_equal (cache, entry, str, length, hash))
     return (const char *)(entry + 1);
-  cache->collision_2nd_count++;
+  MAKE_STATS (cache->collision_2nd_count++);
 
   /* Loop the rest. */
@@ -937,5 +937,5 @@
       if (strcache2_is_equal (cache, entry, str, length, hash))
         return (const char *)(entry + 1);
-      cache->collision_3rd_count++;
+      MAKE_STATS (cache->collision_3rd_count++);
     }
   /* not reached */
Index: trunk/src/kmk/variable.c
===================================================================
--- trunk/src/kmk/variable.c	(revision 1914)
+++ trunk/src/kmk/variable.c	(revision 1915)
@@ -33,4 +33,7 @@
 #ifdef KMK
 # include "kbuild.h"
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+# include <stddef.h>
 #endif
 
@@ -229,5 +232,8 @@
     }
   else
-    assert (!v || (v->name == name && !HASH_VACANT (v)));
+    {
+      assert (!v || (v->name == name && !HASH_VACANT (v)));
+      var_slot = 0;
+    }
 #endif /* CONFIG_WITH_STRCACHE2 */
   if (! HASH_VACANT (v))
@@ -466,4 +472,5 @@
   hash_1 = strcache2_calc_ptr_hash (&variable_strcache, name);
   ht = &setlist->set->table;
+  MAKE_STATS (ht->ht_lookups++);
   idx = hash_1 & (ht->ht_size - 1);
   v = ht->ht_vec[idx];
@@ -481,5 +488,5 @@
           idx &= (ht->ht_size - 1);
           v = (struct variable *) ht->ht_vec[idx];
-          ht->ht_collisions++; /* there are hardly any deletions, so don't bother with not counting deleted clashes. */
+          MAKE_STATS (ht->ht_collisions++); /* there are hardly any deletions, so don't bother with not counting deleted clashes. */
 
           if (v == 0)
@@ -510,4 +517,5 @@
       /* first iteration unrolled */
       ht = &setlist->set->table;
+      MAKE_STATS (ht->ht_lookups++);
       idx = hash_1 & (ht->ht_size - 1);
       v = ht->ht_vec[idx];
@@ -524,5 +532,5 @@
               idx &= (ht->ht_size - 1);
               v = (struct variable *) ht->ht_vec[idx];
-              ht->ht_collisions++; /* see reason above */
+              MAKE_STATS (ht->ht_collisions++); /* see reason above */
 
               if (v == 0)
@@ -1158,5 +1166,5 @@
   && defined (CONFIG_WITH_WHICH) \
   && defined (CONFIG_WITH_EVALPLUS) \
-  && defined (CONFIG_WITH_MAKE_STATS) \
+  && (defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)) \
   && defined (CONFIG_WITH_COMMANDS_FUNC) \
   && defined (KMK_HELPERS)
@@ -1234,5 +1242,5 @@
   strcat (buf, " evalctx evalval evalvalctx evalcall evalcall2");
 #  endif
-#  if defined (CONFIG_WITH_MAKE_STATS)
+#  if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
   strcat (buf, " make-stats");
 #  endif
