summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/parse.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-05-06 18:30:06 +0000
committerharti <harti@FreeBSD.org>2005-05-06 18:30:06 +0000
commit9e2faf2a2d1d132b64803f711bdc86494a945dea (patch)
tree63e1aad932422a7e009bf4546d317d2a3db92daf /usr.bin/make/parse.c
parent491568ac84a241eb8ffe4266ddf975db8e546faa (diff)
downloadFreeBSD-src-9e2faf2a2d1d132b64803f711bdc86494a945dea.zip
FreeBSD-src-9e2faf2a2d1d132b64803f711bdc86494a945dea.tar.gz
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>
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 56f9e24..fb48a77 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);
OpenPOWER on IntegriCloud