aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/make/parse.c
diff options
context:
space:
mode:
authorHartmut Brandt <harti@FreeBSD.org>2005-05-06 18:30:06 +0000
committerHartmut Brandt <harti@FreeBSD.org>2005-05-06 18:30:06 +0000
commit352a63dee820383bc2bcd02e0c7badcadca443b7 (patch)
tree63e1aad932422a7e009bf4546d317d2a3db92daf /usr.bin/make/parse.c
parentfc1e80d469d9f6c2d2a3172ed645743b435b1573 (diff)
downloadsrc-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/parse.c')
-rw-r--r--usr.bin/make/parse.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 56f9e249ffcd..fb48a77e73e5 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -153,13 +153,13 @@ typedef enum {
Begin, /* .BEGIN */
Default, /* .DEFAULT */
End, /* .END */
+ ExportVar, /* .EXPORTVAR */
Ignore, /* .IGNORE */
Includes, /* .INCLUDES */
Interrupt, /* .INTERRUPT */
Libs, /* .LIBS */
MFlags, /* .MFLAGS or .MAKEFLAGS */
Main, /* .MAIN and we don't have anyth. user-spec. to make */
- NoExport, /* .NOEXPORT */
Not, /* Not special */
NotParallel, /* .NOTPARALELL */
Null, /* .NULL */
@@ -204,6 +204,7 @@ static const struct keyword {
{ ".DEFAULT", Default, 0 },
{ ".END", End, 0 },
{ ".EXEC", Attribute, OP_EXEC },
+ { ".EXPORTVAR", ExportVar, 0 },
{ ".IGNORE", Ignore, OP_IGNORE },
{ ".INCLUDES", Includes, 0 },
{ ".INTERRUPT", Interrupt, 0 },
@@ -1170,6 +1171,9 @@ ParseDoDependency(char *line)
}
Lst_Destroy(&paths, NOFREE);
+ } else if (specType == ExportVar) {
+ Var_SetEnv(line, VAR_GLOBAL);
+
} else {
/* list of sources in order */
Lst curSrcs = Lst_Initializer(curSrc);