Add .export-env which tells make to export a variable to the environment
but not to track it - as is done for .export This allows the variable to be updated without affecting what was put into the environment. Older versions of make will simply treat this as .export
This commit is contained in:
parent
90abead58e
commit
fbb620d711
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.172 2010/05/13 18:10:16 joerg Exp $
|
||||
.\" $NetBSD: make.1,v 1.173 2010/06/06 01:13:12 sjg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -791,8 +791,10 @@ is set in the environment or on the command line.)
|
||||
.Pp
|
||||
Variable expansion is performed on the value before it's used,
|
||||
so expressions such as
|
||||
.Dl ${.CURDIR:C,^/usr/src,/var/obj,}
|
||||
.Dl ${.CURDIR:S,^/usr/src,/var/obj,}
|
||||
may be used.
|
||||
This is especially useful with
|
||||
.Ql Ev MAKEOBJDIR .
|
||||
.Pp
|
||||
.Ql Va .OBJDIR
|
||||
may be modified in the makefile as a global variable.
|
||||
@ -1320,6 +1322,15 @@ flag, so should be used with caution.
|
||||
Appending a variable name to
|
||||
.Va .MAKE.EXPORTED
|
||||
is equivalent to exporting a variable.
|
||||
.It Ic .export-env Ar variable ...
|
||||
The same as
|
||||
.Ql .export ,
|
||||
except that the variable is not appended to
|
||||
.Va .MAKE.EXPORTED .
|
||||
This allows exporting a value to the environment which is different from that
|
||||
used by
|
||||
.Nm
|
||||
internally.
|
||||
.It Ic .info Ar message
|
||||
The message is printed along with the name of the makefile and line number.
|
||||
.It Ic .undef Ar variable
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.158 2010/04/21 04:25:27 sjg Exp $ */
|
||||
/* $NetBSD: var.c,v 1.159 2010/06/06 01:13:12 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.158 2010/04/21 04:25:27 sjg Exp $";
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.159 2010/06/06 01:13:12 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: var.c,v 1.158 2010/04/21 04:25:27 sjg Exp $");
|
||||
__RCSID("$NetBSD: var.c,v 1.159 2010/06/06 01:13:12 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -682,6 +682,7 @@ Var_Export(char *str, int isExport)
|
||||
char *val;
|
||||
char **av;
|
||||
char *as;
|
||||
int track;
|
||||
int ac;
|
||||
int i;
|
||||
|
||||
@ -690,6 +691,12 @@ Var_Export(char *str, int isExport)
|
||||
return;
|
||||
}
|
||||
|
||||
if (strncmp(str, "-env", 4) == 0) {
|
||||
track = 0;
|
||||
str += 4;
|
||||
} else {
|
||||
track = VAR_EXPORT_PARENT;
|
||||
}
|
||||
val = Var_Subst(NULL, str, VAR_GLOBAL, 0);
|
||||
av = brk_string(val, &ac, FALSE, &as);
|
||||
for (i = 0; i < ac; i++) {
|
||||
@ -709,10 +716,10 @@ Var_Export(char *str, int isExport)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (Var_Export1(name, VAR_EXPORT_PARENT)) {
|
||||
if (Var_Export1(name, track)) {
|
||||
if (VAR_EXPORTED_ALL != var_exportedVars)
|
||||
var_exportedVars = VAR_EXPORTED_YES;
|
||||
if (isExport) {
|
||||
if (isExport && track) {
|
||||
Var_Append(MAKE_EXPORTED, name, VAR_GLOBAL);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user