Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make: replace Global_SetExpand with Global_Set ...
details: https://anonhg.NetBSD.org/src/rev/a04549d80dbe
branches: trunk
changeset: 959169:a04549d80dbe
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Feb 03 08:08:18 2021 +0000
description:
make: replace Global_SetExpand with Global_Set for constant names
diffstat:
usr.bin/make/job.c | 6 ++--
usr.bin/make/main.c | 52 +++++++++++++++++++++++++-------------------------
usr.bin/make/meta.c | 12 +++++-----
usr.bin/make/nonints.h | 3 +-
usr.bin/make/parse.c | 6 ++--
usr.bin/make/suff.c | 8 +++---
usr.bin/make/var.c | 17 +++++++++++++--
7 files changed, 58 insertions(+), 46 deletions(-)
diffs (truncated from 338 to 300 lines):
diff -r b99d4eb321e0 -r a04549d80dbe usr.bin/make/job.c
--- a/usr.bin/make/job.c Wed Feb 03 08:00:36 2021 +0000
+++ b/usr.bin/make/job.c Wed Feb 03 08:08:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.413 2021/02/03 08:00:36 rillig Exp $ */
+/* $NetBSD: job.c,v 1.414 2021/02/03 08:08:18 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.413 2021/02/03 08:00:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.414 2021/02/03 08:08:18 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -2177,7 +2177,7 @@
if (targPrefix != NULL) {
free(targPrefix);
} else if (!Var_Exists(MAKE_JOB_PREFIX, VAR_GLOBAL)) {
- Global_SetExpand(MAKE_JOB_PREFIX, "---");
+ Global_Set(MAKE_JOB_PREFIX, "---");
}
(void)Var_Subst("${" MAKE_JOB_PREFIX "}",
diff -r b99d4eb321e0 -r a04549d80dbe usr.bin/make/main.c
--- a/usr.bin/make/main.c Wed Feb 03 08:00:36 2021 +0000
+++ b/usr.bin/make/main.c Wed Feb 03 08:08:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.527 2021/02/03 08:00:36 rillig Exp $ */
+/* $NetBSD: main.c,v 1.528 2021/02/03 08:08:18 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.527 2021/02/03 08:00:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.528 2021/02/03 08:08:18 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -429,7 +429,7 @@
}
Global_AppendExpand(MAKEFLAGS, "-j");
Global_AppendExpand(MAKEFLAGS, argvalue);
- Global_SetExpand(".MAKE.JOBS", argvalue);
+ Global_Set(".MAKE.JOBS", argvalue);
maxJobTokens = opts.maxJobs;
}
@@ -459,7 +459,7 @@
case 'B':
opts.compatMake = TRUE;
Global_AppendExpand(MAKEFLAGS, "-B");
- Global_SetExpand(MAKE_MODE, "compat");
+ Global_Set(MAKE_MODE, "compat");
break;
case 'C':
MainParseArgChdir(argvalue);
@@ -737,7 +737,7 @@
progname, path, strerror(errno));
} else {
snprintf(objdir, sizeof objdir, "%s", path);
- Global_SetExpand(".OBJDIR", objdir);
+ Global_Set(".OBJDIR", objdir);
setenv("PWD", objdir, 1);
Dir_InitDot();
purge_relative_cached_realpaths();
@@ -957,7 +957,7 @@
StringListNode *ln;
if (Lst_IsEmpty(&opts.create)) {
- Global_SetExpand(".TARGETS", "");
+ Global_Set(".TARGETS", "");
return;
}
@@ -1159,8 +1159,8 @@
make = abspath;
}
- Global_SetExpand("MAKE", make);
- Global_SetExpand(".MAKE", make);
+ Global_Set("MAKE", make);
+ Global_Set(".MAKE", make);
}
/*
@@ -1383,21 +1383,21 @@
*/
Targ_Init();
Var_Init();
- Global_SetExpand(".MAKE.OS", utsname.sysname);
- Global_SetExpand("MACHINE", machine);
- Global_SetExpand("MACHINE_ARCH", machine_arch);
+ Global_Set(".MAKE.OS", utsname.sysname);
+ Global_Set("MACHINE", machine);
+ Global_Set("MACHINE_ARCH", machine_arch);
#ifdef MAKE_VERSION
- Global_SetExpand("MAKE_VERSION", MAKE_VERSION);
+ Global_Set("MAKE_VERSION", MAKE_VERSION);
#endif
- Global_SetExpand(".newline", "\n"); /* handy for :@ loops */
+ Global_Set(".newline", "\n"); /* handy for :@ loops */
/*
* This is the traditional preference for makefiles.
*/
#ifndef MAKEFILE_PREFERENCE_LIST
# define MAKEFILE_PREFERENCE_LIST "makefile Makefile"
#endif
- Global_SetExpand(MAKE_MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST);
- Global_SetExpand(MAKE_DEPENDFILE, ".depend");
+ Global_Set(MAKE_MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST);
+ Global_Set(MAKE_DEPENDFILE, ".depend");
CmdOpts_Init();
allPrecious = FALSE; /* Remove targets when interrupted */
@@ -1421,10 +1421,10 @@
*/
Parse_Init();
InitVarMake(argv[0]);
- Global_SetExpand(MAKEFLAGS, "");
- Global_SetExpand(MAKEOVERRIDES, "");
- Global_SetExpand("MFLAGS", "");
- Global_SetExpand(".ALLTARGETS", "");
+ Global_Set(MAKEFLAGS, "");
+ Global_Set(MAKEOVERRIDES, "");
+ Global_Set("MFLAGS", "");
+ Global_Set(".ALLTARGETS", "");
/* some makefiles need to know this */
Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMDLINE);
@@ -1436,15 +1436,15 @@
if (makelevel < 0)
makelevel = 0;
snprintf(tmp, sizeof tmp, "%d", makelevel);
- Global_SetExpand(MAKE_LEVEL, tmp);
+ Global_Set(MAKE_LEVEL, tmp);
snprintf(tmp, sizeof tmp, "%u", myPid);
- Global_SetExpand(".MAKE.PID", tmp);
+ Global_Set(".MAKE.PID", tmp);
snprintf(tmp, sizeof tmp, "%u", getppid());
- Global_SetExpand(".MAKE.PPID", tmp);
+ Global_Set(".MAKE.PPID", tmp);
snprintf(tmp, sizeof tmp, "%u", getuid());
- Global_SetExpand(".MAKE.UID", tmp);
+ Global_Set(".MAKE.UID", tmp);
snprintf(tmp, sizeof tmp, "%u", getgid());
- Global_SetExpand(".MAKE.GID", tmp);
+ Global_Set(".MAKE.GID", tmp);
}
if (makelevel > 0) {
char pn[1024];
@@ -1499,7 +1499,7 @@
#ifndef NO_PWD_OVERRIDE
HandlePWD(&sa);
#endif
- Global_SetExpand(".CURDIR", curdir);
+ Global_Set(".CURDIR", curdir);
InitObjdir(machine, machine_arch);
@@ -2104,7 +2104,7 @@
/*
* We can print this even if there is no .ERROR target.
*/
- Global_SetExpand(".ERROR_TARGET", gn->name);
+ Global_Set(".ERROR_TARGET", gn->name);
Var_Delete(".ERROR_CMD", VAR_GLOBAL);
for (ln = gn->commands.first; ln != NULL; ln = ln->next) {
diff -r b99d4eb321e0 -r a04549d80dbe usr.bin/make/meta.c
--- a/usr.bin/make/meta.c Wed Feb 03 08:00:36 2021 +0000
+++ b/usr.bin/make/meta.c Wed Feb 03 08:08:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.171 2021/02/03 08:00:36 rillig Exp $ */
+/* $NetBSD: meta.c,v 1.172 2021/02/03 08:08:18 rillig Exp $ */
/*
* Implement 'meta' mode.
@@ -569,7 +569,7 @@
{
#ifdef USE_FILEMON
/* this allows makefiles to test if we have filemon support */
- Global_SetExpand(".MAKE.PATH_FILEMON", filemon_path());
+ Global_Set(".MAKE.PATH_FILEMON", filemon_path());
#endif
}
@@ -616,7 +616,7 @@
* This works be cause :H will generate '.' if there is no /
* and :tA will resolve that to cwd.
*/
- Global_SetExpand(MAKE_META_PREFIX,
+ Global_Set(MAKE_META_PREFIX,
"Building ${.TARGET:H:tA}/${.TARGET:T}");
}
if (once)
@@ -784,11 +784,11 @@
status, ignerr ? "(ignored)" : "");
}
if (gn != NULL)
- Global_SetExpand(".ERROR_TARGET", GNode_Path(gn));
+ Global_Set(".ERROR_TARGET", GNode_Path(gn));
getcwd(cwd, sizeof cwd);
- Global_SetExpand(".ERROR_CWD", cwd);
+ Global_Set(".ERROR_CWD", cwd);
if (pbm->meta_fname[0] != '\0') {
- Global_SetExpand(".ERROR_META_FILE", pbm->meta_fname);
+ Global_Set(".ERROR_META_FILE", pbm->meta_fname);
}
meta_job_finish(job);
}
diff -r b99d4eb321e0 -r a04549d80dbe usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h Wed Feb 03 08:00:36 2021 +0000
+++ b/usr.bin/make/nonints.h Wed Feb 03 08:08:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.191 2021/02/03 08:00:36 rillig Exp $ */
+/* $NetBSD: nonints.h,v 1.192 2021/02/03 08:08:18 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -371,6 +371,7 @@
void Var_DeleteVar(const char *, GNode *);
void Var_Delete(const char *, GNode *);
void Var_Undef(const char *);
+void Global_Set(const char *, const char *);
void Global_SetExpand(const char *, const char *);
void Var_Set(const char *, const char *, GNode *);
void Var_SetWithFlags(const char *, const char *, GNode *, VarSetFlags);
diff -r b99d4eb321e0 -r a04549d80dbe usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Wed Feb 03 08:00:36 2021 +0000
+++ b/usr.bin/make/parse.c Wed Feb 03 08:08:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.539 2021/02/03 08:00:36 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.540 2021/02/03 08:08:18 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.539 2021/02/03 08:00:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.540 2021/02/03 08:08:18 rillig Exp $");
/* types and constants */
@@ -1327,7 +1327,7 @@
break;
#ifdef POSIX
case SP_POSIX:
- Global_SetExpand("%POSIX", "1003.2");
+ Global_Set("%POSIX", "1003.2");
break;
#endif
default:
diff -r b99d4eb321e0 -r a04549d80dbe usr.bin/make/suff.c
--- a/usr.bin/make/suff.c Wed Feb 03 08:00:36 2021 +0000
+++ b/usr.bin/make/suff.c Wed Feb 03 08:08:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.342 2021/02/03 08:00:36 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.343 2021/02/03 08:08:18 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.342 2021/02/03 08:00:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.343 2021/02/03 08:08:18 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -903,11 +903,11 @@
}
flags = SearchPath_ToFlags(includesPath, "-I");
- Global_SetExpand(".INCLUDES", flags);
+ Global_Set(".INCLUDES", flags);
free(flags);
flags = SearchPath_ToFlags(libsPath, "-L");
- Global_SetExpand(".LIBS", flags);
+ Global_Set(".LIBS", flags);
free(flags);
SearchPath_Free(includesPath);
diff -r b99d4eb321e0 -r a04549d80dbe usr.bin/make/var.c
--- a/usr.bin/make/var.c Wed Feb 03 08:00:36 2021 +0000
+++ b/usr.bin/make/var.c Wed Feb 03 08:08:18 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.791 2021/02/03 08:00:36 rillig Exp $ */
+/* $NetBSD: var.c,v 1.792 2021/02/03 08:08:18 rillig Exp $ */
Home |
Main Index |
Thread Index |
Old Index