Module Name: src
Committed By: rillig
Date: Wed Feb 7 06:43:02 UTC 2024
Modified Files:
src/usr.bin/make: arch.c config.h main.c parse.c suff.c var.c
Log Message:
make: remove unneeded conditional-compilation toggles
The toggles INCLUDES, LIBRARIES, POSIX, SYSVINCLUDE, SYSVVARSUB,
GMAKEEXPORT and SUNSHCMD are no longer needed, they were unconditionally
set.
The toggle NO_REGEX was configurable from the command line, but
disabling it would result in various error messages about the unknown
':C' modifier.
OK sjg@.
To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/usr.bin/make/arch.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/config.h
cvs rdiff -u -r1.609 -r1.610 src/usr.bin/make/main.c
cvs rdiff -u -r1.716 -r1.717 src/usr.bin/make/parse.c
cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/suff.c
cvs rdiff -u -r1.1098 -r1.1099 src/usr.bin/make/var.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.214 src/usr.bin/make/arch.c:1.215
--- src/usr.bin/make/arch.c:1.214 Sun Nov 19 22:50:11 2023
+++ src/usr.bin/make/arch.c Wed Feb 7 06:43:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.214 2023/11/19 22:50:11 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
#include "config.h"
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: arch.c,v 1.214 2023/11/19 22:50:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.215 2024/02/07 06:43:02 rillig Exp $");
typedef struct List ArchList;
typedef struct ListNode ArchListNode;
@@ -978,11 +978,7 @@ Arch_FindLib(GNode *gn, SearchPath *path
gn->path = Dir_FindFile(libName, path);
free(libName);
-#ifdef LIBRARIES
Var_Set(gn, TARGET, gn->name);
-#else
- Var_Set(gn, TARGET, GNode_Path(gn));
-#endif
}
/* ARGSUSED */
Index: src/usr.bin/make/config.h
diff -u src/usr.bin/make/config.h:1.28 src/usr.bin/make/config.h:1.29
--- src/usr.bin/make/config.h:1.28 Fri Dec 11 22:53:08 2020
+++ src/usr.bin/make/config.h Wed Feb 7 06:43:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: config.h,v 1.28 2020/12/11 22:53:08 rillig Exp $ */
+/* $NetBSD: config.h,v 1.29 2024/02/07 06:43:02 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -73,20 +73,6 @@
*/
/*
- * INCLUDES
- * LIBRARIES
- * These control the handling of the .INCLUDES and .LIBS variables.
- *
- * If INCLUDES is defined, the .INCLUDES variable will be filled
- * from the search paths of those suffixes which are marked by
- * .INCLUDES dependency lines. Similarly for LIBRARIES and .LIBS.
- *
- * See varname-dot-include.mk and varname-dot-libs.mk for more details.
- */
-#define INCLUDES
-#define LIBRARIES
-
-/*
* LIBSUFF
* Is the suffix used to denote libraries and is used by the Suff module
* to find the search path on which to seek any -l<xx> targets.
@@ -108,40 +94,6 @@
*/
#define RECHECK
-/*
- * POSIX
- * Adhere to the POSIX 1003.2 draft for the make(1) program.
- * - Use MAKEFLAGS instead of MAKE to pick arguments from the
- * environment.
- */
-#define POSIX
-
-/*
- * SYSVINCLUDE
- * Recognize system V like include directives [include "filename"]
- * (required by POSIX 2018)
- * SYSVVARSUB
- * Recognize system V like ${VAR:x=y} variable substitutions
- * (required by POSIX 2018)
- */
-#define SYSVINCLUDE
-#define SYSVVARSUB
-
-/*
- * GMAKEEXPORT
- * Recognize gmake like variable export directives [export <VAR>=<VALUE>]
- */
-#define GMAKEEXPORT
-
-/*
- * SUNSHCMD
- * Recognize SunOS and Solaris:
- * VAR :sh= CMD # Assign VAR to the command substitution of CMD
- * ${VAR:sh} # Return the command substitution of the value
- * # of ${VAR}
- */
-#define SUNSHCMD
-
#if defined(MAKE_NATIVE) && !defined(__ELF__)
# ifndef RANLIBMAG
# define RANLIBMAG "__.SYMDEF"
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.609 src/usr.bin/make/main.c:1.610
--- src/usr.bin/make/main.c:1.609 Sun Jan 7 01:33:57 2024
+++ src/usr.bin/make/main.c Wed Feb 7 06:43:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.609 2024/01/07 01:33:57 sjg Exp $ */
+/* $NetBSD: main.c,v 1.610 2024/02/07 06:43:02 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.609 2024/01/07 01:33:57 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.610 2024/02/07 06:43:02 rillig Exp $");
#if defined(MAKE_NATIVE)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -1418,20 +1418,11 @@ main_Init(int argc, char **argv)
#endif
Dir_Init();
-#ifdef POSIX
{
char *makeflags = explode(getenv("MAKEFLAGS"));
Main_ParseArgLine(makeflags);
free(makeflags);
}
-#else
- /*
- * First snag any flags out of the MAKE environment variable.
- * (Note this is *not* MAKEFLAGS since /bin/make uses that and it's
- * in a different format).
- */
- Main_ParseArgLine(getenv("MAKE"));
-#endif
if (getcwd(curdir, MAXPATHLEN) == NULL) {
(void)fprintf(stderr, "%s: getcwd: %s.\n",
@@ -2123,13 +2114,8 @@ Main_ExportMAKEFLAGS(bool first)
"${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}",
SCOPE_CMDLINE, VARE_WANTRES);
/* TODO: handle errors */
- if (flags[0] != '\0') {
-#ifdef POSIX
+ if (flags[0] != '\0')
setenv("MAKEFLAGS", flags, 1);
-#else
- setenv("MAKE", flags, 1);
-#endif
- }
}
char *
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.716 src/usr.bin/make/parse.c:1.717
--- src/usr.bin/make/parse.c:1.716 Sun Jan 7 11:39:04 2024
+++ src/usr.bin/make/parse.c Wed Feb 7 06:43:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.716 2024/01/07 11:39:04 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.717 2024/02/07 06:43:02 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.716 2024/01/07 11:39:04 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.717 2024/02/07 06:43:02 rillig Exp $");
/* Detects a multiple-inclusion guard in a makefile. */
typedef enum {
@@ -167,9 +167,7 @@ typedef enum ParseSpecial {
SP_PARALLEL, /* .PARALLEL; not mentioned in the manual page */
SP_PATH, /* .PATH or .PATH.suffix */
SP_PHONY, /* .PHONY */
-#ifdef POSIX
SP_POSIX, /* .POSIX; not mentioned in the manual page */
-#endif
SP_PRECIOUS, /* .PRECIOUS */
SP_READONLY, /* .READONLY */
SP_SHELL, /* .SHELL */
@@ -289,9 +287,7 @@ static const struct {
{ ".PARALLEL", SP_PARALLEL, OP_NONE },
{ ".PATH", SP_PATH, OP_NONE },
{ ".PHONY", SP_PHONY, OP_PHONY },
-#ifdef POSIX
{ ".POSIX", SP_POSIX, OP_NONE },
-#endif
{ ".PRECIOUS", SP_PRECIOUS, OP_PRECIOUS },
{ ".READONLY", SP_READONLY, OP_NONE },
{ ".RECURSIVE", SP_ATTRIBUTE, OP_MAKE },
@@ -1305,7 +1301,6 @@ HandleDependencySourcesEmpty(ParseSpecia
case SP_SYSPATH:
ClearPaths(special, paths);
break;
-#ifdef POSIX
case SP_POSIX:
if (posix_state == PS_NOW_OR_NEVER) {
/*
@@ -1317,7 +1312,6 @@ HandleDependencySourcesEmpty(ParseSpecia
IncludeFile("posix.mk", true, false, true);
}
break;
-#endif
default:
break;
}
@@ -1699,7 +1693,6 @@ AdjustVarassignOp(const char *name, cons
} else {
type = VAR_NORMAL;
-#ifdef SUNSHCMD
while (op > name && ch_isspace(op[-1]))
op--;
@@ -1707,7 +1700,6 @@ AdjustVarassignOp(const char *name, cons
op -= 3;
type = VAR_SHELL;
}
-#endif
}
va.varname = bmake_strsedup(name, nameEnd < op ? nameEnd : op);
@@ -1769,12 +1761,10 @@ Parse_IsVar(const char *p, VarAssign *ou
if (ch == '\0')
return false;
-#ifdef SUNSHCMD
if (ch == ':' && p[0] == 's' && p[1] == 'h') {
p += 2;
continue;
}
-#endif
if (ch == '=')
eq = p - 1;
else if (*p == '=' &&
@@ -2201,7 +2191,6 @@ IsInclude(const char *dir, bool sysv)
}
-#ifdef SYSVINCLUDE
/* Check if the line is a SYSV include directive. */
static bool
IsSysVInclude(const char *line)
@@ -2257,9 +2246,7 @@ ParseTraditionalInclude(char *line)
free(all_files);
}
-#endif
-#ifdef GMAKEEXPORT
/* Parse "export <variable>=<value>", and actually export it. */
static void
ParseGmakeExport(char *line)
@@ -2290,7 +2277,6 @@ ParseGmakeExport(char *line)
setenv(variable, value, 1);
free(value);
}
-#endif
/*
* When the end of the current file or .for loop is reached, continue reading
@@ -2907,20 +2893,16 @@ ParseLine(char *line)
return;
}
-#ifdef SYSVINCLUDE
if (IsSysVInclude(line)) {
ParseTraditionalInclude(line);
return;
}
-#endif
-#ifdef GMAKEEXPORT
if (strncmp(line, "export", 6) == 0 && ch_isspace(line[6]) &&
strchr(line, ':') == NULL) {
ParseGmakeExport(line);
return;
}
-#endif
if (Parse_VarAssign(line, true, SCOPE_GLOBAL))
return;
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.377 src/usr.bin/make/suff.c:1.378
--- src/usr.bin/make/suff.c:1.377 Fri Jan 5 23:22:06 2024
+++ src/usr.bin/make/suff.c Wed Feb 7 06:43:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.377 2024/01/05 23:22:06 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.378 2024/02/07 06:43:02 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -115,7 +115,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.377 2024/01/05 23:22:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.378 2024/02/07 06:43:02 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -856,15 +856,11 @@ Suff_ExtendPaths(void)
for (ln = sufflist.first; ln != NULL; ln = ln->next) {
Suffix *suff = ln->datum;
if (!Lst_IsEmpty(&suff->searchPath->dirs)) {
-#ifdef INCLUDES
if (suff->include)
SearchPath_AddAll(includesPath,
suff->searchPath);
-#endif
-#ifdef LIBRARIES
if (suff->library)
SearchPath_AddAll(libsPath, suff->searchPath);
-#endif
SearchPath_AddAll(suff->searchPath, &dirSearchPath);
} else {
SearchPath_Free(suff->searchPath);
Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1098 src/usr.bin/make/var.c:1.1099
--- src/usr.bin/make/var.c:1.1098 Sun Feb 4 10:03:10 2024
+++ src/usr.bin/make/var.c Wed Feb 7 06:43:02 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.1098 2024/02/04 10:03:10 rillig Exp $ */
+/* $NetBSD: var.c,v 1.1099 2024/02/07 06:43:02 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -124,10 +124,8 @@
*/
#include <sys/stat.h>
-#ifndef NO_REGEX
#include <sys/types.h>
#include <regex.h>
-#endif
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
@@ -139,7 +137,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1098 2024/02/04 10:03:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1099 2024/02/07 06:43:02 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -1344,7 +1342,6 @@ ModifyWord_Root(Substring word, SepBuf *
SepBuf_AddRange(buf, word.start, end);
}
-#ifdef SYSVVARSUB
struct ModifyWord_SysVSubstArgs {
GNode *scope;
Substring lhsPrefix;
@@ -1384,7 +1381,6 @@ ModifyWord_SysVSubst(Substring word, Sep
FStr_Done(&rhs);
}
-#endif
static const char *
Substring_Find(Substring haystack, Substring needle)
@@ -1462,7 +1458,6 @@ nosub:
SepBuf_AddSubstring(buf, word);
}
-#ifndef NO_REGEX
/* Print the error caused by a regcomp or regexec call. */
static void
RegexError(int reerr, const regex_t *pat, const char *str)
@@ -1570,7 +1565,6 @@ ok:
if (*wp != '\0')
SepBuf_AddStr(buf, wp);
}
-#endif
struct ModifyWord_LoopArgs {
@@ -2888,8 +2882,6 @@ ApplyModifier_Subst(const char **pp, Mod
return AMR_OK;
}
-#ifndef NO_REGEX
-
/* :C,from,to, */
static ApplyModifierResult
ApplyModifier_Regex(const char **pp, ModChain *ch)
@@ -2948,8 +2940,6 @@ done:
return AMR_OK;
}
-#endif
-
/* :Q, :q */
static ApplyModifierResult
ApplyModifier_Quote(const char **pp, ModChain *ch)
@@ -3593,7 +3583,6 @@ ApplyModifier_Unique(const char **pp, Mo
return AMR_OK;
}
-#ifdef SYSVVARSUB
/* Test whether the modifier has the form '<lhs>=<rhs>'. */
static bool
IsSysVModifier(const char *p, char startc, char endc)
@@ -3665,9 +3654,7 @@ done:
FStr_Done(&rhs);
return AMR_OK;
}
-#endif
-#ifdef SUNSHCMD
/* :sh */
static ApplyModifierResult
ApplyModifier_SunShell(const char **pp, ModChain *ch)
@@ -3690,7 +3677,6 @@ ApplyModifier_SunShell(const char **pp,
return AMR_OK;
}
-#endif
/*
* In cases where the evaluation mode and the definedness are the "standard"
@@ -3772,10 +3758,8 @@ ApplyModifier(const char **pp, ModChain
return ApplyModifier_Words(pp, ch);
case '_':
return ApplyModifier_Remember(pp, ch);
-#ifndef NO_REGEX
case 'C':
return ApplyModifier_Regex(pp, ch);
-#endif
case 'D':
case 'U':
return ApplyModifier_Defined(pp, ch);
@@ -3808,10 +3792,8 @@ ApplyModifier(const char **pp, ModChain
return ApplyModifier_Range(pp, ch);
case 'S':
return ApplyModifier_Subst(pp, ch);
-#ifdef SUNSHCMD
case 's':
return ApplyModifier_SunShell(pp, ch);
-#endif
case 'T':
return ApplyModifier_WordFunc(pp, ch, ModifyWord_Tail);
case 't':
@@ -3900,12 +3882,10 @@ ApplySingleModifier(const char **pp, Mod
res = ApplyModifier(&p, ch);
-#ifdef SYSVVARSUB
if (res == AMR_UNKNOWN) {
assert(p == mod);
res = ApplyModifier_SysV(&p, ch);
}
-#endif
if (res == AMR_UNKNOWN) {
/*