diff options
author | Hartmut Brandt <harti@FreeBSD.org> | 2005-05-06 18:30:06 +0000 |
---|---|---|
committer | Hartmut Brandt <harti@FreeBSD.org> | 2005-05-06 18:30:06 +0000 |
commit | 352a63dee820383bc2bcd02e0c7badcadca443b7 (patch) | |
tree | 63e1aad932422a7e009bf4546d317d2a3db92daf /usr.bin/make/main.c | |
parent | fc1e80d469d9f6c2d2a3172ed645743b435b1573 (diff) | |
download | src-352a63dee820383bc2bcd02e0c7badcadca443b7.tar.gz src-352a63dee820383bc2bcd02e0c7badcadca443b7.zip |
Introduce a new pseudo-target .EXPORTVAR which allows to put a
make macro into the environment of programs executed by make. This
has approximately the same function as gmake's export directive.
The form of a pseudo target was deliberately choosen to minimize work
for POSIX compatibility (Makefiles are not allowed to use any targets
starting with a dot and consisting only of uppercase letters except those
specified in the standard when they want POSIX compatible behaviour, so
such a Makefile can never contain .EXPORTVAR.)
Change the handling of macros coming from the environment: instead
of asking the environment for each variable we could not find otherwise
put all the environment variables in a special variable environment just
at start up.
This has been tested on the ports cluster by kris.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
Notes
Notes:
svn path=/head/; revision=145971
Diffstat (limited to 'usr.bin/make/main.c')
-rw-r--r-- | usr.bin/make/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 8bb88973ba1a..2b8fd8a992d9 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -101,6 +101,8 @@ __FBSDID("$FreeBSD$"); #define MAKEFLAGS ".MAKEFLAGS" +extern char **environ; /* XXX what header declares this variable? */ + /* Targets to be made */ Lst create = Lst_Initializer(create); @@ -695,7 +697,7 @@ main(int argc, char **argv) */ Dir_Init(); /* Initialize directory structures so -I flags * can be processed correctly */ - Var_Init(); /* As well as the lists of variables for + Var_Init(environ); /* As well as the lists of variables for * parsing arguments */ str_init(); @@ -781,6 +783,7 @@ main(int argc, char **argv) Dir_InitDot(); /* Initialize the "." directory */ if (objdir != curdir) Path_AddDir(&dirSearchPath, curdir); + Var_Set(".ST_EXPORTVAR", "YES", VAR_GLOBAL); Var_Set(".CURDIR", curdir, VAR_GLOBAL); Var_Set(".OBJDIR", objdir, VAR_GLOBAL); |