Index: file.c
===================================================================
RCS file: /sources/make/make/file.c,v
retrieving revision 1.89
diff -p -u -r1.89 file.c
--- file.c	14 Jul 2007 02:57:46 -0000	1.89
+++ file.c	19 Aug 2007 22:43:06 -0000
@@ -702,7 +702,11 @@ snap_deps (void)
 
   f = lookup_file (".EXPORT_ALL_VARIABLES");
   if (f != 0 && f->is_target)
-    export_all_variables = 1;
+    export_all_variables = x_export;
+
+  f = lookup_file (".EXPORT_ALL_VARIABLES_VERBATIM");
+  if (f != 0 && f->is_target)
+    export_all_variables = x_verbatim;
 
   f = lookup_file (".IGNORE");
   if (f != 0 && f->is_target)
Index: read.c
===================================================================
RCS file: /sources/make/make/read.c,v
retrieving revision 1.167
diff -p -u -r1.167 read.c
--- read.c	4 Jul 2007 19:35:19 -0000	1.167
+++ read.c	19 Aug 2007 22:43:06 -0000
@@ -686,18 +686,19 @@ eval (struct ebuffer *ebuf, int set_defa
 	   can appear in the middle of a rule.  */
 	continue;
 
-      if (word1eq ("export"))
+      if (word1eq ("export") || word1eq ("verbatim"))
 	{
+          char verbatim = word1eq ("verbatim");
           /* 'export' by itself causes everything to be exported. */
 	  if (*p2 == '\0')
-            export_all_variables = 1;
+            export_all_variables = verbatim ? x_verbatim : x_export;
           else
             {
               struct variable *v;
 
               v = try_variable_definition (fstart, p2, o_file, 0);
               if (v != 0)
-                v->export = v_export;
+                v->export = verbatim ? v_verbatim : v_export;
               else
                 {
                   unsigned int l;
@@ -714,7 +715,7 @@ eval (struct ebuffer *ebuf, int set_defa
                       v = lookup_variable (p, l);
                       if (v == 0)
                         v = define_variable_loc (p, l, "", o_file, 0, fstart);
-                      v->export = v_export;
+                      v->export = verbatim ? v_verbatim : v_export;
                     }
 
                   free (ap);
@@ -726,7 +727,7 @@ eval (struct ebuffer *ebuf, int set_defa
       if (word1eq ("unexport"))
 	{
 	  if (*p2 == '\0')
-	    export_all_variables = 0;
+	    export_all_variables = x_noexport;
           else
             {
               unsigned int l;
Index: variable.c
===================================================================
RCS file: /sources/make/make/variable.c,v
retrieving revision 1.92
diff -p -u -r1.92 variable.c
--- variable.c	4 Jul 2007 19:35:20 -0000	1.92
+++ variable.c	19 Aug 2007 22:43:07 -0000
@@ -842,7 +842,7 @@ define_automatic_variables (void)
   define_variable ("+F", 2, "$(notdir $+)", o_automatic, 1);
 }
 
-int export_all_variables;
+enum export_all export_all_variables;
 
 /* Create a new environment for FILE's commands.
    If FILE is nil, this is for the `shell' function.
@@ -905,12 +905,13 @@ target_environment (struct file *file)
                 if (! v->exportable)
                   continue;
 
-		if (! export_all_variables
+		if (export_all_variables == x_noexport
 		    && v->origin != o_command
 		    && v->origin != o_env && v->origin != o_env_override)
 		  continue;
 		break;
 
+	      case v_verbatim:
 	      case v_export:
 		break;
 
@@ -956,7 +957,9 @@ target_environment (struct file *file)
 	if (v->recursive
 	    && v->origin != o_env && v->origin != o_env_override)
 	  {
-	    char *value = recursively_expand_for_file (v, file);
+            char do_verbatim = (v->export == v_verbatim)
+              || ((v->export != v_export) && (export_all_variables == x_verbatim));
+	    char *value = do_verbatim ? xstrdup (v->value) : recursively_expand_for_file (v, file);
 #ifdef WINDOWS32
 	    if (strcmp(v->name, "Path") == 0 ||
 		strcmp(v->name, "PATH") == 0)
Index: variable.h
===================================================================
RCS file: /sources/make/make/variable.h,v
retrieving revision 1.37
diff -p -u -r1.37 variable.h
--- variable.h	4 Jul 2007 19:35:20 -0000	1.37
+++ variable.h	19 Aug 2007 22:43:07 -0000
@@ -41,6 +41,13 @@ enum variable_flavor
     f_conditional       /* Conditional definition (?=) */
   };
 
+enum export_all
+  {
+    x_noexport,         /* Don't export this variable.  */
+    x_verbatim,         /* Export this variable without expanding it.  */
+    x_export            /* Export this variable.  */
+  };
+ 
 /* Structure that represents one variable definition.
    Each bucket of the hash table is a chain of these,
    chained through `next'.  */
@@ -72,11 +79,12 @@ struct variable
       origin ENUM_BITFIELD (3);	/* Variable origin.  */
     enum variable_export
       {
+	v_verbatim,		/* Export this variable without expanding it.  */
 	v_export,		/* Export this variable.  */
 	v_noexport,		/* Don't export this variable.  */
 	v_ifset,		/* Export it if it has a non-default value.  */
 	v_default		/* Decide in target_environment.  */
-      } export ENUM_BITFIELD (2);
+      } export ENUM_BITFIELD (3);
   };
 
 /* Structure that represents a variable set.  */
@@ -204,7 +212,7 @@ char **target_environment (struct file *
 struct pattern_var *create_pattern_var (const char *target,
                                         const char *suffix);
 
-extern int export_all_variables;
+extern enum export_all export_all_variables;
 
 #define MAKELEVEL_NAME "MAKELEVEL"
 #define MAKELEVEL_LENGTH (sizeof (MAKELEVEL_NAME) - 1)
Index: doc/make.texi
===================================================================
RCS file: /sources/make/make/doc/make.texi,v
retrieving revision 1.50
diff -p -u -r1.50 make.texi
--- doc/make.texi	15 Aug 2007 13:53:54 -0000	1.50
+++ doc/make.texi	19 Aug 2007 22:43:08 -0000
@@ -3022,6 +3022,18 @@ export all variables to child processes 
 @xref{Variables/Recursion, ,Communicating Variables to a
 Sub-@code{make}}.
 
+@findex .EXPORT_ALL_VARIABLES_VERBATIM
+@item .EXPORT_ALL_VARIABLES_VERBATIM
+
+Simply by being mentioned as a target, this tells @code{make} to
+export all variables to child processes by default.  This differs
+from the @code{.EXPORT_ALL_VARIABLES} target in the same way that the
+@code{verbatim} directive differs from the @code{export} directive;
+the values of the variables are not subjected to expansion during
+export to the sub-@code{make} child process.
+@xref{Variables/Recursion, ,Communicating Variables to a
+Sub-@code{make}}.
+
 @findex .NOTPARALLEL
 @item .NOTPARALLEL
 @cindex parallel execution, overriding
@@ -4372,6 +4384,23 @@ In both of these forms, the arguments to
 @code{unexport} are expanded, and so could be variables or functions
 which expand to a (list of) variable names to be (un)exported.
 
+@findex verbatim
+When variables are exported to a sub-@code{make}, they are normally 
+subject to a round of expansion before they are exported.  This can
+require tricky quoting and makes it almost impossible to usefully export
+any kind of complex function to a sub-@code{make}.  If you want to
+export a variable without expanding it, so that the sub-@code{make}
+receives it with exactly the same value, use the @code{verbatim} directive,
+like this:
+
+@example
+verbatim @var{variable} @dots{}
+@end example
+
+@noindent
+Apart from preventing expansion of the exported values, @code{verbatim}
+is a synonym for @code{export} in all other ways.
+
 As a convenience, you can define a variable and export it at the same
 time by doing:
 
@@ -4417,21 +4446,36 @@ export @var{variable}
 @end example
 
 @noindent
+and all these forms may also be used with @code{verbatim}:
+
+@example
+verbatim @var{variable} = value
+verbatim @var{variable} := value
+verbatim @var{variable} += value
+@end example
+
+@noindent
 @xref{Appending, ,Appending More Text to Variables}.
 
 You may notice that the @code{export} and @code{unexport} directives
 work in @code{make} in the same way they work in the shell, @code{sh}.
 
 If you want all variables to be exported by default, you can use
-@code{export} by itself:
+@code{export} (or @code{verbatim}) by itself:
 
 @example
 export
+verbatim
 @end example
 
 @noindent
 This tells @code{make} that variables which are not explicitly mentioned
-in an @code{export} or @code{unexport} directive should be exported.
+in an @code{export} or @code{unexport} directive should be exported; either
+after their values have been expanded, if @code{export} is used, or without
+expansion if @code{verbatim} is used.  The default setting chosen by this
+directive can be overridden on a per-variable basis by using the alternate
+directive with a list of the variable names that should be exported using
+the alternative method.
 Any variable given in an @code{unexport} directive will still @emph{not}
 be exported.  If you use @code{export} by itself to export variables by
 default, variables whose names contain characters other than
@@ -4439,13 +4483,17 @@ alphanumerics and underscores will not b
 mentioned in an @code{export} directive.@refill
 
 @findex .EXPORT_ALL_VARIABLES
+@findex .EXPORT_ALL_VARIABLES_VERBATIM
 The behavior elicited by an @code{export} directive by itself was the
 default in older versions of GNU @code{make}.  If your makefiles depend
 on this behavior and you want to be compatible with old versions of
 @code{make}, you can write a rule for the special target
 @code{.EXPORT_ALL_VARIABLES} instead of using the @code{export} directive.
 This will be ignored by old @code{make}s, while the @code{export}
-directive will cause a syntax error.@refill
+directive will cause a syntax error.  Note that while @code{make} also
+implements @code{.EXPORT_ALL_VARIABLES_VERBATIM} for completeness, its
+behaviour does not correspond to anything that an older version of 
+@code{make} would have done.@refill
 @cindex compatibility in exporting
 
 Likewise, you can use @code{unexport} by itself to tell @code{make}
@@ -5810,6 +5858,12 @@ or like this:
 @var{target} @dots{} : export @var{variable-assignment}
 @end example
 
+or like this:
+
+@example
+@var{target} @dots{} : verbatim @var{variable-assignment}
+@end example
+
 Multiple @var{target} values create a target-specific variable value for
 each member of the target list individually.
 
@@ -10377,8 +10431,10 @@ the command line.@*
 @xref{Override Directive, ,The @code{override} Directive}.
 
 @item export
+@itemx verbatim
 
-Tell @code{make} to export all variables to child processes by default.@*
+Tell @code{make} to export all variables to child processes by default,
+either after expanding, or verbatim as they are defined in the parent.@*
 @xref{Variables/Recursion, , Communicating Variables to a Sub-@code{make}}.
 
 @item export @var{variable}
@@ -10386,9 +10442,14 @@ Tell @code{make} to export all variables
 @itemx export @var{variable} := @var{value}
 @itemx export @var{variable} += @var{value}
 @itemx export @var{variable} ?= @var{value}
+@itemx verbatim @var{variable}
+@itemx verbatim @var{variable} = @var{value}
+@itemx verbatim @var{variable} := @var{value}
+@itemx verbatim @var{variable} += @var{value}
+@itemx verbatim @var{variable} ?= @var{value}
 @itemx unexport @var{variable}
 Tell @code{make} whether or not to export a particular variable to child
-processes.@*
+processes, and whether to expand it or to export it verbatim.@*
 @xref{Variables/Recursion, , Communicating Variables to a Sub-@code{make}}.
 
 @item vpath @var{pattern} @var{path}
