summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-05-12 14:47:22 +0000
committerharti <harti@FreeBSD.org>2005-05-12 14:47:22 +0000
commit8b9c642e878e784c620b9103f85818a891c786fe (patch)
tree8b25d39d4f10ff7995405187470bf9d7c064da27
parentdfdc1e0f672d6108333eb0feb0440d6386fa092b (diff)
downloadFreeBSD-src-8b9c642e878e784c620b9103f85818a891c786fe.zip
FreeBSD-src-8b9c642e878e784c620b9103f85818a891c786fe.tar.gz
Replace a lot of Var_Set(..., VAR_GLOBAL) by Var_SetGlobal().
Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.237)
-rw-r--r--usr.bin/make/main.c36
-rw-r--r--usr.bin/make/var.c11
-rw-r--r--usr.bin/make/var.h1
3 files changed, 30 insertions, 18 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 741c2f3..59dd8c8 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -253,7 +253,7 @@ ReadMakefile(const char p[])
if (!strcmp(fname, "-")) {
Parse_File("(stdin)", stdin);
- Var_Set("MAKEFILE", "", VAR_GLOBAL);
+ Var_SetGlobal("MAKEFILE", "");
} else {
setMAKEFILE = strcmp(fname, ".depend");
@@ -314,7 +314,7 @@ ReadMakefile(const char p[])
*/
found:
if (setMAKEFILE)
- Var_Set("MAKEFILE", MAKEFILE, VAR_GLOBAL);
+ Var_SetGlobal("MAKEFILE", MAKEFILE);
Parse_File(fname, stream);
fclose(stream);
}
@@ -360,7 +360,7 @@ rearg:
err(1, "chdir %s", optarg);
break;
case 'D':
- Var_Set(optarg, "1", VAR_GLOBAL);
+ Var_SetGlobal(optarg, "1");
MFLAGS_append("-D", optarg);
break;
case 'I':
@@ -791,14 +791,14 @@ main(int argc, char **argv)
* .MAKEFLAGS gets set to the empty string just in case.
* MFLAGS also gets initialized empty, for compatibility.
*/
- Var_Set("MAKE", argv[0], VAR_GLOBAL);
- Var_Set(MAKEFLAGS, "", VAR_GLOBAL);
- Var_Set("MFLAGS", "", VAR_GLOBAL);
- Var_Set("MACHINE", machine, VAR_GLOBAL);
- Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL);
- Var_Set("MACHINE_CPU", machine_cpu, VAR_GLOBAL);
+ Var_SetGlobal("MAKE", argv[0]);
+ Var_SetGlobal(MAKEFLAGS, "");
+ Var_SetGlobal("MFLAGS", "");
+ Var_SetGlobal("MACHINE", machine);
+ Var_SetGlobal("MACHINE_ARCH", machine_arch);
+ Var_SetGlobal("MACHINE_CPU", machine_cpu);
#ifdef MAKE_VERSION
- Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL);
+ Var_SetGlobal("MAKE_VERSION", MAKE_VERSION);
#endif
/*
@@ -845,8 +845,7 @@ main(int argc, char **argv)
if (!(path = getenv("MAKEOBJDIR"))) {
path = PATH_OBJDIR;
pathp = PATH_OBJDIRPREFIX;
- snprintf(mdpath, MAXPATHLEN, "%s.%s",
- path, machine);
+ snprintf(mdpath, MAXPATHLEN, "%s.%s", path, machine);
if (!(objdir = chdir_verify_path(mdpath, obpath)))
if (!(objdir=chdir_verify_path(path, obpath))) {
snprintf(mdpath, MAXPATHLEN,
@@ -867,9 +866,9 @@ 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);
+ Var_SetGlobal(".ST_EXPORTVAR", "YES");
+ Var_SetGlobal(".CURDIR", curdir);
+ Var_SetGlobal(".OBJDIR", objdir);
if (getenv("MAKE_JOBS_FIFO") != NULL)
forceJobs = TRUE;
@@ -895,7 +894,9 @@ main(int argc, char **argv)
* created. If none specified, make the variable empty -- the parser
* will fill the thing in with the default or .MAIN target.
*/
- if (!Lst_IsEmpty(&create)) {
+ if (Lst_IsEmpty(&create)) {
+ Var_SetGlobal(".TARGETS", "");
+ } else {
LstNode *ln;
for (ln = Lst_First(&create); ln != NULL; ln = Lst_Succ(ln)) {
@@ -903,8 +904,7 @@ main(int argc, char **argv)
Var_Append(".TARGETS", name, VAR_GLOBAL);
}
- } else
- Var_Set(".TARGETS", "", VAR_GLOBAL);
+ }
/*
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index a70acae..077ddbf 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1033,6 +1033,17 @@ Var_Set(const char *name, const char *val, GNode *ctxt)
}
/**
+ * Set the a global name variable to the value.
+ */
+void
+Var_SetGlobal(const char name[], const char value[])
+{
+
+ Var_Set(name, value, VAR_GLOBAL);
+}
+
+
+/**
* Set the VAR_TO_ENV flag on a variable
*/
void
diff --git a/usr.bin/make/var.h b/usr.bin/make/var.h
index d4f1b4e..bd65ce6 100644
--- a/usr.bin/make/var.h
+++ b/usr.bin/make/var.h
@@ -76,6 +76,7 @@ size_t Var_Match(const char [], struct GNode *);
char *Var_Parse(const char *, struct GNode *, Boolean, size_t *, Boolean *);
void Var_Print(struct Lst *, Boolean);
void Var_Set(const char *, const char *, struct GNode *);
+void Var_SetGlobal(const char *, const char *);
void Var_SetEnv(const char *, struct GNode *);
struct Buffer *Var_Subst(const char *, struct GNode *, Boolean);
struct Buffer *Var_SubstOnly(const char *, const char *, Boolean);
OpenPOWER on IntegriCloud