bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Command line variables and the environment


From: John David Anglin
Subject: Re: Command line variables and the environment
Date: Tue, 16 Jan 2001 16:25:56 -0500 (EST)

> Here are the possible solutions that I see:
> 
> 1)    Change the default behaviour so that command line variables are
>       not exported by default.  If I want a variable exported to the
>       environment, there are a variety of ways to do this before the
>       sub-make is executed.

Here is a patch along the line suggested above.  The old behaviour
is still available it the special target .EXPORT_COMMAND_VARIABLES
is defined in the Makefile.  What do you think?

Dave
-- 
J. David Anglin                                  address@hidden
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-01-16  John David Anglin  <address@hidden>

        * file.c (snap_deps): Add special target .EXPORT_COMMAND_VARIABLES.
        * variable.c (export_command_variables): New variable.
        (target_environment): Don't export command line variables unless
        export_command_variables is true.
        * variable.h (export_command_variables): Prototype.

--- file.c.orig Tue Jun 20 10:00:16 2000
+++ file.c      Tue Jan 16 15:18:19 2001
@@ -509,6 +509,10 @@
   if (f != 0 && f->is_target)
     export_all_variables = 1;
 
+  f = lookup_file (".EXPORT_COMMAND_VARIABLES");
+  if (f != 0 && f->is_target)
+    export_command_variables = 1;
+
   f = lookup_file (".IGNORE");
   if (f != 0 && f->is_target)
     {
--- variable.c.orig     Fri May 19 12:36:08 2000
+++ variable.c  Tue Jan 16 15:42:51 2001
@@ -573,7 +573,7 @@
   define_variable ("+F", 2, "$(notdir $+)", o_automatic, 1);
 }
 
-int export_all_variables;
+int export_all_variables, export_command_variables;
 
 /* Create a new environment for FILE's commands.
    If FILE is nil, this is for the `shell' function.
@@ -668,6 +668,10 @@
                      && v->origin != o_env && v->origin != o_env_override)
                    continue;
 
+                 if (! export_all_variables && ! export_command_variables
+                     && v->origin == o_command)
+                   continue;
+
                  if (*p != '_' && (*p < 'A' || *p > 'Z')
                      && (*p < 'a' || *p > 'z'))
                    continue;
--- variable.h.orig     Thu Feb 24 13:59:14 2000
+++ variable.h  Tue Jan 16 15:11:47 2001
@@ -135,3 +135,5 @@
 extern char **target_environment PARAMS ((struct file *file));
 
 extern int export_all_variables;
+
+extern int export_command_variables;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]