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: inline macros for variable names
details: https://anonhg.NetBSD.org/src/rev/d7bb2fb6d99a
branches: trunk
changeset: 373534:d7bb2fb6d99a
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Feb 15 06:52:58 2023 +0000
description:
make: inline macros for variable names
The variable name '.MAKEOVERRIDES' was already used in the non-macro
form.
No binary change.
diffstat:
usr.bin/make/job.c | 10 +++++-----
usr.bin/make/main.c | 16 ++++++++--------
usr.bin/make/make.h | 9 +--------
usr.bin/make/parse.c | 12 ++++++------
usr.bin/make/unit-tests/varname-dot-makeoverrides.mk | 4 ++--
usr.bin/make/var.c | 8 ++++----
6 files changed, 26 insertions(+), 33 deletions(-)
diffs (223 lines):
diff -r 4af4c4722c21 -r d7bb2fb6d99a usr.bin/make/job.c
--- a/usr.bin/make/job.c Wed Feb 15 06:31:51 2023 +0000
+++ b/usr.bin/make/job.c Wed Feb 15 06:52:58 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.458 2023/02/14 21:38:31 rillig Exp $ */
+/* $NetBSD: job.c,v 1.459 2023/02/15 06:52:58 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.458 2023/02/14 21:38:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.459 2023/02/15 06:52:58 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -2196,11 +2196,11 @@
{
if (targPrefix != NULL) {
free(targPrefix);
- } else if (!Var_Exists(SCOPE_GLOBAL, MAKE_JOB_PREFIX)) {
- Global_Set(MAKE_JOB_PREFIX, "---");
+ } else if (!Var_Exists(SCOPE_GLOBAL, ".MAKE.JOB.PREFIX")) {
+ Global_Set(".MAKE.JOB.PREFIX", "---");
}
- targPrefix = Var_Subst("${" MAKE_JOB_PREFIX "}",
+ targPrefix = Var_Subst("${.MAKE.JOB.PREFIX}",
SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
}
diff -r 4af4c4722c21 -r d7bb2fb6d99a usr.bin/make/main.c
--- a/usr.bin/make/main.c Wed Feb 15 06:31:51 2023 +0000
+++ b/usr.bin/make/main.c Wed Feb 15 06:52:58 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.590 2023/02/14 21:38:31 rillig Exp $ */
+/* $NetBSD: main.c,v 1.591 2023/02/15 06:52:58 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.590 2023/02/14 21:38:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.591 2023/02/15 06:52:58 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -440,7 +440,7 @@
case 'B':
opts.compatMake = true;
Global_Append(MAKEFLAGS, "-B");
- Global_Set(MAKE_MODE, "compat");
+ Global_Set(".MAKE.MODE", "compat");
break;
case 'C':
MainParseArgChdir(argvalue);
@@ -788,7 +788,7 @@
static void
MakeMode(void)
{
- char *mode = Var_Subst("${" MAKE_MODE ":tl}",
+ char *mode = Var_Subst("${.MAKE.MODE:tl}",
SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
@@ -1273,7 +1273,7 @@
{
StringList makefiles = LST_INIT;
StringListNode *ln;
- char *prefs = Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
+ char *prefs = Var_Subst("${.MAKE.MAKEFILE_PREFERENCE}",
SCOPE_CMDLINE, VARE_WANTRES);
/* TODO: handle errors */
@@ -1352,7 +1352,7 @@
/* This is the traditional preference for makefiles. */
# define MAKEFILE_PREFERENCE_LIST "makefile Makefile"
#endif
- Global_Set(MAKE_MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST);
+ Global_Set(".MAKE.MAKEFILE_PREFERENCE", MAKEFILE_PREFERENCE_LIST);
Global_Set(".MAKE.DEPENDFILE", ".depend");
CmdOpts_Init();
@@ -1378,7 +1378,7 @@
Parse_Init();
InitVarMake(argv[0]);
Global_Set(MAKEFLAGS, "");
- Global_Set(MAKEOVERRIDES, "");
+ Global_Set(".MAKEOVERRIDES", "");
Global_Set("MFLAGS", "");
Global_Set(".ALLTARGETS", "");
Var_Set(SCOPE_CMDLINE, ".MAKE.LEVEL.ENV", MAKE_LEVEL_ENV);
@@ -1391,7 +1391,7 @@
if (makelevel < 0)
makelevel = 0;
snprintf(buf, sizeof buf, "%d", makelevel);
- Global_Set(MAKE_LEVEL, buf);
+ Global_Set(".MAKE.LEVEL", buf);
snprintf(buf, sizeof buf, "%u", myPid);
Global_Set_ReadOnly(".MAKE.PID", buf);
snprintf(buf, sizeof buf, "%u", getppid());
diff -r 4af4c4722c21 -r d7bb2fb6d99a usr.bin/make/make.h
--- a/usr.bin/make/make.h Wed Feb 15 06:31:51 2023 +0000
+++ b/usr.bin/make/make.h Wed Feb 15 06:52:58 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.315 2023/02/15 06:31:51 rillig Exp $ */
+/* $NetBSD: make.h,v 1.316 2023/02/15 06:52:58 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -609,13 +609,6 @@
extern pid_t myPid;
#define MAKEFLAGS ".MAKEFLAGS"
-#define MAKEOVERRIDES ".MAKEOVERRIDES"
-/* prefix when printing the target of a job */
-#define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX"
-#define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all loaded makefiles */
-#define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
-#define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
-#define MAKE_MODE ".MAKE.MODE"
#ifndef MAKE_LEVEL_ENV
# define MAKE_LEVEL_ENV "MAKELEVEL"
#endif
diff -r 4af4c4722c21 -r d7bb2fb6d99a usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Wed Feb 15 06:31:51 2023 +0000
+++ b/usr.bin/make/parse.c Wed Feb 15 06:52:58 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.695 2023/02/15 06:31:51 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.696 2023/02/15 06:52:58 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.695 2023/02/15 06:31:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.696 2023/02/15 06:52:58 rillig Exp $");
/*
* A file being read.
@@ -1870,7 +1870,7 @@
static void
VarAssignSpecial(const char *name, const char *avalue)
{
- if (strcmp(name, MAKEOVERRIDES) == 0)
+ if (strcmp(name, ".MAKEOVERRIDES") == 0)
Main_ExportMAKEFLAGS(false); /* re-export MAKEFLAGS */
else if (strcmp(name, ".CURDIR") == 0) {
/*
@@ -1880,7 +1880,7 @@
*/
Dir_InitCur(avalue);
Dir_SetPATH();
- } else if (strcmp(name, MAKE_JOB_PREFIX) == 0)
+ } else if (strcmp(name, ".MAKE.JOB.PREFIX") == 0)
Job_SetPrefix();
else if (strcmp(name, ".MAKE.EXPORTED") == 0)
Var_ExportVars(avalue);
@@ -2146,8 +2146,8 @@
static void
TrackInput(const char *name)
{
- if (!VarContainsWord(MAKE_MAKEFILES, name))
- Global_Append(MAKE_MAKEFILES, name);
+ if (!VarContainsWord(".MAKE.MAKEFILES", name))
+ Global_Append(".MAKE.MAKEFILES", name);
}
diff -r 4af4c4722c21 -r d7bb2fb6d99a usr.bin/make/unit-tests/varname-dot-makeoverrides.mk
--- a/usr.bin/make/unit-tests/varname-dot-makeoverrides.mk Wed Feb 15 06:31:51 2023 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-makeoverrides.mk Wed Feb 15 06:52:58 2023 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: varname-dot-makeoverrides.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-makeoverrides.mk,v 1.3 2023/02/15 06:52:59 rillig Exp $
#
-# Tests for the special .MAKE.MAKEOVERRIDES variable.
+# Tests for the special .MAKEOVERRIDES variable.
# TODO: Implementation
diff -r 4af4c4722c21 -r d7bb2fb6d99a usr.bin/make/var.c
--- a/usr.bin/make/var.c Wed Feb 15 06:31:51 2023 +0000
+++ b/usr.bin/make/var.c Wed Feb 15 06:52:58 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.1045 2023/02/15 06:31:51 rillig Exp $ */
+/* $NetBSD: var.c,v 1.1046 2023/02/15 06:52:58 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1045 2023/02/15 06:31:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1046 2023/02/15 06:52:58 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -1001,7 +1001,7 @@
/*
* If requested, don't export these in the environment
- * individually. We still put them in MAKEOVERRIDES so
+ * individually. We still put them in .MAKEOVERRIDES so
* that the command-line settings continue to override
* Makefile settings.
*/
@@ -1013,7 +1013,7 @@
* in ExportVarPlain?
*/
- Global_Append(MAKEOVERRIDES, name);
+ Global_Append(".MAKEOVERRIDES", name);
}
if (name[0] == '.' && strcmp(name, MAKE_SAVE_DOLLARS) == 0)
Home |
Main Index |
Thread Index |
Old Index