Update to bmake-20200710

Key changes include reduced noise at end of failed build log
and avoid evaluation of unnecessary terms in conditionals.
In META MODE; a target flagged .META is out-of-date if meta file
is missing

MFC after:      1 week
This commit is contained in:
Simon J. Gerraty 2020-07-12 01:11:48 +00:00
commit 3841c28717
88 changed files with 3710 additions and 3533 deletions

View File

@ -1,3 +1,98 @@
2020-07-10 Simon J Gerraty <sjg@beast.crufty.net>
* configure.in: use AC_INCLUDES_DEFAULT rather than AC_HEADER_STDC
* VERSION (_MAKE_VERSION): 20200710
Merge with NetBSD make, pick up
o filemon/filemon_dev.c: use O_CLOEXEC rather than extra syscall
o meta.c: target flagged .META is out-of-date if meta file missing
2020-07-09 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200709
Merge with NetBSD make, pick up
o cond.c: fix for compare_expression when doEval=0
o unit-tests/Makefile: rework
o filemon/filemon_dev.c: ensure filemon fd is closed on exec.
2020-07-04 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200704
Merge with NetBSD make, pick up
(most of this by rillig@)
o lots of style and white-space cleanup
o lots more unit tests for variable modifiers
o simplified description of some functions
o str.c: refactor Str_Match
o var.c: debugging output for :@
constify VarModify parameter
fix :hash modifier on 16-bit platforms
remove unnecessary forward declarations
refactor ApplyModifier_SysV to have less indentation
simplify code for :E and :R
clean up code for :H and :T
refactor ApplyModifiers
* var.c: we need stdint.h on some platforms to get uint32_t
* unit-test/Makefile: we need to supress the specific error
for RE substitution error in modmisc, since it varies accross
different OS.
2020-07-02 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200702
Merge with NetBSD make, pick up
o var.c: more improvements to avoiding unnecessary evaluation
use enums for flags
o remove flags arg to Var_Set which outside of var.c is always 0
2020-07-01 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200701
Merge with NetBSD make, pick up
o var.c: with change to cond.c; ensure that nested variables
within a variable name are expanded.
o unit-tests/varmisc.mk: test for nested varname
2020-06-29 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200629
Merge with NetBSD make, pick up
o cond.c: do not eval unnecessary terms of conditionals.
2020-06-25 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200625
Merge with NetBSD make, pick up
o meta.c: report error if lseek in filemon_read fails
2020-06-22 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200622
Merge with NetBSD make, pick up
o dieQuietly: ignore OP_SUBMAKE as too aggressive
2020-06-19 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200619
Merge with NetBSD make, pick up
o str.c: performance improvement for Str_Match for multiple '*'
o dieQuietly: supress the failure output from make
when failing node is a sub-make or a sibling failed.
This cuts down greatly on unhelpful noise at the end of
build log. Disabled by -dj or .MAKE.DIE_QUIETLY=no
2020-06-10 Simon J Gerraty <sjg@beast.crufty.net>
* FILES: add LICENSE to appease some packagers.
This is an attempt to fairly represent the license on almost
200 files, which are almost all BSD-3-Clause
The few exceptions being more liberal.
* VERSION (_MAKE_VERSION): 20200610
Merge with NetBSD make, pick up
o unit test for :Or
2020-06-06 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200606

View File

@ -1,5 +1,6 @@
ChangeLog
FILES
LICENSE
Makefile
Makefile.config.in
PSD.doc/Makefile
@ -107,6 +108,8 @@ unit-tests/cond2.exp
unit-tests/cond2.mk
unit-tests/cond-late.mk
unit-tests/cond-late.exp
unit-tests/cond-short.mk
unit-tests/cond-short.exp
unit-tests/dollar.exp
unit-tests/dollar.mk
unit-tests/doterror.exp

View File

@ -1,2 +1,2 @@
# keep this compatible with sh and make
_MAKE_VERSION=20200606
_MAKE_VERSION=20200710

View File

@ -1,4 +1,4 @@
/* $NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $ */
/* $NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $";
static char rcsid[] = "$NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
#else
__RCSID("$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $");
__RCSID("$NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -312,7 +312,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
free(freeIt);
if (result == var_Error) {
return(FAILURE);
return FAILURE;
} else {
subLibName = TRUE;
}
@ -354,7 +354,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
free(freeIt);
if (result == var_Error) {
return(FAILURE);
return FAILURE;
} else {
doSubst = TRUE;
}
@ -372,7 +372,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
*/
if (*cp == '\0') {
printf("No closing parenthesis in archive specification\n");
return (FAILURE);
return FAILURE;
}
/*
@ -426,7 +426,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
if (gn == NULL) {
free(buf);
return(FAILURE);
return FAILURE;
} else {
gn->type |= OP_ARCHV;
(void)Lst_AtEnd(nodeLst, gn);
@ -437,7 +437,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
* ourselves.
*/
free(buf);
return(FAILURE);
return FAILURE;
}
/*
* Free buffer and continue with our work.
@ -461,7 +461,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
gn = Targ_FindNode(nameBuf, TARG_CREATE);
if (gn == NULL) {
free(nameBuf);
return (FAILURE);
return FAILURE;
} else {
/*
* We've found the node, but have to make sure the rest of
@ -483,7 +483,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
gn = Targ_FindNode(nameBuf, TARG_CREATE);
free(nameBuf);
if (gn == NULL) {
return (FAILURE);
return FAILURE;
} else {
/*
* We've found the node, but have to make sure the rest of the
@ -520,7 +520,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
} while (*cp != '\0' && isspace ((unsigned char)*cp));
*linePtr = cp;
return (SUCCESS);
return SUCCESS;
}
/*-
@ -544,7 +544,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt)
static int
ArchFindArchive(const void *ar, const void *archName)
{
return (strcmp(archName, ((const Arch *)ar)->name));
return strcmp(archName, ((const Arch *)ar)->name);
}
/*-
@ -602,7 +602,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
he = Hash_FindEntry(&ar->members, member);
if (he != NULL) {
return ((struct ar_hdr *)Hash_GetValue(he));
return (struct ar_hdr *)Hash_GetValue(he);
} else {
/* Try truncated name */
char copy[AR_MAX_NAME_LEN+1];
@ -614,7 +614,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
copy[AR_MAX_NAME_LEN] = '\0';
}
if ((he = Hash_FindEntry(&ar->members, copy)) != NULL)
return ((struct ar_hdr *)Hash_GetValue(he));
return (struct ar_hdr *)Hash_GetValue(he);
return NULL;
}
}
@ -635,7 +635,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
return NULL;
} else {
fclose(arch);
return (&sarh);
return &sarh;
}
}
@ -753,7 +753,7 @@ ArchStatMember(char *archive, char *member, Boolean hash)
he = Hash_FindEntry(&ar->members, member);
if (he != NULL) {
return ((struct ar_hdr *)Hash_GetValue(he));
return (struct ar_hdr *)Hash_GetValue(he);
} else {
return NULL;
}
@ -962,7 +962,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
fclose(arch);
return NULL;
}
return (arch);
return arch;
}
} else
#ifdef AR_EFMT1
@ -996,7 +996,7 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
fclose(arch);
return NULL;
}
return (arch);
return arch;
}
if (fseek(arch, -elen, SEEK_CUR) != 0) {
fclose(arch);
@ -1152,7 +1152,7 @@ Arch_MTime(GNode *gn)
}
gn->mtime = modTime;
return (modTime);
return modTime;
}
/*-
@ -1179,7 +1179,7 @@ Arch_MemMTime(GNode *gn)
if (Lst_Open(gn->parents) != SUCCESS) {
gn->mtime = 0;
return (0);
return 0;
}
while ((ln = Lst_Next(gn->parents)) != NULL) {
pgn = (GNode *)Lst_Datum(ln);
@ -1211,7 +1211,7 @@ Arch_MemMTime(GNode *gn)
Lst_Close(gn->parents);
return (gn->mtime);
return gn->mtime;
}
/*-
@ -1252,9 +1252,9 @@ Arch_FindLib(GNode *gn, Lst path)
free(libName);
#ifdef LIBRARIES
Var_Set(TARGET, gn->name, gn, 0);
Var_Set(TARGET, gn->name, gn);
#else
Var_Set(TARGET, gn->path == NULL ? gn->name : gn->path, gn, 0);
Var_Set(TARGET, gn->path == NULL ? gn->name : gn->path, gn);
#endif /* LIBRARIES */
}
@ -1337,7 +1337,7 @@ Arch_LibOODate(GNode *gn)
oodate = FALSE;
#endif
}
return (oodate);
return oodate;
}
/*-

View File

@ -1,4 +1,4 @@
/* $NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $ */
/* $NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $";
static char rcsid[] = "$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $");
__RCSID("$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -160,7 +160,7 @@ Buf_GetAll(Buffer *bp, int *numBytesPtr)
if (numBytesPtr != NULL)
*numBytesPtr = bp->count;
return (bp->buffer);
return bp->buffer;
}
/*-

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $ */
/* $NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $";
static char rcsid[] = "$NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $");
__RCSID("$NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -236,7 +236,7 @@ CompatRunCommand(void *cmdp, void *gnp)
silent = gn->type & OP_SILENT;
errCheck = !(gn->type & OP_IGNORE);
doIt = FALSE;
cmdNode = Lst_Member(gn->commands, cmd);
cmdStart = Var_Subst(NULL, cmd, gn, VARF_WANTRES);
@ -249,18 +249,18 @@ CompatRunCommand(void *cmdp, void *gnp)
if (*cmdStart == '\0') {
free(cmdStart);
return(0);
return 0;
}
cmd = cmdStart;
Lst_Replace(cmdNode, cmdStart);
if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
(void)Lst_AtEnd(ENDNode->commands, cmdStart);
return(0);
return 0;
}
if (strcmp(cmdStart, "...") == 0) {
gn->type |= OP_SAVE_CMDS;
return(0);
return 0;
}
while ((*cmd == '@') || (*cmd == '-') || (*cmd == '+')) {
@ -287,7 +287,7 @@ CompatRunCommand(void *cmdp, void *gnp)
* If we did not end up with a command, just skip it.
*/
if (!*cmd)
return (0);
return 0;
#if !defined(MAKE_NATIVE)
/*
@ -307,7 +307,7 @@ CompatRunCommand(void *cmdp, void *gnp)
* go to the shell. Therefore treat '=' and ':' like shell
* meta characters as documented in make(1).
*/
useShell = needshell(cmd, FALSE);
#endif
@ -325,7 +325,7 @@ CompatRunCommand(void *cmdp, void *gnp)
* we go...
*/
if (!doIt && NoExecute(gn)) {
return (0);
return 0;
}
if (DEBUG(JOB))
fprintf(debug_file, "Execute: '%s'\n", cmd);
@ -377,7 +377,7 @@ CompatRunCommand(void *cmdp, void *gnp)
meta_compat_start();
}
#endif
/*
* Fork and execute the single command. If the fork fails, we abort.
*/
@ -499,8 +499,8 @@ CompatRunCommand(void *cmdp, void *gnp)
bmake_signal(compatSigno, SIG_DFL);
kill(myPid, compatSigno);
}
return (status);
return status;
}
/*-
@ -550,7 +550,7 @@ Compat_Make(void *gnp, void *pgnp)
if (Lst_Member(gn->iParents, pgn) != NULL) {
char *p1;
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
free(p1);
}
@ -654,7 +654,7 @@ Compat_Make(void *gnp, void *pgnp)
} else {
if (Lst_Member(gn->iParents, pgn) != NULL) {
char *p1;
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn);
free(p1);
}
switch(gn->made) {
@ -681,7 +681,7 @@ Compat_Make(void *gnp, void *pgnp)
cohorts:
Lst_ForEach(gn->cohorts, Compat_Make, pgnp);
return (0);
return 0;
}
/*-

View File

@ -1,4 +1,4 @@
/* $NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $ */
/* $NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $";
static char rcsid[] = "$NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
#else
__RCSID("$NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $");
__RCSID("$NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -146,7 +146,7 @@ typedef enum {
* last two fields are stored in condInvert and condDefProc, respectively.
*/
static void CondPushBack(Token);
static int CondGetArg(char **, char **, const char *);
static int CondGetArg(Boolean, char **, char **, const char *);
static Boolean CondDoDefined(int, const char *);
static int CondStrMatch(const void *, const void *);
static Boolean CondDoMake(int, const char *);
@ -186,7 +186,7 @@ static unsigned int cond_min_depth = 0; /* depth at makefile open */
* Indicate when we should be strict about lhs of comparisons.
* TRUE when Cond_EvalExpression is called from Cond_Eval (.if etc)
* FALSE when Cond_EvalExpression is called from var.c:ApplyModifiers
* since lhs is already expanded and we cannot tell if
* since lhs is already expanded and we cannot tell if
* it was a variable reference or not.
*/
static Boolean lhsStrict;
@ -225,9 +225,6 @@ CondPushBack(Token t)
* CondGetArg --
* Find the argument of a built-in function.
*
* Input:
* parens TRUE if arg should be bounded by parens
*
* Results:
* The length of the argument and the address of the argument.
*
@ -238,7 +235,7 @@ CondPushBack(Token t)
*-----------------------------------------------------------------------
*/
static int
CondGetArg(char **linePtr, char **argPtr, const char *func)
CondGetArg(Boolean doEval, char **linePtr, char **argPtr, const char *func)
{
char *cp;
int argLen;
@ -259,7 +256,7 @@ CondGetArg(char **linePtr, char **argPtr, const char *func)
* the word 'make' or 'defined' at the beginning of a symbol...
*/
*argPtr = NULL;
return (0);
return 0;
}
while (*cp == ' ' || *cp == '\t') {
@ -290,7 +287,8 @@ CondGetArg(char **linePtr, char **argPtr, const char *func)
int len;
void *freeIt;
cp2 = Var_Parse(cp, VAR_CMD, VARF_UNDEFERR|VARF_WANTRES,
cp2 = Var_Parse(cp, VAR_CMD, VARF_UNDEFERR|
(doEval ? VARF_WANTRES : 0),
&len, &freeIt);
Buf_AddBytes(&buf, strlen(cp2), cp2);
free(freeIt);
@ -316,11 +314,11 @@ CondGetArg(char **linePtr, char **argPtr, const char *func)
if (func != NULL && *cp++ != ')') {
Parse_Error(PARSE_WARNING, "Missing closing parenthesis for %s()",
func);
return (0);
return 0;
}
*linePtr = cp;
return (argLen);
return argLen;
}
/*-
@ -349,7 +347,7 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char *arg)
}
free(p1);
return (result);
return result;
}
/*-
@ -369,7 +367,7 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char *arg)
static int
CondStrMatch(const void *string, const void *pattern)
{
return(!Str_Match(string, pattern));
return !Str_Match(string, pattern);
}
/*-
@ -414,14 +412,14 @@ CondDoExists(int argLen MAKE_ATTR_UNUSED, const char *arg)
if (DEBUG(COND)) {
fprintf(debug_file, "exists(%s) result is \"%s\"\n",
arg, path ? path : "");
}
}
if (path != NULL) {
result = TRUE;
free(path);
} else {
result = FALSE;
}
return (result);
return result;
}
/*-
@ -443,7 +441,7 @@ CondDoTarget(int argLen MAKE_ATTR_UNUSED, const char *arg)
GNode *gn;
gn = Targ_FindNode(arg, TARG_NOCREATE);
return (gn != NULL) && !OP_NOP(gn->type);
return gn != NULL && !OP_NOP(gn->type);
}
/*-
@ -467,7 +465,7 @@ CondDoCommands(int argLen MAKE_ATTR_UNUSED, const char *arg)
GNode *gn;
gn = Targ_FindNode(arg, TARG_NOCREATE);
return (gn != NULL) && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands);
return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands);
}
/*-
@ -577,7 +575,7 @@ CondGetString(Boolean doEval, Boolean *quoted, void **freeIt, Boolean strictLHS)
/* if we are in quotes, then an undefined variable is ok */
str = Var_Parse(condExpr, VAR_CMD,
((!qt && doEval) ? VARF_UNDEFERR : 0) |
VARF_WANTRES, &len, freeIt);
(doEval ? VARF_WANTRES : 0), &len, freeIt);
if (str == var_Error) {
if (*freeIt) {
free(*freeIt);
@ -668,7 +666,7 @@ compare_expression(Boolean doEval)
rhs = NULL;
lhsFree = rhsFree = FALSE;
lhsQuoted = rhsQuoted = FALSE;
/*
* Parse the variable spec and skip over it, saving its
* value in lhs.
@ -711,7 +709,7 @@ compare_expression(Boolean doEval)
goto done;
}
/* For .ifxxx <number> compare against zero */
if (CondCvtArg(lhs, &left)) {
if (CondCvtArg(lhs, &left)) {
t = left != 0.0;
goto done;
}
@ -738,6 +736,11 @@ compare_expression(Boolean doEval)
if (!rhs)
goto done;
if (!doEval) {
t = TOK_FALSE;
goto done;
}
if (rhsQuoted || lhsQuoted) {
do_string_compare:
if (((*op != '!') && (*op != '=')) || (op[1] != '=')) {
@ -764,7 +767,7 @@ compare_expression(Boolean doEval)
* rhs is either a float or an integer. Convert both the
* lhs and the rhs to a double and compare the two.
*/
if (!CondCvtArg(lhs, &left) || !CondCvtArg(rhs, &right))
goto do_string_compare;
@ -813,7 +816,7 @@ compare_expression(Boolean doEval)
}
static int
get_mpt_arg(char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED)
get_mpt_arg(Boolean doEval, char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED)
{
/*
* Use Var_Parse to parse the spec in parens and return
@ -827,7 +830,7 @@ get_mpt_arg(char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED)
/* We do all the work here and return the result as the length */
*argPtr = NULL;
val = Var_Parse(cp - 1, VAR_CMD, VARF_WANTRES, &length, &freeIt);
val = Var_Parse(cp - 1, VAR_CMD, doEval ? VARF_WANTRES : 0, &length, &freeIt);
/*
* Advance *linePtr to beyond the closing ). Note that
* we subtract one because 'length' is calculated from 'cp - 1'.
@ -864,7 +867,7 @@ compare_function(Boolean doEval)
static const struct fn_def {
const char *fn_name;
int fn_name_len;
int (*fn_getarg)(char **, char **, const char *);
int (*fn_getarg)(Boolean, char **, char **, const char *);
Boolean (*fn_proc)(int, const char *);
} fn_defs[] = {
{ "defined", 7, CondGetArg, CondDoDefined },
@ -892,7 +895,7 @@ compare_function(Boolean doEval)
if (*cp != '(')
break;
arglen = fn_def->fn_getarg(&cp, &arg, fn_def->fn_name);
arglen = fn_def->fn_getarg(doEval, &cp, &arg, fn_def->fn_name);
if (arglen <= 0) {
condExpr = cp;
return arglen < 0 ? TOK_ERROR : TOK_FALSE;
@ -917,7 +920,7 @@ compare_function(Boolean doEval)
* would be invalid if we did "defined(a)" - so instead treat as an
* expression.
*/
arglen = CondGetArg(&cp, &arg, NULL);
arglen = CondGetArg(doEval, &cp, &arg, NULL);
for (cp1 = cp; isspace(*(unsigned char *)cp1); cp1++)
continue;
if (*cp1 == '=' || *cp1 == '!')
@ -1040,7 +1043,7 @@ CondT(Boolean doEval)
t = TOK_TRUE;
}
}
return (t);
return t;
}
/*-
@ -1086,7 +1089,7 @@ CondF(Boolean doEval)
CondPushBack(o);
}
}
return (l);
return l;
}
/*-
@ -1133,7 +1136,7 @@ CondE(Boolean doEval)
CondPushBack(o);
}
}
return (l);
return l;
}
/*-

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bmake 20200524.
# Generated by GNU Autoconf 2.69 for bmake 20200710.
#
# Report bugs to <sjg@NetBSD.org>.
#
@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bmake'
PACKAGE_TARNAME='bmake'
PACKAGE_VERSION='20200524'
PACKAGE_STRING='bmake 20200524'
PACKAGE_VERSION='20200710'
PACKAGE_STRING='bmake 20200710'
PACKAGE_BUGREPORT='sjg@NetBSD.org'
PACKAGE_URL=''
@ -1254,7 +1254,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bmake 20200524 to adapt to many kinds of systems.
\`configure' configures bmake 20200710 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1315,7 +1315,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bmake 20200524:";;
short | recursive ) echo "Configuration of bmake 20200710:";;
esac
cat <<\_ACEOF
@ -1421,7 +1421,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bmake configure 20200524
bmake configure 20200710
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2001,7 +2001,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bmake $as_me 20200524, which was
It was created by bmake $as_me 20200710, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -4543,118 +4543,7 @@ if test $bmake_path_max -gt 1024; then
fi
echo "Using: BMAKE_PATH_MAX=$bmake_path_max" >&6
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ctype.h>
#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
$ac_includes_default
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
if ${ac_cv_header_sys_wait_h+:} false; then :
@ -4892,13 +4781,11 @@ for ac_header in \
paths.h \
poll.h \
ranlib.h \
string.h \
sys/mman.h \
sys/select.h \
sys/socket.h \
sys/time.h \
sys/uio.h \
unistd.h \
utime.h \
do :
@ -6778,7 +6665,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bmake $as_me 20200524, which was
This file was extended by bmake $as_me 20200710, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6840,7 +6727,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bmake config.status 20200524
bmake config.status 20200710
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -1,11 +1,11 @@
dnl
dnl RCSid:
dnl $Id: configure.in,v 1.65 2020/05/25 01:11:40 sjg Exp $
dnl $Id: configure.in,v 1.66 2020/07/10 16:34:38 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ(2.50)
AC_INIT([bmake], [20200524], [sjg@NetBSD.org])
AC_INIT([bmake], [20200710], [sjg@NetBSD.org])
AC_CONFIG_HEADERS(config.h)
dnl make srcdir absolute
@ -128,7 +128,7 @@ dnl AC_C_CROSS
dnl
dnl Checks for header files.
AC_HEADER_STDC
AC_INCLUDES_DEFAULT
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
dnl Keep this list sorted
@ -149,13 +149,11 @@ AC_CHECK_HEADERS( \
paths.h \
poll.h \
ranlib.h \
string.h \
sys/mman.h \
sys/select.h \
sys/socket.h \
sys/time.h \
sys/uio.h \
unistd.h \
utime.h \
)

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $ */
/* $NetBSD: dir.c,v 1.76 2020/07/03 08:13:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $";
static char rcsid[] = "$NetBSD: dir.c,v 1.76 2020/07/03 08:13:23 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
__RCSID("$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $");
__RCSID("$NetBSD: dir.c,v 1.76 2020/07/03 08:13:23 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -112,7 +112,7 @@ __RCSID("$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $");
* Dir_FindHereOrAbove Search for a path in the current directory and
* then all the directories above it in turn until
* the path is found or we reach the root ("/").
*
*
* Dir_MTime Return the modification time of a node. The file
* is searched for along the default search path.
* The path and mtime fields of the node are filled
@ -377,7 +377,7 @@ void
Dir_InitCur(const char *cdname)
{
Path *p;
if (cdname != NULL) {
/*
* Our build directory is not the same as our source directory.
@ -480,7 +480,7 @@ Dir_SetPATH(void)
Boolean hasLastDot = FALSE; /* true we should search dot last */
Var_Delete(".PATH", VAR_GLOBAL);
if (Lst_Open(dirSearchPath) == SUCCESS) {
if ((ln = Lst_First(dirSearchPath)) != NULL) {
p = (Path *)Lst_Datum(ln);
@ -537,7 +537,7 @@ Dir_SetPATH(void)
static int
DirFindName(const void *p, const void *dname)
{
return (strcmp(((const Path *)p)->name, dname));
return strcmp(((const Path *)p)->name, dname);
}
/*-
@ -545,7 +545,7 @@ DirFindName(const void *p, const void *dname)
* Dir_HasWildcards --
* see if the given name has any wildcard characters in it
* be careful not to expand unmatching brackets or braces.
* XXX: This code is not 100% correct. ([^]] fails etc.)
* XXX: This code is not 100% correct. ([^]] fails etc.)
* I really don't think that make(1) should be expanding
* patterns, because then you have to set a mechanism for
* escaping the expansion!
@ -644,7 +644,7 @@ DirMatchFiles(const char *pattern, Path *p, Lst expansions)
STR_ADDSLASH)));
}
}
return (0);
return 0;
}
/*-
@ -947,7 +947,7 @@ Dir_Expand(const char *word, Lst path, Lst expansions)
*-----------------------------------------------------------------------
*/
static char *
DirLookup(Path *p, const char *name MAKE_ATTR_UNUSED, const char *cp,
DirLookup(Path *p, const char *name MAKE_ATTR_UNUSED, const char *cp,
Boolean hasSlash MAKE_ATTR_UNUSED)
{
char *file; /* the current filename to check */
@ -1004,7 +1004,7 @@ DirLookupSubdir(Path *p, const char *name)
if (cached_stat(file, &stb) == 0) {
nearmisses += 1;
return (file);
return file;
}
free(file);
return NULL;
@ -1061,7 +1061,7 @@ DirLookupAbs(Path *p, const char *name, const char *cp)
if (DEBUG(DIR)) {
fprintf(debug_file, " returning %s\n", name);
}
return (bmake_strdup(name));
return bmake_strdup(name);
}
/*-
@ -1087,7 +1087,7 @@ DirFindDot(Boolean hasSlash MAKE_ATTR_UNUSED, const char *name, const char *cp)
}
hits += 1;
dot->hits += 1;
return (bmake_strdup(name));
return bmake_strdup(name);
}
if (cur &&
Hash_FindEntry(&cur->files, cp) != NULL) {
@ -1185,7 +1185,7 @@ Dir_FindFile(const char *name, Lst path)
* is found, we concatenate the directory name and the final
* component and return the resulting string. If we don't find any
* such thing, we go on to phase two...
*
*
* No matter what, we always look for the file in the current
* directory before anywhere else (unless we found the magic
* DOTLAST path, in which case we search it last) and we *do not*
@ -1384,7 +1384,7 @@ Dir_FindFile(const char *name, Lst path)
}
if (Hash_FindEntry(&p->files, cp) != NULL) {
return (bmake_strdup(name));
return bmake_strdup(name);
} else {
return NULL;
}
@ -1395,7 +1395,7 @@ Dir_FindFile(const char *name, Lst path)
bigmisses += 1;
if (cached_stat(name, &stb) == 0) {
return (bmake_strdup(name));
return bmake_strdup(name);
}
if (DEBUG(DIR)) {
@ -1409,14 +1409,14 @@ Dir_FindFile(const char *name, Lst path)
/*-
*-----------------------------------------------------------------------
* Dir_FindHereOrAbove --
* search for a path starting at a given directory and then working
* search for a path starting at a given directory and then working
* our way up towards the root.
*
* Input:
* here starting directory
* search_path the path we are looking for
* result the result of a successful search is placed here
* rlen the length of the result buffer
* rlen the length of the result buffer
* (typically MAXPATHLEN + 1)
*
* Results:
@ -1426,7 +1426,7 @@ Dir_FindFile(const char *name, Lst path)
* Side Effects:
*-----------------------------------------------------------------------
*/
int
int
Dir_FindHereOrAbove(char *here, char *search_path, char *result, int rlen) {
struct stat st;
@ -1451,7 +1451,7 @@ Dir_FindHereOrAbove(char *here, char *search_path, char *result, int rlen) {
try_end = try + strlen(try);
while (try_end > try && *try_end != '/')
try_end--;
if (try_end > try)
if (try_end > try)
*try_end = 0; /* chop! */
}
@ -1459,10 +1459,10 @@ Dir_FindHereOrAbove(char *here, char *search_path, char *result, int rlen) {
* done!
*/
snprintf(result, rlen, "%s", try);
return(1);
return 1;
}
/*
/*
* nope, we didn't find it. if we used up dirbase we've
* reached the root and failed.
*/
@ -1479,9 +1479,9 @@ Dir_FindHereOrAbove(char *here, char *search_path, char *result, int rlen) {
} /* while (1) */
/*
* we failed...
* we failed...
*/
return(0);
return 0;
}
/*-
@ -1529,7 +1529,7 @@ Dir_MTime(GNode *gn, Boolean recheck)
* see if we can find it via the current .PATH
*/
cp++;
fullName = Dir_FindFile(cp, Suff_FindPath(gn));
if (fullName) {
/*
@ -1572,7 +1572,7 @@ Dir_MTime(GNode *gn, Boolean recheck)
}
gn->mtime = stb.st_mtime;
return (gn->mtime);
return gn->mtime;
}
/*-
@ -1677,7 +1677,7 @@ Dir_CopyDir(void *p)
{
((Path *)p)->refCount += 1;
return (p);
return p;
}
/*-
@ -1722,7 +1722,7 @@ Dir_MakeFlags(const char *flag, Lst path)
Lst_Close(path);
}
return (str);
return str;
}
/*-

View File

@ -1,4 +1,4 @@
/* $NetBSD: filemon_dev.c,v 1.1 2020/01/19 19:49:37 riastradh Exp $ */
/* $NetBSD: filemon_dev.c,v 1.3 2020/07/10 15:53:30 sjg Exp $ */
/*-
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@ filemon_open(void)
return NULL;
/* Try opening /dev/filemon, up to six times (cargo cult!). */
for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR)) == -1; i++) {
for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR|O_CLOEXEC)) == -1; i++) {
if (i == 5) {
error = errno;
goto fail0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $ */
/* $NetBSD: for.c,v 1.54 2020/07/03 08:13:23 rillig Exp $ */
/*
* Copyright (c) 1992, The Regents of the University of California.
@ -30,14 +30,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $";
static char rcsid[] = "$NetBSD: for.c,v 1.54 2020/07/03 08:13:23 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $");
__RCSID("$NetBSD: for.c,v 1.54 2020/07/03 08:13:23 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -224,7 +224,7 @@ For_Eval(char *line)
words = brk_string(sub, &nwords, FALSE, &word_buf);
free(sub);
if (words != NULL) {
for (n = 0; n < nwords; n++) {
ptr = words[n];
@ -480,9 +480,9 @@ For_Iterate(void *v_arg, size_t *ret_len)
void
For_Run(int lineno)
{
{
For *arg;
arg = accumFor;
accumFor = NULL;
@ -491,6 +491,6 @@ For_Run(int lineno)
For_Free(arg);
return;
}
Parse_SetInput(NULL, lineno, -1, For_Iterate, arg);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $ */
/* $NetBSD: hash.c,v 1.22 2020/07/03 17:03:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $";
static char rcsid[] = "$NetBSD: hash.c,v 1.22 2020/07/03 17:03:09 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $");
__RCSID("$NetBSD: hash.c,v 1.22 2020/07/03 17:03:09 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -229,7 +229,7 @@ Hash_FindEntry(Hash_Table *t, const char *key)
p = key;
for (e = t->bucketPtr[h & t->mask]; e != NULL; e = e->next)
if (e->namehash == h && strcmp(e->name, p) == 0)
return (e);
return e;
return NULL;
}
@ -279,7 +279,7 @@ Hash_CreateEntry(Hash_Table *t, const char *key, Boolean *newPtr)
if (e->namehash == h && strcmp(e->name, p) == 0) {
if (newPtr != NULL)
*newPtr = FALSE;
return (e);
return e;
}
}
@ -301,7 +301,7 @@ Hash_CreateEntry(Hash_Table *t, const char *key, Boolean *newPtr)
if (newPtr != NULL)
*newPtr = TRUE;
return (e);
return e;
}
/*
@ -418,7 +418,7 @@ Hash_EnumNext(Hash_Search *searchPtr)
e = t->bucketPtr[searchPtr->nextIndex++];
}
searchPtr->hashEntryPtr = e;
return (e);
return e;
}
/*
@ -464,3 +464,14 @@ RebuildTable(Hash_Table *t)
}
free(oldhp);
}
void Hash_ForEach(Hash_Table *t, void (*action)(void *, void *), void *data)
{
Hash_Search search;
Hash_Entry *e;
for (e = Hash_EnumFirst(t, &search);
e != NULL;
e = Hash_EnumNext(&search))
action(Hash_GetValue(e), data);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.h,v 1.12 2017/05/31 21:07:03 maya Exp $ */
/* $NetBSD: hash.h,v 1.13 2020/07/03 17:03:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -145,5 +145,6 @@ Hash_Entry *Hash_CreateEntry(Hash_Table *, const char *, Boolean *);
void Hash_DeleteEntry(Hash_Table *, Hash_Entry *);
Hash_Entry *Hash_EnumFirst(Hash_Table *, Hash_Search *);
Hash_Entry *Hash_EnumNext(Hash_Search *);
void Hash_ForEach(Hash_Table *, void (*)(void *, void *), void *);
#endif /* _HASH_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $ */
/* $NetBSD: job.c,v 1.201 2020/07/03 08:13:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $";
static char rcsid[] = "$NetBSD: job.c,v 1.201 2020/07/03 08:13:23 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $");
__RCSID("$NetBSD: job.c,v 1.201 2020/07/03 08:13:23 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -290,7 +290,7 @@ static Shell shells[] = {
"",
},
/*
* KSH description.
* KSH description.
*/
{
"ksh",
@ -463,7 +463,7 @@ JobCreatePipe(Job *job, int minfd)
job->jobPipe[i] = fd;
}
}
/* Set close-on-exec flag for both */
if (fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC) == -1)
Punt("Cannot set close-on-exec: %s", strerror(errno));
@ -473,7 +473,7 @@ JobCreatePipe(Job *job, int minfd)
/*
* We mark the input side of the pipe non-blocking; we poll(2) the
* pipe when we're waiting for a job token, but we might lose the
* race for the token when a new one becomes available, so the read
* race for the token when a new one becomes available, so the read
* from the pipe should not block.
*/
flags = fcntl(job->jobPipe[0], F_GETFL, 0);
@ -796,7 +796,7 @@ JobPrintCommand(void *cmdp, void *jobp)
/*
* If the shell doesn't have error control the alternate echo'ing will
* be done (to avoid showing additional error checking code)
* be done (to avoid showing additional error checking code)
* and this will need the characters '$ ` \ "' escaped
*/
@ -804,10 +804,10 @@ JobPrintCommand(void *cmdp, void *jobp)
/* Worst that could happen is every char needs escaping. */
escCmd = bmake_malloc((strlen(cmd) * 2) + 1);
for (i = 0, j= 0; cmd[i] != '\0'; i++, j++) {
if (cmd[i] == '$' || cmd[i] == '`' || cmd[i] == '\\' ||
if (cmd[i] == '$' || cmd[i] == '`' || cmd[i] == '\\' ||
cmd[i] == '"')
escCmd[j++] = '\\';
escCmd[j] = cmd[i];
escCmd[j] = cmd[i];
}
escCmd[j] = 0;
}
@ -880,13 +880,13 @@ JobPrintCommand(void *cmdp, void *jobp)
}
} else {
/*
/*
* If errors are being checked and the shell doesn't have error control
* but does supply an errOut template, then setup commands to run
* through it.
*/
if (!commandShell->hasErrCtl && commandShell->errOut &&
if (!commandShell->hasErrCtl && commandShell->errOut &&
(*commandShell->errOut != '\0')) {
if (!(job->flags & JOB_SILENT) && !shutUp) {
if (commandShell->hasEchoCtl) {
@ -910,7 +910,7 @@ JobPrintCommand(void *cmdp, void *jobp)
DBPRINTF("set -%s\n", "x");
job->flags |= JOB_TRACED;
}
DBPRINTF(cmdTemplate, cmd);
free(cmdStart);
free(escCmd);
@ -951,7 +951,7 @@ JobSaveCommand(void *cmd, void *gn)
{
cmd = Var_Subst(NULL, (char *)cmd, (GNode *)gn, VARF_WANTRES);
(void)Lst_AtEnd(postCommands->commands, cmd);
return(0);
return 0;
}
@ -1074,10 +1074,11 @@ JobFinish (Job *job, WAIT_T status)
meta_job_error(job, job->node, job->flags, WEXITSTATUS(status));
}
#endif
(void)printf("*** [%s] Error code %d%s\n",
job->node->name,
WEXITSTATUS(status),
(job->flags & JOB_IGNERR) ? " (ignored)" : "");
if (!dieQuietly(job->node, -1))
(void)printf("*** [%s] Error code %d%s\n",
job->node->name,
WEXITSTATUS(status),
(job->flags & JOB_IGNERR) ? " (ignored)" : "");
if (job->flags & JOB_IGNERR) {
WAIT_STATUS(status) = 0;
} else {
@ -1117,7 +1118,7 @@ JobFinish (Job *job, WAIT_T status)
}
}
#endif
return_job_token = FALSE;
Trace_Log(JOBEND, job);
@ -1289,7 +1290,7 @@ Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
* .DEFAULT itself.
*/
Make_HandleUse(DEFAULT, gn);
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn, 0);
Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), gn);
free(p1);
} else if (Dir_MTime(gn, 0) == 0 && (gn->type & OP_SPECIAL) == 0) {
/*
@ -1435,7 +1436,7 @@ JobExec(Job *job, char **argv)
_exit(1);
}
}
/*
* Set up the child's output to be routed through the pipe
* we've created for it.
@ -1784,7 +1785,7 @@ JobStart(GNode *gn, int flags)
JobCreatePipe(job, 3);
JobExec(job, argv);
return(JOB_RUNNING);
return JOB_RUNNING;
}
static char *
@ -2276,11 +2277,11 @@ Shell_GetNewline(void)
void
Job_SetPrefix(void)
{
if (targPrefix) {
free(targPrefix);
} else if (!Var_Exists(MAKE_JOB_PREFIX, VAR_GLOBAL)) {
Var_Set(MAKE_JOB_PREFIX, "---", VAR_GLOBAL, 0);
Var_Set(MAKE_JOB_PREFIX, "---", VAR_GLOBAL);
}
targPrefix = Var_Subst(NULL, "${" MAKE_JOB_PREFIX "}",
@ -2432,7 +2433,7 @@ JobMatchShell(const char *name)
for (sh = shells; sh->name != NULL; sh++) {
if (strcmp(name, sh->name) == 0)
return (sh);
return sh;
}
return NULL;
}
@ -2548,7 +2549,7 @@ Job_ParseShell(char *line)
Parse_Error(PARSE_FATAL, "Unknown keyword \"%s\"",
*argv);
free(words);
return(FAILURE);
return FAILURE;
}
fullSpec = TRUE;
}
@ -2564,13 +2565,13 @@ Job_ParseShell(char *line)
if (newShell.name == NULL) {
Parse_Error(PARSE_FATAL, "Neither path nor name specified");
free(words);
return(FAILURE);
return FAILURE;
} else {
if ((sh = JobMatchShell(newShell.name)) == NULL) {
Parse_Error(PARSE_WARNING, "%s: No matching shell",
newShell.name);
free(words);
return(FAILURE);
return FAILURE;
}
commandShell = sh;
shellName = newShell.name;
@ -2606,7 +2607,7 @@ Job_ParseShell(char *line)
Parse_Error(PARSE_WARNING, "%s: No matching shell",
shellName);
free(words);
return(FAILURE);
return FAILURE;
}
commandShell = sh;
} else {
@ -2723,7 +2724,7 @@ Job_Finish(void)
JobRun(postCommands);
}
}
return(errors);
return errors;
}
/*-
@ -2968,7 +2969,7 @@ Job_ServerStart(int max_tokens, int jp_0, int jp_1)
{
int i;
char jobarg[64];
if (jp_0 >= 0 && jp_1 >= 0) {
/* Pipe passed in from parent */
tokenWaitJob.inPipe = jp_0;
@ -2984,12 +2985,12 @@ Job_ServerStart(int max_tokens, int jp_0, int jp_1)
tokenWaitJob.inPipe, tokenWaitJob.outPipe);
Var_Append(MAKEFLAGS, "-J", VAR_GLOBAL);
Var_Append(MAKEFLAGS, jobarg, VAR_GLOBAL);
Var_Append(MAKEFLAGS, jobarg, VAR_GLOBAL);
/*
* Preload the job pipe with one token per job, save the one
* "extra" token for the primary job.
*
*
* XXX should clip maxJobs against PIPE_BUF -- if max_tokens is
* larger than the write buffer size of the pipe, we will
* deadlock here.
@ -3068,6 +3069,8 @@ Job_TokenWithdraw(void)
/* And put the stopper back */
while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN)
continue;
if (dieQuietly(NULL, 1))
exit(2);
Fatal("A failure has been detected in another branch of the parallel make");
}
@ -3104,7 +3107,7 @@ Job_RunTarget(const char *target, const char *fname) {
return FALSE;
if (fname)
Var_Set(ALLSRC, fname, gn, 0);
Var_Set(ALLSRC, fname, gn);
JobRun(gn);
if (gn->made == ERROR) {
@ -3139,9 +3142,9 @@ emul_poll(struct pollfd *fd, int nfd, int timeout)
if (fd[i].fd > maxfd)
maxfd = fd[i].fd;
}
if (maxfd >= FD_SETSIZE) {
Punt("Ran out of fd_set slots; "
Punt("Ran out of fd_set slots; "
"recompile with a larger FD_SETSIZE.");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.h,v 1.42 2013/07/05 22:14:56 sjg Exp $ */
/* $NetBSD: job.h,v 1.43 2020/07/03 08:13:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -106,7 +106,7 @@ emul_poll(struct pollfd *fd, int nfd, int timeout);
/*
* The POLL_MSEC constant determines the maximum number of milliseconds spent
* in poll before coming out to see if a child has finished.
* in poll before coming out to see if a child has finished.
*/
#define POLL_MSEC 5000
@ -203,11 +203,11 @@ typedef struct Job {
* a case, errCheck becomes a printf template for echoing the command,
* should echoing be on and ignErr becomes another printf template for
* executing the command while ignoring the return status. Finally errOut
* is a printf template for running the command and causing the shell to
* exit on error. If any of these strings are empty when hasErrCtl is FALSE,
* the command will be executed anyway as is and if it causes an error, so be
* is a printf template for running the command and causing the shell to
* exit on error. If any of these strings are empty when hasErrCtl is FALSE,
* the command will be executed anyway as is and if it causes an error, so be
* it. Any templates setup to echo the command will escape any '$ ` \ "'i
* characters in the command string to avoid common problems with
* characters in the command string to avoid common problems with
* echo "%s\n" as a template.
*/
typedef struct Shell {

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstAppend.c,v 1.14 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstAppend.c,v 1.15 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstAppend.c,v 1.14 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstAppend.c,v 1.15 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstAppend.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstAppend.c,v 1.14 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstAppend.c,v 1.15 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -85,7 +85,7 @@ Lst_InsertAfter(Lst l, LstNode ln, void *d)
}
if (!LstValid (l) || LstIsEmpty (l) || ! LstNodeValid (ln, l)) {
return (FAILURE);
return FAILURE;
}
ok:
@ -117,6 +117,5 @@ Lst_InsertAfter(Lst l, LstNode ln, void *d)
}
}
return (SUCCESS);
return SUCCESS;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstAtEnd.c,v 1.13 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstAtEnd.c,v 1.14 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstAtEnd.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstAtEnd.c,v 1.14 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstAtEnd.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstAtEnd.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstAtEnd.c,v 1.14 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -75,5 +75,5 @@ Lst_AtEnd(Lst l, void *d)
LstNode end;
end = Lst_Last(l);
return (Lst_InsertAfter(l, end, d));
return Lst_InsertAfter(l, end, d);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstAtFront.c,v 1.13 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstAtFront.c,v 1.14 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstAtFront.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstAtFront.c,v 1.14 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstAtFront.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstAtFront.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstAtFront.c,v 1.14 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -72,5 +72,5 @@ Lst_AtFront(Lst l, void *d)
LstNode front;
front = Lst_First(l);
return (Lst_InsertBefore(l, front, d));
return Lst_InsertBefore(l, front, d);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstClose.c,v 1.11 2006/10/27 21:37:25 dsl Exp $ */
/* $NetBSD: lstClose.c,v 1.12 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstClose.c,v 1.11 2006/10/27 21:37:25 dsl Exp $";
static char rcsid[] = "$NetBSD: lstClose.c,v 1.12 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstClose.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstClose.c,v 1.11 2006/10/27 21:37:25 dsl Exp $");
__RCSID("$NetBSD: lstClose.c,v 1.12 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -83,4 +83,3 @@ Lst_Close(Lst l)
list->atEnd = Unknown;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstConcat.c,v 1.16 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstConcat.c,v 1.17 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstConcat.c,v 1.16 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstConcat.c,v 1.17 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstConcat.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstConcat.c,v 1.16 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstConcat.c,v 1.17 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -86,7 +86,7 @@ Lst_Concat(Lst l1, Lst l2, int flags)
List list2 = l2;
if (!LstValid (l1) || !LstValid (l2)) {
return (FAILURE);
return FAILURE;
}
if (flags == LST_CONCLINK) {
@ -180,6 +180,5 @@ Lst_Concat(Lst l1, Lst l2, int flags)
}
}
return (SUCCESS);
return SUCCESS;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstDatum.c,v 1.13 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstDatum.c,v 1.14 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstDatum.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstDatum.c,v 1.14 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstDatum.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstDatum.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstDatum.c,v 1.14 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -69,9 +69,8 @@ void *
Lst_Datum(LstNode ln)
{
if (ln != NULL) {
return ((ln)->datum);
return ln->datum;
} else {
return NULL;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstDeQueue.c,v 1.14 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstDeQueue.c,v 1.15 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstDeQueue.c,v 1.14 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstDeQueue.c,v 1.15 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstDeQueue.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstDeQueue.c,v 1.14 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstDeQueue.c,v 1.15 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -81,7 +81,6 @@ Lst_DeQueue(Lst l)
if (Lst_Remove(l, tln) == FAILURE) {
return NULL;
} else {
return (rd);
return rd;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstDupl.c,v 1.16 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstDupl.c,v 1.17 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstDupl.c,v 1.16 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstDupl.c,v 1.17 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstDupl.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstDupl.c,v 1.16 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstDupl.c,v 1.17 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -103,5 +103,5 @@ Lst_Duplicate(Lst l, DuplicateProc *copyProc)
}
}
return (nl);
return nl;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstEnQueue.c,v 1.13 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstEnQueue.c,v 1.14 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstEnQueue.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstEnQueue.c,v 1.14 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstEnQueue.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstEnQueue.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstEnQueue.c,v 1.14 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -70,9 +70,8 @@ ReturnStatus
Lst_EnQueue(Lst l, void *d)
{
if (LstValid (l) == FALSE) {
return (FAILURE);
return FAILURE;
}
return (Lst_InsertAfter(l, Lst_Last(l), d));
return Lst_InsertAfter(l, Lst_Last(l), d);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstFind.c,v 1.15 2009/01/23 21:58:28 dsl Exp $ */
/* $NetBSD: lstFind.c,v 1.16 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstFind.c,v 1.15 2009/01/23 21:58:28 dsl Exp $";
static char rcsid[] = "$NetBSD: lstFind.c,v 1.16 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstFind.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstFind.c,v 1.15 2009/01/23 21:58:28 dsl Exp $");
__RCSID("$NetBSD: lstFind.c,v 1.16 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -69,6 +69,5 @@ __RCSID("$NetBSD: lstFind.c,v 1.15 2009/01/23 21:58:28 dsl Exp $");
LstNode
Lst_Find(Lst l, const void *d, int (*cProc)(const void *, const void *))
{
return (Lst_FindFrom(l, Lst_First(l), d, cProc));
return Lst_FindFrom(l, Lst_First(l), d, cProc);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstFindFrom.c,v 1.15 2009/01/23 21:58:28 dsl Exp $ */
/* $NetBSD: lstFindFrom.c,v 1.16 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstFindFrom.c,v 1.15 2009/01/23 21:58:28 dsl Exp $";
static char rcsid[] = "$NetBSD: lstFindFrom.c,v 1.16 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstFindFrom.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstFindFrom.c,v 1.15 2009/01/23 21:58:28 dsl Exp $");
__RCSID("$NetBSD: lstFindFrom.c,v 1.16 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -81,10 +81,9 @@ Lst_FindFrom(Lst l, LstNode ln, const void *d,
do {
if ((*cProc)(tln->datum, d) == 0)
return (tln);
return tln;
tln = tln->nextPtr;
} while (tln != ln && tln != NULL);
return NULL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstFirst.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstFirst.c,v 1.13 2020/07/03 08:37:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstFirst.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstFirst.c,v 1.13 2020/07/03 08:37:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstFirst.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstFirst.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstFirst.c,v 1.13 2020/07/03 08:37:56 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -71,7 +71,6 @@ Lst_First(Lst l)
if (!LstValid (l) || LstIsEmpty (l)) {
return NULL;
} else {
return (l->firstPtr);
return l->firstPtr;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstForEach.c,v 1.13 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstForEach.c,v 1.14 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstForEach.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstForEach.c,v 1.14 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstForEach.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstForEach.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstForEach.c,v 1.14 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -73,4 +73,3 @@ Lst_ForEach(Lst l, int (*proc)(void *, void *), void *d)
{
return Lst_ForEachFrom(l, Lst_First(l), proc, d);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstForEachFrom.c,v 1.17 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstForEachFrom.c,v 1.18 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstForEachFrom.c,v 1.17 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstForEachFrom.c,v 1.18 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstForEachFrom.c,v 1.17 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstForEachFrom.c,v 1.18 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -122,4 +122,3 @@ Lst_ForEachFrom(Lst l, LstNode ln, int (*proc)(void *, void *),
return result;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstInit.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstInit.c,v 1.13 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstInit.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstInit.c,v 1.13 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstInit.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstInit.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstInit.c,v 1.13 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -81,5 +81,5 @@ Lst_Init(Boolean circ)
nList->isCirc = circ;
nList->atEnd = Unknown;
return (nList);
return nList;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstInsert.c,v 1.14 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstInsert.c,v 1.15 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstInsert.c,v 1.14 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstInsert.c,v 1.15 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstInsert.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstInsert.c,v 1.14 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstInsert.c,v 1.15 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -87,7 +87,7 @@ Lst_InsertBefore(Lst l, LstNode ln, void *d)
goto ok;
if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) {
return (FAILURE);
return FAILURE;
}
ok:
@ -117,6 +117,5 @@ Lst_InsertBefore(Lst l, LstNode ln, void *d)
}
}
return (SUCCESS);
return SUCCESS;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstIsAtEnd.c,v 1.13 2008/02/15 21:29:50 christos Exp $ */
/* $NetBSD: lstIsAtEnd.c,v 1.14 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstIsAtEnd.c,v 1.13 2008/02/15 21:29:50 christos Exp $";
static char rcsid[] = "$NetBSD: lstIsAtEnd.c,v 1.14 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstIsAtEnd.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstIsAtEnd.c,v 1.13 2008/02/15 21:29:50 christos Exp $");
__RCSID("$NetBSD: lstIsAtEnd.c,v 1.14 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -81,7 +81,6 @@ Lst_IsAtEnd(Lst l)
{
List list = l;
return (!LstValid (l) || !list->isOpen ||
(list->atEnd == Head) || (list->atEnd == Tail));
return !LstValid (l) || !list->isOpen ||
list->atEnd == Head || list->atEnd == Tail;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstIsEmpty.c,v 1.11 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstIsEmpty.c,v 1.12 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstIsEmpty.c,v 1.11 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstIsEmpty.c,v 1.12 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstIsEmpty.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstIsEmpty.c,v 1.11 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstIsEmpty.c,v 1.12 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -70,6 +70,5 @@ __RCSID("$NetBSD: lstIsEmpty.c,v 1.11 2008/12/13 15:19:29 dsl Exp $");
Boolean
Lst_IsEmpty(Lst l)
{
return ( ! LstValid (l) || LstIsEmpty(l));
return !LstValid(l) || LstIsEmpty(l);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstLast.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstLast.c,v 1.13 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstLast.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstLast.c,v 1.13 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstLast.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstLast.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstLast.c,v 1.13 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -71,7 +71,6 @@ Lst_Last(Lst l)
if (!LstValid(l) || LstIsEmpty (l)) {
return NULL;
} else {
return (l->lastPtr);
return l->lastPtr;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstNext.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstNext.c,v 1.13 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstNext.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstNext.c,v 1.13 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstNext.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstNext.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstNext.c,v 1.13 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -115,6 +115,5 @@ Lst_Next(Lst l)
}
}
return (tln);
return tln;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstOpen.c,v 1.12 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstOpen.c,v 1.13 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstOpen.c,v 1.12 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstOpen.c,v 1.13 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstOpen.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstOpen.c,v 1.12 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstOpen.c,v 1.13 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -76,12 +76,11 @@ ReturnStatus
Lst_Open(Lst l)
{
if (LstValid (l) == FALSE) {
return (FAILURE);
return FAILURE;
}
(l)->isOpen = TRUE;
(l)->atEnd = LstIsEmpty (l) ? Head : Unknown;
(l)->curPtr = NULL;
return (SUCCESS);
return SUCCESS;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstPrev.c,v 1.3 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstPrev.c,v 1.4 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstPrev.c,v 1.3 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstPrev.c,v 1.4 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstSucc.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstPrev.c,v 1.3 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstPrev.c,v 1.4 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -73,7 +73,6 @@ Lst_Prev(LstNode ln)
if (ln == NULL) {
return NULL;
} else {
return (ln->prevPtr);
return ln->prevPtr;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstRemove.c,v 1.16 2014/09/07 20:55:34 joerg Exp $ */
/* $NetBSD: lstRemove.c,v 1.17 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstRemove.c,v 1.16 2014/09/07 20:55:34 joerg Exp $";
static char rcsid[] = "$NetBSD: lstRemove.c,v 1.17 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstRemove.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstRemove.c,v 1.16 2014/09/07 20:55:34 joerg Exp $");
__RCSID("$NetBSD: lstRemove.c,v 1.17 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -73,9 +73,8 @@ Lst_Remove(Lst l, LstNode ln)
List list = l;
ListNode lNode = ln;
if (!LstValid (l) ||
!LstNodeValid (ln, l)) {
return (FAILURE);
if (!LstValid (l) || !LstNodeValid (ln, l)) {
return FAILURE;
}
/*
@ -131,6 +130,5 @@ Lst_Remove(Lst l, LstNode ln)
lNode->flags |= LN_DELETED;
}
return (SUCCESS);
return SUCCESS;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstReplace.c,v 1.13 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstReplace.c,v 1.14 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstReplace.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstReplace.c,v 1.14 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstReplace.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstReplace.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstReplace.c,v 1.14 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -69,10 +69,9 @@ ReturnStatus
Lst_Replace(LstNode ln, void *d)
{
if (ln == NULL) {
return (FAILURE);
return FAILURE;
} else {
(ln)->datum = d;
return (SUCCESS);
return SUCCESS;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstSucc.c,v 1.13 2008/12/13 15:19:29 dsl Exp $ */
/* $NetBSD: lstSucc.c,v 1.14 2020/07/03 08:37:57 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstSucc.c,v 1.13 2008/12/13 15:19:29 dsl Exp $";
static char rcsid[] = "$NetBSD: lstSucc.c,v 1.14 2020/07/03 08:37:57 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstSucc.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstSucc.c,v 1.13 2008/12/13 15:19:29 dsl Exp $");
__RCSID("$NetBSD: lstSucc.c,v 1.14 2020/07/03 08:37:57 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -73,7 +73,6 @@ Lst_Succ(LstNode ln)
if (ln == NULL) {
return NULL;
} else {
return (ln->nextPtr);
return ln->nextPtr;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $ */
/* $NetBSD: main.c,v 1.279 2020/07/03 08:13:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.279 2020/07/03 08:13:23 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $");
__RCSID("$NetBSD: main.c,v 1.279 2020/07/03 08:13:23 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -245,7 +245,7 @@ explode(const char *flags)
*nf = '\0';
return st;
}
static void
parse_debug_options(const char *argvalue)
{
@ -429,7 +429,7 @@ MainParseArgs(int argc, char **argv)
/* Can't actually use getopt(3) because rescanning is not portable */
getopt_def = OPTFLAGS;
rearg:
rearg:
inOption = FALSE;
optscan = NULL;
while(argc > 1) {
@ -465,7 +465,7 @@ MainParseArgs(int argc, char **argv)
arginc = 2;
}
} else {
argvalue = NULL;
argvalue = NULL;
}
switch(c) {
case '\0':
@ -475,7 +475,7 @@ MainParseArgs(int argc, char **argv)
case 'B':
compatMake = TRUE;
Var_Append(MAKEFLAGS, "-B", VAR_GLOBAL);
Var_Set(MAKE_MODE, "compat", VAR_GLOBAL, 0);
Var_Set(MAKE_MODE, "compat", VAR_GLOBAL);
break;
case 'C':
if (chdir(argvalue) == -1) {
@ -499,7 +499,7 @@ MainParseArgs(int argc, char **argv)
break;
case 'D':
if (argvalue == NULL || argvalue[0] == 0) goto noarg;
Var_Set(argvalue, "1", VAR_GLOBAL, 0);
Var_Set(argvalue, "1", VAR_GLOBAL);
Var_Append(MAKEFLAGS, "-D", VAR_GLOBAL);
Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
break;
@ -598,7 +598,7 @@ MainParseArgs(int argc, char **argv)
}
Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);
Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
Var_Set(".MAKE.JOBS", argvalue, VAR_GLOBAL, 0);
Var_Set(".MAKE.JOBS", argvalue, VAR_GLOBAL);
maxJobTokens = maxJobs;
break;
case 'k':
@ -776,7 +776,7 @@ Main_SetObjdir(const char *fmt, ...)
path, strerror(errno));
} else {
strncpy(objdir, path, MAXPATHLEN);
Var_Set(".OBJDIR", objdir, VAR_GLOBAL, 0);
Var_Set(".OBJDIR", objdir, VAR_GLOBAL);
setenv("PWD", objdir, 1);
Dir_InitDot();
purge_cached_realpaths();
@ -822,7 +822,7 @@ Main_SetVarObjdir(const char *var, const char *suffix)
static int
ReadAllMakefiles(const void *p, const void *q)
{
return (ReadMakefile(p, q) == 0);
return ReadMakefile(p, q) == 0;
}
int
@ -838,7 +838,7 @@ str2Lst_Append(Lst lp, char *str, const char *sep)
(void)Lst_AtEnd(lp, cp);
n++;
}
return (n);
return n;
}
#ifdef SIGINFO
@ -901,14 +901,14 @@ doPrintVars(void)
char *var = (char *)Lst_Datum(ln);
char *value;
char *p1;
if (strchr(var, '$')) {
value = p1 = Var_Subst(NULL, var, VAR_GLOBAL,
VARF_WANTRES);
} else if (expandVars) {
char tmp[128];
int len = snprintf(tmp, sizeof(tmp), "${%s}", var);
if (len >= (int)sizeof(tmp))
Fatal("%s: variable name too big: %s",
progname, var);
@ -1017,7 +1017,7 @@ main(int argc, char **argv)
*/
gettimeofday(&rightnow, NULL);
srandom(rightnow.tv_sec + rightnow.tv_usec);
if ((progname = strrchr(argv[0], '/')) != NULL)
progname++;
else
@ -1067,7 +1067,7 @@ main(int argc, char **argv)
static char machine_arch_buf[sizeof(utsname.machine)];
int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
size_t len = sizeof(machine_arch_buf);
if (sysctl(mib, __arraycount(mib), machine_arch_buf,
&len, NULL, 0) < 0) {
(void)fprintf(stderr, "%s: sysctl failed (%s).\n", progname,
@ -1096,13 +1096,13 @@ main(int argc, char **argv)
*/
Var_Init(); /* Initialize the lists of variables for
* parsing arguments */
Var_Set(".MAKE.OS", utsname.sysname, VAR_GLOBAL, 0);
Var_Set("MACHINE", machine, VAR_GLOBAL, 0);
Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL, 0);
Var_Set(".MAKE.OS", utsname.sysname, VAR_GLOBAL);
Var_Set("MACHINE", machine, VAR_GLOBAL);
Var_Set("MACHINE_ARCH", machine_arch, VAR_GLOBAL);
#ifdef MAKE_VERSION
Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL, 0);
Var_Set("MAKE_VERSION", MAKE_VERSION, VAR_GLOBAL);
#endif
Var_Set(".newline", "\n", VAR_GLOBAL, 0); /* handy for :@ loops */
Var_Set(".newline", "\n", VAR_GLOBAL); /* handy for :@ loops */
/*
* This is the traditional preference for makefiles.
*/
@ -1110,8 +1110,8 @@ main(int argc, char **argv)
# define MAKEFILE_PREFERENCE_LIST "makefile Makefile"
#endif
Var_Set(MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST,
VAR_GLOBAL, 0);
Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL, 0);
VAR_GLOBAL);
Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL);
create = Lst_Init(FALSE);
makefiles = Lst_Init(FALSE);
@ -1165,14 +1165,14 @@ main(int argc, char **argv)
p1 = argv[0]; /* realpath failed */
}
}
Var_Set("MAKE", p1, VAR_GLOBAL, 0);
Var_Set(".MAKE", p1, VAR_GLOBAL, 0);
Var_Set(MAKEFLAGS, "", VAR_GLOBAL, 0);
Var_Set(MAKEOVERRIDES, "", VAR_GLOBAL, 0);
Var_Set("MFLAGS", "", VAR_GLOBAL, 0);
Var_Set(".ALLTARGETS", "", VAR_GLOBAL, 0);
Var_Set("MAKE", p1, VAR_GLOBAL);
Var_Set(".MAKE", p1, VAR_GLOBAL);
Var_Set(MAKEFLAGS, "", VAR_GLOBAL);
Var_Set(MAKEOVERRIDES, "", VAR_GLOBAL);
Var_Set("MFLAGS", "", VAR_GLOBAL);
Var_Set(".ALLTARGETS", "", VAR_GLOBAL);
/* some makefiles need to know this */
Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMD, 0);
Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMD);
/*
* Set some other useful macros
@ -1184,11 +1184,11 @@ main(int argc, char **argv)
if (makelevel < 0)
makelevel = 0;
snprintf(tmp, sizeof(tmp), "%d", makelevel);
Var_Set(MAKE_LEVEL, tmp, VAR_GLOBAL, 0);
Var_Set(MAKE_LEVEL, tmp, VAR_GLOBAL);
snprintf(tmp, sizeof(tmp), "%u", myPid);
Var_Set(".MAKE.PID", tmp, VAR_GLOBAL, 0);
Var_Set(".MAKE.PID", tmp, VAR_GLOBAL);
snprintf(tmp, sizeof(tmp), "%u", getppid());
Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL, 0);
Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL);
}
if (makelevel > 0) {
char pn[1024];
@ -1269,7 +1269,7 @@ main(int argc, char **argv)
free(ptmp2);
}
#endif
Var_Set(".CURDIR", curdir, VAR_GLOBAL, 0);
Var_Set(".CURDIR", curdir, VAR_GLOBAL);
/*
* Find the .OBJDIR. If MAKEOBJDIRPREFIX, or failing that,
@ -1303,7 +1303,7 @@ main(int argc, char **argv)
(void)time(&now);
Trace_Log(MAKESTART, NULL);
/*
* Set up the .TARGETS variable to contain the list of targets to be
* created. If none specified, make the variable empty -- the parser
@ -1319,7 +1319,7 @@ main(int argc, char **argv)
Var_Append(".TARGETS", name, VAR_GLOBAL);
}
} else
Var_Set(".TARGETS", "", VAR_GLOBAL, 0);
Var_Set(".TARGETS", "", VAR_GLOBAL);
/*
@ -1342,7 +1342,7 @@ main(int argc, char **argv)
if (strncmp(".../", start, 4) != 0) {
(void)Dir_AddDir(defIncPath, start);
} else {
if (Dir_FindHereOrAbove(curdir, start+4,
if (Dir_FindHereOrAbove(curdir, start+4,
found_path, sizeof(found_path))) {
(void)Dir_AddDir(defIncPath, found_path);
}
@ -1377,7 +1377,7 @@ main(int argc, char **argv)
ln = Lst_Find(makefiles, NULL, ReadAllMakefiles);
if (ln != NULL)
Fatal("%s: cannot open %s.", progname,
Fatal("%s: cannot open %s.", progname,
(char *)Lst_Datum(ln));
} else {
p1 = Var_Subst(NULL, "${" MAKEFILE_PREFERENCE "}",
@ -1400,7 +1400,7 @@ main(int argc, char **argv)
if (enterFlagObj)
printf("%s: Entering directory `%s'\n", progname, objdir);
MakeMode(NULL);
Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL);
@ -1444,7 +1444,8 @@ main(int argc, char **argv)
if (!printVars)
Main_ExportMAKEFLAGS(TRUE); /* initial export */
/*
* For compatibility, look at the directories in the VPATH variable
* and add them to the search path, if the variable is defined. The
@ -1552,21 +1553,21 @@ ReadMakefile(const void *p, const void *q MAKE_ATTR_UNUSED)
if (!strcmp(fname, "-")) {
Parse_File(NULL /*stdin*/, -1);
Var_Set("MAKEFILE", "", VAR_INTERNAL, 0);
Var_Set("MAKEFILE", "", VAR_INTERNAL);
} else {
/* if we've chdir'd, rebuild the path name */
if (strcmp(curdir, objdir) && *fname != '/') {
size_t plen = strlen(curdir) + strlen(fname) + 2;
if (len < plen)
path = bmake_realloc(path, len = 2 * plen);
(void)snprintf(path, len, "%s/%s", curdir, fname);
fd = open(path, O_RDONLY);
if (fd != -1) {
fname = path;
goto found;
}
/* If curdir failed, try objdir (ala .depend) */
plen = strlen(objdir) + strlen(fname) + 2;
if (len < plen)
@ -1590,7 +1591,7 @@ ReadMakefile(const void *p, const void *q MAKE_ATTR_UNUSED)
if (!name || (fd = open(name, O_RDONLY)) == -1) {
free(name);
free(path);
return(-1);
return -1;
}
fname = name;
/*
@ -1600,11 +1601,11 @@ ReadMakefile(const void *p, const void *q MAKE_ATTR_UNUSED)
*/
found:
if (!doing_depend)
Var_Set("MAKEFILE", fname, VAR_INTERNAL, 0);
Var_Set("MAKEFILE", fname, VAR_INTERNAL);
Parse_File(fname, fd);
}
free(path);
return(0);
return 0;
}
@ -1889,6 +1890,8 @@ void
Finish(int errors)
/* number of errors encountered in Make_Make */
{
if (dieQuietly(NULL, -1))
exit(2);
Fatal("%d error%s", errors, errors == 1 ? "" : "s");
}
@ -2018,8 +2021,9 @@ cached_realpath(const char *pathname, char *resolved)
/* a hit */
strlcpy(resolved, rp, MAXPATHLEN);
} else if ((rp = realpath(pathname, resolved)) != NULL) {
Var_Set(pathname, rp, cache, 0);
}
Var_Set(pathname, rp, cache);
} /* else should we negative-cache? */
free(cp);
return rp ? resolved : NULL;
}
@ -2041,6 +2045,27 @@ addErrorCMD(void *cmdp, void *gnp MAKE_ATTR_UNUSED)
return 0;
}
/*
* Return true if we should die without noise.
* For example our failing child was a sub-make
* or failure happend elsewhere.
*/
int
dieQuietly(GNode *gn, int bf)
{
static int quietly = -1;
if (quietly < 0) {
if (DEBUG(JOB) || getBoolean(".MAKE.DIE_QUIETLY", 1) == 0)
quietly = 0;
else if (bf >= 0)
quietly = bf;
else
quietly = (gn) ? ((gn->type & (OP_MAKE)) != 0) : 0;
}
return quietly;
}
void
PrintOnError(GNode *gn, const char *s)
{
@ -2048,9 +2073,13 @@ PrintOnError(GNode *gn, const char *s)
char tmp[64];
char *cp;
/* we generally want to keep quiet if a sub-make died */
if (dieQuietly(gn, -1))
return;
if (s)
printf("%s", s);
printf("\n%s: stopped in %s\n", progname, curdir);
if (en)
@ -2059,7 +2088,7 @@ PrintOnError(GNode *gn, const char *s)
/*
* We can print this even if there is no .ERROR target.
*/
Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL, 0);
Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL);
Var_Delete(".ERROR_CMD", VAR_GLOBAL);
Lst_ForEach(gn->commands, addErrorCMD, gn);
}
@ -2093,7 +2122,7 @@ Main_ExportMAKEFLAGS(Boolean first)
if (once != first)
return;
once = 0;
strncpy(tmp, "${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}",
sizeof(tmp));
s = Var_Subst(NULL, tmp, VAR_CMD, VARF_WANTRES);
@ -2139,7 +2168,7 @@ mkTempFile(const char *pattern, char **fnamep)
static char *tmpdir = NULL;
char tfile[MAXPATHLEN];
int fd;
if (!pattern)
pattern = TMPPAT;
if (!tmpdir)
@ -2195,7 +2224,7 @@ s2Boolean(const char *s, Boolean bf)
break;
}
}
return (bf);
return bf;
}
/*
@ -2219,5 +2248,5 @@ getBoolean(const char *name, Boolean bf)
free(cp);
}
}
return (bf);
return bf;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $ */
/* $NetBSD: make.c,v 1.99 2020/07/03 08:13:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $";
static char rcsid[] = "$NetBSD: make.c,v 1.99 2020/07/03 08:13:23 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $");
__RCSID("$NetBSD: make.c,v 1.99 2020/07/03 08:13:23 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -175,7 +175,7 @@ Make_TimeStamp(GNode *pgn, GNode *cgn)
if (pgn->cmgn == NULL || cgn->mtime > pgn->cmgn->mtime) {
pgn->cmgn = cgn;
}
return (0);
return 0;
}
/*
@ -264,7 +264,7 @@ Make_OODate(GNode *gn)
* always out of date if no children and :: target
* or non-existent.
*/
oodate = (gn->mtime == 0 || Arch_LibOODate(gn) ||
oodate = (gn->mtime == 0 || Arch_LibOODate(gn) ||
(gn->cmgn == NULL && (gn->type & OP_DOUBLEDEP)));
} else if (gn->type & OP_JOIN) {
/*
@ -317,7 +317,7 @@ Make_OODate(GNode *gn)
}
oodate = TRUE;
} else {
/*
/*
* When a non-existing child with no sources
* (such as a typically used FORCE source) has been made and
* the target of the child (usually a directory) has the same
@ -348,7 +348,7 @@ Make_OODate(GNode *gn)
Lst_ForEach(gn->parents, MakeTimeStamp, gn);
}
return (oodate);
return oodate;
}
/*-
@ -380,7 +380,7 @@ MakeAddChild(void *gnp, void *lp)
gn->name, gn->cohort_num);
(void)Lst_EnQueue(l, gn);
}
return (0);
return 0;
}
/*-
@ -410,7 +410,7 @@ MakeFindChild(void *gnp, void *pgnp)
Make_TimeStamp(pgn, gn);
pgn->unmade--;
return (0);
return 0;
}
/*-
@ -535,7 +535,7 @@ MakeHandleUse(void *cgnp, void *pgnp)
cgn->type |= OP_MARK;
if ((cgn->type & (OP_USE|OP_USEBEFORE)) == 0)
return (0);
return 0;
if (unmarked)
Make_HandleUse(cgn, pgn);
@ -551,7 +551,7 @@ MakeHandleUse(void *cgnp, void *pgnp)
Lst_Remove(pgn->children, ln);
pgn->unmade--;
}
return (0);
return 0;
}
@ -831,9 +831,9 @@ Make_Update(GNode *cgn)
while ((ln = Lst_Next(cgn->iParents)) != NULL) {
pgn = (GNode *)Lst_Datum(ln);
if (pgn->flags & REMAKE) {
Var_Set(IMPSRC, cname, pgn, 0);
Var_Set(IMPSRC, cname, pgn);
if (cpref != NULL)
Var_Set(PREFIX, cpref, pgn, 0);
Var_Set(PREFIX, cpref, pgn);
}
}
free(p1);
@ -869,7 +869,7 @@ MakeUnmark(void *cgnp, void *pgnp MAKE_ATTR_UNUSED)
GNode *cgn = (GNode *)cgnp;
cgn->type &= ~OP_MARK;
return (0);
return 0;
}
/*
@ -886,7 +886,7 @@ MakeAddAllSrc(void *cgnp, void *pgnp)
GNode *pgn = (GNode *)pgnp;
if (cgn->type & OP_MARK)
return (0);
return 0;
cgn->type |= OP_MARK;
if ((cgn->type & (OP_EXEC|OP_USE|OP_USEBEFORE|OP_INVISIBLE)) == 0) {
@ -932,7 +932,7 @@ MakeAddAllSrc(void *cgnp, void *pgnp)
}
free(p1);
}
return (0);
return 0;
}
/*-
@ -962,20 +962,20 @@ Make_DoAllVar(GNode *gn)
{
if (gn->flags & DONE_ALLSRC)
return;
Lst_ForEach(gn->children, MakeUnmark, gn);
Lst_ForEach(gn->children, MakeAddAllSrc, gn);
if (!Var_Exists (OODATE, gn)) {
Var_Set(OODATE, "", gn, 0);
Var_Set(OODATE, "", gn);
}
if (!Var_Exists (ALLSRC, gn)) {
Var_Set(ALLSRC, "", gn, 0);
Var_Set(ALLSRC, "", gn);
}
if (gn->type & OP_JOIN) {
char *p1;
Var_Set(TARGET, Var_Value(ALLSRC, gn, &p1), gn, 0);
Var_Set(TARGET, Var_Value(ALLSRC, gn, &p1), gn);
free(p1);
}
gn->flags |= DONE_ALLSRC;
@ -1119,7 +1119,7 @@ MakeStartJobs(void)
fprintf(debug_file, "out-of-date\n");
}
if (queryFlag) {
return (TRUE);
return TRUE;
}
Make_DoAllVar(gn);
Job_Make(gn);
@ -1145,7 +1145,7 @@ MakeStartJobs(void)
if (have_token)
Job_TokenReturn();
return (FALSE);
return FALSE;
}
/*-
@ -1293,7 +1293,7 @@ Make_ExpandUse(Lst targs)
*/
while (!Lst_IsEmpty (examine)) {
gn = (GNode *)Lst_DeQueue(examine);
if (gn->flags & REMAKE)
/* We've looked at this one already */
continue;
@ -1324,14 +1324,14 @@ Make_ExpandUse(Lst targs)
continue;
*eoa = '\0';
*eon = '\0';
Var_Set(MEMBER, eoa + 1, gn, 0);
Var_Set(ARCHIVE, gn->name, gn, 0);
Var_Set(MEMBER, eoa + 1, gn);
Var_Set(ARCHIVE, gn->name, gn);
*eoa = '(';
*eon = ')';
}
(void)Dir_MTime(gn, 0);
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn, 0);
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn);
Lst_ForEach(gn->children, MakeUnmark, gn);
Lst_ForEach(gn->children, MakeHandleUse, gn);
@ -1429,7 +1429,7 @@ Make_ProcessWait(Lst targs)
while (!Lst_IsEmpty (examine)) {
pgn = Lst_DeQueue(examine);
/* We only want to process each child-list once */
if (pgn->flags & DONE_WAIT)
continue;
@ -1509,7 +1509,7 @@ Make_Run(Lst targs)
* next loop... (we won't actually start any, of course, this is just
* to see if any of the targets was out of date)
*/
return (MakeStartJobs());
return MakeStartJobs();
}
/*
* Initialization. At the moment, no jobs are running and until some

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.107 2020/04/03 03:35:16 sjg Exp $ */
/* $NetBSD: make.h,v 1.109 2020/07/02 15:14:38 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -503,6 +503,7 @@ void Make_DoAllVar(GNode *);
Boolean Make_Run(Lst);
char * Check_Cwd_Cmd(const char *);
void Check_Cwd(const char **);
int dieQuietly(GNode *, int);
void PrintOnError(GNode *, const char *);
void Main_ExportMAKEFLAGS(Boolean);
Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
@ -511,10 +512,6 @@ int str2Lst_Append(Lst, char *, const char *);
int cached_lstat(const char *, void *);
int cached_stat(const char *, void *);
#define VARF_UNDEFERR 1
#define VARF_WANTRES 2
#define VARF_ASSIGN 4
#ifdef __GNUC__
#define UNCONST(ptr) ({ \
union __unconst { \

View File

@ -1,4 +1,4 @@
/* $NetBSD: make_malloc.c,v 1.11 2017/04/16 20:20:24 dholland Exp $ */
/* $NetBSD: make_malloc.c,v 1.12 2020/07/03 08:02:55 rillig Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -28,7 +28,7 @@
#ifdef MAKE_NATIVE
#include <sys/cdefs.h>
__RCSID("$NetBSD: make_malloc.c,v 1.11 2017/04/16 20:20:24 dholland Exp $");
__RCSID("$NetBSD: make_malloc.c,v 1.12 2020/07/03 08:02:55 rillig Exp $");
#endif
#include <stdio.h>
@ -63,7 +63,7 @@ bmake_malloc(size_t len)
if ((p = malloc(len)) == NULL)
enomem();
return(p);
return p;
}
/*
@ -102,7 +102,7 @@ bmake_strndup(const char *str, size_t max_len)
memcpy(p, str, len);
p[len] = '\0';
return(p);
return p;
}
/*
@ -114,6 +114,6 @@ bmake_realloc(void *ptr, size_t size)
{
if ((ptr = realloc(ptr, size)) == NULL)
enomem();
return(ptr);
return ptr;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.81 2020/04/03 03:32:28 sjg Exp $ */
/* $NetBSD: meta.c,v 1.86 2020/07/11 00:39:53 sjg Exp $ */
/*
* Implement 'meta' mode.
@ -8,16 +8,16 @@
/*
* Copyright (c) 2009-2016, Juniper Networks, Inc.
* Portions Copyright (c) 2009, John Birrell.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@ -28,7 +28,7 @@
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#if defined(USE_META)
@ -113,7 +113,7 @@ extern char **environ;
*
* See meta_oodate below - we mainly care about 'E' and 'R'.
*
* We can still use meta mode without filemon, but
* We can still use meta mode without filemon, but
* the benefits are more limited.
*/
#ifdef USE_FILEMON
@ -174,14 +174,18 @@ filemon_read(FILE *mfp, int fd)
return 0;
}
/* rewind */
(void)lseek(fd, (off_t)0, SEEK_SET);
if (lseek(fd, (off_t)0, SEEK_SET) < 0) {
error = errno;
warn("Could not rewind filemon");
fprintf(mfp, "\n");
} else {
error = 0;
fprintf(mfp, "\n-- filemon acquired metadata --\n");
error = 0;
fprintf(mfp, "\n-- filemon acquired metadata --\n");
while ((n = read(fd, buf, sizeof(buf))) > 0) {
if ((int)fwrite(buf, 1, n, mfp) < n)
error = EIO;
while ((n = read(fd, buf, sizeof(buf))) > 0) {
if ((int)fwrite(buf, 1, n, mfp) < n)
error = EIO;
}
}
fflush(mfp);
if (close(fd) < 0)
@ -214,7 +218,7 @@ eat_dots(char *buf, size_t bufsz, int dots)
default:
return;
}
do {
cp = strstr(buf, eat);
if (cp) {
@ -304,7 +308,7 @@ meta_name(char *mname, size_t mnamelen,
}
}
free(tp);
return (mname);
return mname;
}
/*
@ -355,7 +359,7 @@ is_submake(void *cmdp, void *gnp)
}
}
free(mp);
return (rc);
return rc;
}
typedef struct meta_file_s {
@ -403,7 +407,7 @@ meta_needed(GNode *gn, const char *dname,
if (verbose)
verbose = DEBUG(META);
/* This may be a phony node which we don't want meta data for... */
/* Skip .meta for .BEGIN, .END, .ERROR etc as well. */
/* Or it may be explicitly flagged as .NOMETA */
@ -454,7 +458,7 @@ meta_needed(GNode *gn, const char *dname,
return TRUE;
}
static FILE *
meta_create(BuildMon *pbm, GNode *gn)
{
@ -545,7 +549,7 @@ meta_create(BuildMon *pbm, GNode *gn)
free(p[i]);
}
return (mf.fp);
return mf.fp;
}
static Boolean
@ -570,7 +574,7 @@ meta_init(void)
{
#ifdef USE_FILEMON
/* this allows makefiles to test if we have filemon support */
Var_Set(".MAKE.PATH_FILEMON", filemon_path(), VAR_GLOBAL, 0);
Var_Set(".MAKE.PATH_FILEMON", filemon_path(), VAR_GLOBAL);
#endif
}
@ -616,7 +620,7 @@ meta_mode_init(const char *make_mode)
* This works be cause :H will generate '.' if there is no /
* and :tA will resolve that to cwd.
*/
Var_Set(MAKE_META_PREFIX, "Building ${.TARGET:H:tA}/${.TARGET:T}", VAR_GLOBAL, 0);
Var_Set(MAKE_META_PREFIX, "Building ${.TARGET:H:tA}/${.TARGET:T}", VAR_GLOBAL);
}
if (once)
return;
@ -790,12 +794,12 @@ meta_job_error(Job *job, GNode *gn, int flags, int status)
"(ignored)" : "");
}
if (gn) {
Var_Set(".ERROR_TARGET", gn->path ? gn->path : gn->name, VAR_GLOBAL, 0);
Var_Set(".ERROR_TARGET", gn->path ? gn->path : gn->name, VAR_GLOBAL);
}
getcwd(cwd, sizeof(cwd));
Var_Set(".ERROR_CWD", cwd, VAR_GLOBAL, 0);
Var_Set(".ERROR_CWD", cwd, VAR_GLOBAL);
if (pbm->meta_fname[0]) {
Var_Set(".ERROR_META_FILE", pbm->meta_fname, VAR_GLOBAL, 0);
Var_Set(".ERROR_META_FILE", pbm->meta_fname, VAR_GLOBAL);
}
meta_job_finish(job);
}
@ -804,7 +808,7 @@ void
meta_job_output(Job *job, char *cp, const char *nl)
{
BuildMon *pbm;
if (job != NULL) {
pbm = &job->bm;
} else {
@ -900,7 +904,7 @@ meta_finish(void)
* Fetch a full line from fp - growing bufp if needed
* Return length in bufp.
*/
static int
static int
fgetLine(char **bufp, size_t *szp, int o, FILE *fp)
{
char *buf = *bufp;
@ -951,7 +955,7 @@ prefix_match(void *p, void *q)
const char *path = q;
size_t n = strlen(prefix);
return (0 == strncmp(path, prefix, n));
return strncmp(path, prefix, n) == 0;
}
/*
@ -1013,7 +1017,7 @@ meta_ignore(GNode *gn, const char *p)
if (metaIgnorePatterns) {
char *pm;
Var_Set(".p.", p, gn, 0);
Var_Set(".p.", p, gn);
pm = Var_Subst(NULL,
"${" MAKE_META_IGNORE_PATTERNS ":@m@${.p.:M$m}@}",
gn, VARF_WANTRES);
@ -1188,7 +1192,7 @@ meta_oodate(GNode *gn, Boolean oodate)
have_filemon = TRUE;
continue;
}
}
}
/* Delimit the record type. */
p = buf;
@ -1238,11 +1242,11 @@ meta_oodate(GNode *gn, Boolean oodate)
if (pid > 0 && pid != lastpid) {
char *ldir;
char *tp;
if (lastpid > 0) {
/* We need to remember these. */
Var_Set(lcwd_vname, lcwd, VAR_GLOBAL, 0);
Var_Set(ldir_vname, latestdir, VAR_GLOBAL, 0);
Var_Set(lcwd_vname, lcwd, VAR_GLOBAL);
Var_Set(ldir_vname, latestdir, VAR_GLOBAL);
}
snprintf(lcwd_vname, sizeof(lcwd_vname), LCWD_VNAME_FMT, pid);
snprintf(ldir_vname, sizeof(ldir_vname), LDIR_VNAME_FMT, pid);
@ -1288,9 +1292,9 @@ meta_oodate(GNode *gn, Boolean oodate)
child = atoi(p);
if (child > 0) {
snprintf(cldir, sizeof(cldir), LCWD_VNAME_FMT, child);
Var_Set(cldir, lcwd, VAR_GLOBAL, 0);
Var_Set(cldir, lcwd, VAR_GLOBAL);
snprintf(cldir, sizeof(cldir), LDIR_VNAME_FMT, child);
Var_Set(cldir, latestdir, VAR_GLOBAL, 0);
Var_Set(cldir, latestdir, VAR_GLOBAL);
#ifdef DEBUG_META_MODE
if (DEBUG(META))
fprintf(debug_file, "%s: %d: %d: cwd=%s lcwd=%s ldir=%s\n",
@ -1303,10 +1307,10 @@ meta_oodate(GNode *gn, Boolean oodate)
case 'C': /* Chdir */
/* Update lcwd and latest directory. */
strlcpy(latestdir, p, sizeof(latestdir));
strlcpy(latestdir, p, sizeof(latestdir));
strlcpy(lcwd, p, sizeof(lcwd));
Var_Set(lcwd_vname, lcwd, VAR_GLOBAL, 0);
Var_Set(ldir_vname, lcwd, VAR_GLOBAL, 0);
Var_Set(lcwd_vname, lcwd, VAR_GLOBAL);
Var_Set(ldir_vname, lcwd, VAR_GLOBAL);
#ifdef DEBUG_META_MODE
if (DEBUG(META))
fprintf(debug_file, "%s: %d: cwd=%s ldir=%s\n", fname, lineno, cwd, lcwd);
@ -1383,7 +1387,7 @@ meta_oodate(GNode *gn, Boolean oodate)
/*
* If a file we generated within our bailiwick
* but outside of .OBJDIR is missing,
* we need to do it again.
* we need to do it again.
*/
/* ignore non-absolute paths */
if (*p != '/')
@ -1432,7 +1436,7 @@ meta_oodate(GNode *gn, Boolean oodate)
*/
if (meta_ignore(gn, p))
break;
/*
* The rest of the record is the file name.
* Check if it's not an absolute path.
@ -1606,7 +1610,7 @@ meta_oodate(GNode *gn, Boolean oodate)
oodate = TRUE;
}
} else {
if (writeMeta && metaMissing) {
if (writeMeta && (metaMissing || (gn->type & OP_META))) {
cp = NULL;
/* if target is in .CURDIR we do not need a meta file */
@ -1633,7 +1637,7 @@ meta_oodate(GNode *gn, Boolean oodate)
* All we can sanely do is set it to .ALLSRC.
*/
Var_Delete(OODATE, gn);
Var_Set(OODATE, Var_Value(ALLSRC, gn, &cp), gn, 0);
Var_Set(OODATE, Var_Value(ALLSRC, gn, &cp), gn);
free(cp);
}
@ -1656,7 +1660,7 @@ meta_compat_start(void)
* We need to re-open filemon for each cmd.
*/
BuildMon *pbm = &Mybm;
if (pbm->mfp != NULL && useFilemon) {
meta_open_filemon(pbm);
} else {

View File

@ -1,23 +1,23 @@
/* $NetBSD: meta.h,v 1.6 2020/01/19 19:42:32 riastradh Exp $ */
/* $NetBSD: meta.h,v 1.7 2020/07/03 08:13:23 rillig Exp $ */
/*
* Things needed for 'meta' mode.
*/
/*
* Copyright (c) 2009-2010, Juniper Networks, Inc.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@ -28,7 +28,7 @@
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
typedef struct BuildMon {

View File

@ -1,3 +1,24 @@
2020-07-10 Simon J Gerraty <sjg@beast.crufty.net>
* dirdeps.mk: optimize content of dirdeps.cache
2020-06-28 Simon J Gerraty <sjg@beast.crufty.net>
* sys/*.mk: make it easier for local*sys.mk to customize by
using ?=
2020-06-22 Simon J Gerraty <sjg@beast.crufty.net>
* gendirdeps.mk (LOCAL_DEPENDS_GUARD): if we don't build at level 0
it is much safer to guard local depends with a simple check for
.MAKE.LEVEL > 0
2020-06-10 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20200610
* mkopt.sh: this needs posix shell so #!/bin/sh should be ok
2020-06-06 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20200606

View File

@ -1,5 +1,6 @@
ChangeLog
FILES
LICENSE
README
auto.obj.mk
autoconf.mk

View File

@ -1,4 +1,4 @@
# $Id: dirdeps.mk,v 1.104 2020/05/16 23:21:48 sjg Exp $
# $Id: dirdeps.mk,v 1.106 2020/07/11 16:25:17 sjg Exp $
# Copyright (c) 2010-2020, Simon J. Gerraty
# Copyright (c) 2010-2018, Juniper Networks, Inc.
@ -507,7 +507,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
# we want to capture the dirdeps count in the cache
.END: _count_dirdeps
_count_dirdeps: .NOMETA
@echo '.info $${.newline}$${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]}' >&3
@{ echo; echo '.info $${.newline}$${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]}'; } >&3
.endif
.elif !make(dirdeps) && !target(_count_dirdeps)
@ -644,19 +644,19 @@ _build_all_dirs := ${_build_all_dirs:O:u}
.if ${.MAKEFLAGS:M-V${_V_READ_DIRDEPS}} == ""
.if !empty(_build_all_dirs)
.if ${BUILD_DIRDEPS_CACHE} == "yes"
# guard against _build_all_dirs being too big for a single command line
# first get list of dirs that need _DIRDEP_USE
# then export that and _build_all_dirs
x!= echo; { echo; echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; } >&3
# guard against _new_dirdeps being too big for a single command line
_new_dirdeps := ${_build_all_dirs:@x@${target($x):?:$x}@}
.export _new_dirdeps _build_all_dirs
x!= echo; { echo '\# ${DEP_RELDIR}.${DEP_TARGET_SPEC}'; \
echo "dirdeps: \\"; \
for x in $$_build_all_dirs; do echo " $$x \\"; done; echo; \
for x in $$_new_dirdeps; do echo "$$x: _DIRDEP_USE"; done; echo; } >&3
.if !empty(_new_dirdeps)
.export _new_dirdeps
x!= echo; { echo; echo "dirdeps: \\"; \
for x in $$_new_dirdeps; do echo " $$x \\"; done; echo; \
for x in $$_new_dirdeps; do echo "$$x: _DIRDEP_USE"; done; } >&3
.endif
.if !empty(DEP_EXPORT_VARS)
# Discouraged, but there are always exceptions.
# Handle it here rather than explain how.
x!= { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3; echo
x!= echo; { echo; ${DEP_EXPORT_VARS:@v@echo '$v=${$v}';@} echo '.export ${DEP_EXPORT_VARS}'; echo; } >&3
.endif
.else
# this makes it all happen
@ -675,6 +675,9 @@ DEP_EXPORT_VARS=
# this builds the dependency graph
.for m in ${_machines}
.if ${BUILD_DIRDEPS_CACHE} == "yes" && !empty(_build_dirs)
x!= echo; { echo; echo "${_this_dir}.$m: \\"; } >&3
.endif
# it would be nice to do :N${.TARGET}
.if !empty(__qual_depdirs)
.for q in ${__qual_depdirs:${M_dep_qual_fixes:ts:}:E:O:u:N$m}
@ -683,9 +686,10 @@ DEP_EXPORT_VARS=
.endif
.if ${BUILD_DIRDEPS_CACHE} == "yes"
_cache_deps := ${_build_dirs:M*.$q}
.if !empty(_cache_deps)
.export _cache_deps
x!= echo; { echo "${_this_dir}.$m: \\"; \
for x in $$_cache_deps; do echo " $$x \\"; done; echo; } >&3
x!= echo; for x in $$_cache_deps; do echo " $$x \\"; done >&3
.endif
.else
${_this_dir}.$m: ${_build_dirs:M*.$q}
.endif
@ -696,9 +700,10 @@ ${_this_dir}.$m: ${_build_dirs:M*.$q}
.endif
.if ${BUILD_DIRDEPS_CACHE} == "yes"
_cache_deps := ${_build_dirs:M*.$m:N${_this_dir}.$m}
.if !empty(_cache_deps)
.export _cache_deps
x!= echo; { echo "${_this_dir}.$m: \\"; \
for x in $$_cache_deps; do echo " $$x \\"; done; echo; } >&3
x!= echo; for x in $$_cache_deps; do echo " $$x \\"; done >&3
.endif
.else
${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
.endif

View File

@ -1,4 +1,4 @@
# $Id: gendirdeps.mk,v 1.42 2020/05/16 23:21:48 sjg Exp $
# $Id: gendirdeps.mk,v 1.44 2020/06/23 04:21:51 sjg Exp $
# Copyright (c) 2011-2020, Simon J. Gerraty
# Copyright (c) 2010-2018, Juniper Networks, Inc.
@ -51,7 +51,7 @@ all:
_CURDIR ?= ${.CURDIR}
_OBJDIR ?= ${.OBJDIR}
_OBJTOP ?= ${OBJTOP}
_OBJROOT ?= ${OBJROOT:U${_OBJTOP}}
_OBJROOT ?= ${OBJROOT:U${_OBJTOP:H}}
.if ${_OBJROOT:M*/}
_slash=/
.else
@ -339,6 +339,12 @@ CAT_DEPEND ?= .depend
.PHONY: ${_DEPENDFILE}
.endif
.if ${BUILD_AT_LEVEL0:Uno:tl} == "no"
LOCAL_DEPENDS_GUARD ?= _{.MAKE.LEVEL} > 0
.else
LOCAL_DEPENDS_GUARD ?= _{DEP_RELDIR} == _{_DEP_RELDIR}
.endif
# 'cat .depend' should suffice, but if we are mixing build modes
# .depend may contain things we don't want.
# The sed command at the end of the stream, allows for the filters
@ -350,7 +356,7 @@ ${_DEPENDFILE}: .NOMETA ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):
${_include_src_dirdeps} \
echo '.include <dirdeps.mk>'; \
echo; \
echo '.if $${DEP_RELDIR} == $${_DEP_RELDIR}'; \
echo '.if ${LOCAL_DEPENDS_GUARD}'; \
echo '# local dependencies - needed for -jN in clean tree'; \
[ -s ${CAT_DEPEND} ] && { grep : ${CAT_DEPEND} | grep -v '[/\\]'; }; \
echo '.endif' ) | sed 's,_\([{(]\),$$\1,g' > $@.new${.MAKE.PID}

View File

@ -1,5 +1,5 @@
# RCSid:
# $Id: host-target.mk,v 1.11 2015/10/25 00:07:20 sjg Exp $
# $Id: host-target.mk,v 1.12 2020/07/08 23:35:29 sjg Exp $
# Host platform information; may be overridden
.if !defined(_HOST_OSNAME)
@ -37,6 +37,11 @@ HOST_OSTYPE := ${_HOST_OSNAME:S,/,,g}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARC
HOST_OS := ${_HOST_OSNAME}
host_os := ${_HOST_OSNAME:tl}
HOST_TARGET := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH}
# sometimes we want HOST_TARGET32
MACHINE32.amd64 = i386
MACHINE32.x86_64 = i386
_HOST_ARCH32 := ${MACHINE32.${_HOST_ARCH}:U${_HOST_ARCH:S,64$,,}}
HOST_TARGET32 := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH32}
# tr is insanely non-portable, accommodate the lowest common denominator
TR ?= tr

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.172 2020/06/06 22:41:15 sjg Exp $
# $Id: install-mk,v 1.174 2020/07/10 21:50:14 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20200606
MK_VERSION=20200710
OWNER=
GROUP=
MODE=444

View File

@ -1,7 +1,8 @@
:
# $Id: mkopt.sh,v 1.11 2017/03/18 21:36:42 sjg Exp $
#!/bin/sh
# $Id: mkopt.sh,v 1.12 2020/06/23 04:16:35 sjg Exp $
#
# @(#) Copyright (c) 2014, Simon J. Gerraty
# @(#) Copyright (c) 2014, 2020, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.

View File

@ -1,80 +1,80 @@
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
OS= AIX
unix= We run ${OS}.
ROOT_GROUP= system
OS ?= AIX
unix ?= We run ${OS}.
ROOT_GROUP ?= system
# This needs a lot of work yet...
NOPIC=no # no shared libs?
NOPIC ?=no # no shared libs?
.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4
.LIBS: .a
AR= ar
ARFLAGS= rl
RANLIB= ranlib
AR ?= ar
ARFLAGS ?= rl
RANLIB ?= ranlib
AS= as
AS ?= as
AFLAGS=
COMPILE.s= ${AS} ${AFLAGS}
LINK.s= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.s ?= ${AS} ${AFLAGS}
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/local/bin/gcc)
CC= gcc
DBG= -O -g
STATIC?= -static
CC ?= gcc
DBG ?= -O -g
STATIC ?= -static
.else
CC= cc
DBG= -g
STATIC=
CC ?= cc
DBG ?= -g
STATIC ?=
.endif
CFLAGS= ${DBG}
COMPILE.c= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX= g++
CXXFLAGS= ${CFLAGS}
COMPILE.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= g++
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP= cpp
CPP ?= cpp
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
.endif
MK_DEP= mkdeps.sh -N
FC= f77
FFLAGS= -O
MK_DEP ?= mkdeps.sh -N
FC ?= f77
FFLAGS ?= -O
RFLAGS=
COMPILE.f= ${FC} ${FFLAGS} -c
LINK.f= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
LEX= lex
LEX ?= lex
LFLAGS=
LEX.l= ${LEX} ${LFLAGS}
LEX.l ?= ${LEX} ${LFLAGS}
LD= ld
LD ?= ld
LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
LINT ?= lint
LINTFLAGS ?= -chapbx
PC= pc
PC ?= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
YACC= yacc
YFLAGS= -d
YACC.y= ${YACC} ${YFLAGS}
YACC ?= yacc
YFLAGS ?= -d
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,108 +1,108 @@
# $NetBSD: Darwin.sys.mk,v 1.3 2003/02/16 09:44:41 grant Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
OS= Darwin
unix?= We run ${OS}.
OS ?= Darwin
unix ?= We run ${OS}.
.SUFFIXES: .out .a .ln .o .s .S .c .m ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .dylib
.LIBS: .a .dylib
SHLIBEXT = .dylib
HOST_LIBEXT = .dylib
DSHLIBEXT = .dylib
SHLIBEXT ?= .dylib
HOST_LIBEXT ?= .dylib
DSHLIBEXT ?= .dylib
AR?= ar
ARFLAGS?= rl
AR ?= ar
ARFLAGS ?= rl
RANLIB =
AS?= as
AFLAGS?=
COMPILE.s?= ${AS} ${AFLAGS}
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
AS ?= as
AFLAGS ?=
COMPILE.s ?= ${AS} ${AFLAGS}
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
PIPE?= -pipe
PIPE ?= -pipe
.if exists(/usr/bin/clang)
CC?= cc ${PIPE}
CXX?= c++
CC ?= cc ${PIPE}
CXX ?= c++
.elif exists(/usr/bin/gcc)
CC?= gcc ${PIPE}
CC ?= gcc ${PIPE}
.else
CC?= cc ${PIPE}
CC ?= cc ${PIPE}
.endif
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
DBG ?= -O2
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/bin/g++)
CXX?= g++
CXX ?= g++
.else
CXX?= c++
CXX ?= c++
.endif
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC ?= ${CC}
OBJCFLAGS ?= ${CFLAGS}
COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
NOLINT= 1
CPPFLAGS?=
CPP ?= cpp
NOLINT ?= 1
CPPFLAGS ?=
MK_DEP?= mkdep
MK_DEP ?= mkdep
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
FC ?= f77
FFLAGS ?= -O
RFLAGS ?=
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
INSTALL ?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LEX ?= lex
LFLAGS ?=
LEX.l ?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LD ?= ld
LDFLAGS ?=
SHLIB_TEENY = 0
SHLIB_MINOR = 0
SHLIB_TEENY ?= 0
SHLIB_MINOR ?= 0
MKPICLIB = no
LIBEXT = .dylib
MKPICLIB ?= no
LIBEXT ?= .dylib
LINT?= lint
LINTFLAGS?= -chapbx
LINT ?= lint
LINTFLAGS ?= -chapbx
LORDER?= lorder
LORDER ?= lorder
NM?= nm
NM ?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
PC ?= pc
PFLAGS ?=
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SIZE?= size
SIZE ?= size
TSORT?= tsort -q
TSORT ?= tsort -q
YACC?= bison -y
YFLAGS?= -d
YACC.y?= ${YACC} ${YFLAGS}
YACC ?= bison -y
YFLAGS ?= -d
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,4 +1,4 @@
# $Id: Generic.mk,v 1.14 2020/04/17 21:08:17 sjg Exp $
# $Id: Generic.mk,v 1.16 2020/06/29 14:34:42 sjg Exp $
#
# some reasonable defaults
@ -7,7 +7,7 @@
.LIBS: .a
tools = \
tools ?= \
ar \
lorder \
ranlib \
@ -27,71 +27,71 @@ MACHINE_ARCH = ${MACHINE_ARCH.${MACHINE}}
TSORT += -q
.endif
ARFLAGS?= rl
ARFLAGS ?= rl
AS?= as
AFLAGS?=
AS ?= as
AFLAGS ?=
.if ${MACHINE_ARCH} == "sparc64"
AFLAGS+= -Wa,-Av9a
.endif
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.s ?= ${CC} ${AFLAGS} -c
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC ?= cc
DBG ?= -O2
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= c++
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC ?= ${CC}
OBJCFLAGS ?= ${CFLAGS}
COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
CPP ?= cpp
CPPFLAGS ?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
FC ?= f77
FFLAGS ?= -O
RFLAGS ?=
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
INSTALL ?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LEX ?= lex
LFLAGS ?=
LEX.l ?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LD ?= ld
LDFLAGS ?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LINT ?= lint
LINTFLAGS ?= -chapbxzF
NM?= nm
NM ?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
PC ?= pc
PFLAGS ?=
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SIZE?= size
SIZE ?= size
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
YACC ?= yacc
YFLAGS ?=
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,122 +1,122 @@
# $Id: HP-UX.mk,v 1.12 2020/04/17 21:08:17 sjg Exp $
# $Id: HP-UX.mk,v 1.14 2020/06/29 14:34:42 sjg Exp $
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
OS= HP-UX
ROOT_GROUP= root
unix?= We run ${OS}.
OS ?= HP-UX
ROOT_GROUP ?= root
unix ?= We run ${OS}.
# HP-UX's cc does not provide any clues as to wether this is 9.x or 10.x
# nor does sys/param.h, so we'll use the existence of /hp-ux
.if exists("/hp-ux")
OSMAJOR?=9
OSMAJOR ?=9
.endif
OSMAJOR?=10
__HPUX_VERSION?=${OSMAJOR}
OSMAJOR ?=10
__HPUX_VERSION ?=${OSMAJOR}
.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4
LIBMODE= 755
LIBCRT0= /lib/crt0.o
LIBMODE ?= 755
LIBCRT0 ?= /lib/crt0.o
.LIBS: .a
# +b<path> is needed to stop the binaries from insisting on having
# the build tree available :-)
# +s tells the dynamic loader to use SHLIB_PATH if set
LD_bpath?=-Wl,+b/lib:/usr/lib:/usr/local/lib
LD_spath?=-Wl,+s
LD_bpath ?=-Wl,+b/lib:/usr/lib:/usr/local/lib
LD_spath ?=-Wl,+s
LDADD+= ${LD_bpath} ${LD_spath}
.if exists(/usr/lib/end.o)
LDADD+= /usr/lib/end.o
.endif
AR= ar
ARFLAGS= rl
RANLIB= :
AR ?= ar
ARFLAGS ?= rl
RANLIB ?= :
AFLAGS=
COMPILE.s= ${AS} ${AFLAGS}
LINK.s= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.s ?= ${AS} ${AFLAGS}
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/local/bin/gcc)
PIPE?= -pipe
CC?= gcc ${PIPE}
AS= gas
DBG?= -O -g
STATIC?= -static
PIPE ?= -pipe
CC ?= gcc ${PIPE}
AS ?= gas
DBG ?= -O -g
STATIC ?= -static
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
.endif
.else
# HP's bundled compiler knows not -g or -O
AS= as
CC= cc
AS ?= as
CC ?= cc
.if exists(/opt/ansic/bin/cc)
CCMODE?=-Ae +ESlit
PICFLAG?= +z
CCMODE ?=-Ae +ESlit
PICFLAG ?= +z
LD_x=
DBG?=-g -O
DBG ?=-g -O
.endif
DBG?=
STATIC?= -Wl,-a,archive
DBG ?=
STATIC ?= -Wl,-a,archive
.endif
.if (${__HPUX_VERSION} == "10")
CCSOURCE_FLAGS?= -D_HPUX_SOURCE
CCSOURCE_FLAGS ?= -D_HPUX_SOURCE
.else
CCSOURCE_FLAGS?= -D_HPUX_SOURCE -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_XOPEN_SOURCE_EXTENDED
CCSOURCE_FLAGS ?= -D_HPUX_SOURCE -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_XOPEN_SOURCE_EXTENDED
.endif
CFLAGS= ${DBG}
CFLAGS+= ${CCMODE} -D__hpux__ -D__HPUX_VERSION=${__HPUX_VERSION} ${CCSOURCE_FLAGS}
COMPILE.c= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS ?= ${DBG}
CFLAGS+ ?= ${CCMODE} -D__hpux__ -D__HPUX_VERSION=${__HPUX_VERSION} ${CCSOURCE_FLAGS}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX= g++
CXXFLAGS= ${CFLAGS}
COMPILE.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= g++
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP= cpp
CPP ?= cpp
MK_DEP= mkdeps.sh -N
FC= f77
FFLAGS= -O
MK_DEP ?= mkdeps.sh -N
FC ?= f77
FFLAGS ?= -O
RFLAGS=
COMPILE.f= ${FC} ${FFLAGS} -c
LINK.f= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
LEX= lex
LEX ?= lex
LFLAGS=
LEX.l= ${LEX} ${LFLAGS}
LEX.l ?= ${LEX} ${LFLAGS}
LD= ld
LD ?= ld
LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
LINT ?= lint
LINTFLAGS ?= -chapbx
PC= pc
PC ?= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
# HP's sh sucks
ENV=
MAKE_SHELL= /bin/ksh
MAKE_SHELL ?= /bin/ksh
.if exists(/usr/local/bin/bison)
YACC= bison -y
YACC ?= bison -y
.else
YACC= yacc
YACC ?= yacc
.endif
YFLAGS= -d
YACC.y= ${YACC} ${YFLAGS}
YFLAGS ?= -d
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -7,7 +7,7 @@ OS!= uname -s
ROOT_GROUP!= sed -n /:0:/s/:.*//p /etc/group
.MAKEOVERRIDES+= OS ROOT_GROUP
.endif
unix?= We run ${OS}.
unix ?= We run ${OS}.
.endif
.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h
@ -15,75 +15,75 @@ unix?= We run ${OS}.
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AR ?= ar
ARFLAGS ?= rl
RANLIB ?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
AS ?= as
AFLAGS ?=
COMPILE.s ?= ${CC} ${AFLAGS} -c
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
NOGCCERROR?= # defined
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC ?= cc
NOGCCERROR ?= # defined
DBG ?= -O2
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= CC
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= CC
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC ?= ${CC}
OBJCFLAGS ?= ${CFLAGS}
COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= CC
CPPFLAGS?=
CPP ?= CC
CPPFLAGS ?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
FC ?= f77
FFLAGS ?= -O
RFLAGS ?=
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= ${PREFIX}/bin/install-sh
INSTALL ?= ${PREFIX}/bin/install-sh
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LEX ?= lex
LFLAGS ?=
LEX.l ?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LD ?= ld
LDFLAGS ?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LINT ?= lint
LINTFLAGS ?= -chapbxzF
LORDER?= lorder
LORDER ?= lorder
NM?= nm
NM ?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
PC ?= pc
PFLAGS ?=
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SIZE?= size
SIZE ?= size
TSORT?= tsort -q
TSORT ?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
YACC ?= yacc
YFLAGS ?=
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,83 +1,83 @@
# $Id: Linux.mk,v 1.10 2020/04/17 21:08:17 sjg Exp $
# $Id: Linux.mk,v 1.12 2020/06/29 14:34:42 sjg Exp $
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
OS?= Linux
unix?= We run ${OS}.
OS ?= Linux
unix ?= We run ${OS}.
ROOT_GROUP= root
ROOT_GROUP ?= root
# would be better to work out where it is...
LIBCRT0= /dev/null
LIBCRT0 ?= /dev/null
NEED_SOLINKS=yes
NEED_SOLINKS ?=yes
.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4
.LIBS: .a
AR= ar
ARFLAGS= rl
RANLIB= ranlib
AR ?= ar
ARFLAGS ?= rl
RANLIB ?= ranlib
AS= as
AS ?= as
AFLAGS=
COMPILE.s= ${AS} ${AFLAGS}
LINK.s= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.s ?= ${AS} ${AFLAGS}
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/local/bin/gcc)
CC= gcc -pipe
DBG= -O -g
STATIC?= -static
CC ?= gcc -pipe
DBG ?= -O -g
STATIC ?= -static
.else
CC= cc -pipe
DBG= -g
STATIC= -Bstatic
CC ?= cc -pipe
DBG ?= -g
STATIC ?= -Bstatic
.endif
CFLAGS= ${DBG}
COMPILE.c= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX= g++
CXXFLAGS= ${CFLAGS}
COMPILE.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= g++
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP= cpp
CPP ?= cpp
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
.endif
MK_DEP= mkdeps.sh -N
FC= f77
FFLAGS= -O
MK_DEP ?= mkdeps.sh -N
FC ?= f77
FFLAGS ?= -O
RFLAGS=
COMPILE.f= ${FC} ${FFLAGS} -c
LINK.f= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
LEX= lex
LEX ?= lex
LFLAGS=
LEX.l= ${LEX} ${LFLAGS}
LEX.l ?= ${LEX} ${LFLAGS}
LD= ld
LD ?= ld
LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
LINT ?= lint
LINTFLAGS ?= -chapbx
PC= pc
PC ?= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
YACC= yacc
YFLAGS= -d
YACC.y= ${YACC} ${YFLAGS}
YACC ?= yacc
YFLAGS ?= -d
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,21 +1,21 @@
# $NetBSD: sys.mk,v 1.66.2.1 2002/06/05 03:31:01 lukem Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
OS= NetBSD
unix?= We run ${OS}.
OS ?= NetBSD
unix ?= We run ${OS}.
.if !defined(MAKE_VERSION)
# we are running native make
# which defined MAKE_VERSION between 20010609 and 20090324
# so we can make a rough guess
.if defined(.MAKE.LEVEL)
MAKE_VERSION = 20090908
MAKE_VERSION ?= 20090908
.elif defined(.MAKE.MAKEFILES)
# introduced 20071008
MAKE_VERSION = 20090324
MAKE_VERSION ?= 20090324
.else
# this just before when MAKE_VERSION was introduced
MAKE_VERSION = 20010606
MAKE_VERSION ?= 20010606
.endif
.endif
@ -24,29 +24,29 @@ MAKE_VERSION = 20010606
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AR ?= ar
ARFLAGS ?= rl
RANLIB ?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
AS ?= as
AFLAGS ?=
COMPILE.s ?= ${CC} ${AFLAGS} -c
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
CC ?= cc
# need to make sure this is set
MACHINE_ARCH.${MACHINE} ?= ${MACHINE}
.if empty(MACHINE_ARCH)
MACHINE_ARCH = ${MACHINE_ARCH.${MACHINE}}
MACHINE_ARCH ?= ${MACHINE_ARCH.${MACHINE}}
.endif
#
# CPU model, derived from MACHINE_ARCH
#
MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/m68000/m68k/:S/armeb/arm/}
MACHINE_CPU ?= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/m68000/m68k/:S/armeb/arm/}
.if ${MACHINE_CPU} == "alpha" || \
${MACHINE_CPU} == "arm" || \
@ -56,69 +56,69 @@ MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3
${MACHINE_CPU} == "powerpc" || \
${MACHINE_CPU} == "sparc" || \
${MACHINE_CPU} == "vax"
DBG?= -O2
DBG ?= -O2
.elif ${MACHINE_ARCH} == "x86_64"
DBG?=
DBG ?=
.elif ${MACHINE_ARCH} == "sparc64"
DBG?= -O -ffixed-g4 #Hack for embedany memory model compatibility
DBG ?= -O -ffixed-g4 #Hack for embedany memory model compatibility
.else
DBG?= -O
DBG ?= -O
.endif
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= c++
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC ?= ${CC}
OBJCFLAGS ?= ${CFLAGS}
COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
CPP ?= cpp
CPPFLAGS ?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
FC ?= f77
FFLAGS ?= -O
RFLAGS ?=
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
INSTALL ?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LEX ?= lex
LFLAGS ?=
LEX.l ?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LD ?= ld
LDFLAGS ?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LINT ?= lint
LINTFLAGS ?= -chapbxzF
LORDER?= lorder
LORDER ?= lorder
NM?= nm
NM ?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
PC ?= pc
PFLAGS ?=
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SIZE?= size
SIZE ?= size
TSORT?= tsort -q
TSORT ?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
YACC ?= yacc
YFLAGS ?=
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,15 +1,15 @@
# $Id: OSF1.mk,v 1.9 2020/04/17 21:08:17 sjg Exp $
# $Id: OSF1.mk,v 1.11 2020/06/29 14:34:42 sjg Exp $
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
OS?= OSF1
unix?= We run ${OS}.
ROOT_GROUP= system
OS ?= OSF1
unix ?= We run ${OS}.
ROOT_GROUP ?= system
# can't fine one anywhere, so just stop the dependency
LIBCRT0= /dev/null
LIBCRT0 ?= /dev/null
PATH=/usr/sbin:/usr/bin:/usr/ucb:/opt/gnu/bin:/usr/ccs/bin
PATH ?=/usr/sbin:/usr/bin:/usr/ucb:/opt/gnu/bin:/usr/ccs/bin
.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4
@ -17,78 +17,78 @@ PATH=/usr/sbin:/usr/bin:/usr/ucb:/opt/gnu/bin:/usr/ccs/bin
# no -X
LD_X=
LD_x= -x
LD_r= -r
AR= ar
ARFLAGS= rl
RANLIB= ranlib
LD_x ?= -x
LD_r ?= -r
AR ?= ar
ARFLAGS ?= rl
RANLIB ?= ranlib
AS= as
AS_STDIN= -
AS ?= as
AS_STDIN ?= -
AFLAGS=
COMPILE.s= ${AS} ${AFLAGS}
LINK.s= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.s ?= ${AS} ${AFLAGS}
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/opt/gnu/bin/gcc) || exists(/usr/local/bin/gcc)
CC?= gcc
CC ?= gcc
.else
CC?= cc -std
CC ?= cc -std
.endif
.if (${CC:T} == "gcc")
DBG= -O -g
STATIC= -static
DBG= -g
STATIC= -non_shared
DBG ?= -O -g
STATIC ?= -static
DBG ?= -g
STATIC ?= -non_shared
.endif
CFLAGS= ${DBG}
COMPILE.c= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX= g++
CXXFLAGS= ${CFLAGS}
COMPILE.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= g++
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP= /usr/ccs/lib/cpp
CPP ?= /usr/ccs/lib/cpp
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
.endif
MK_DEP= mkdeps.sh -N
FC= f77
FFLAGS= -O
MK_DEP ?= mkdeps.sh -N
FC ?= f77
FFLAGS ?= -O
RFLAGS=
COMPILE.f= ${FC} ${FFLAGS} -c
LINK.f= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
LEX= lex
LEX ?= lex
LFLAGS=
LEX.l= ${LEX} ${LFLAGS}
LEX.l ?= ${LEX} ${LFLAGS}
LD= ld
LD ?= ld
LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
LINT ?= lint
LINTFLAGS ?= -chapbx
PC= pc
PC ?= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/local/bin/bison) || exists(/opt/gnu/bin/bison)
YACC= bison -y
YACC ?= bison -y
.else
YACC= yacc
YACC ?= yacc
.endif
YFLAGS= -d
YACC.y= ${YACC} ${YFLAGS}
YFLAGS ?= -d
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,8 +1,8 @@
# $NetBSD: OpenBSD.sys.mk,v 1.1 2002/11/17 09:18:00 cjep Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
OS= OpenBSD
unix?= We run ${OS}.
OS ?= OpenBSD
unix ?= We run ${OS}.
.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
@ -12,88 +12,88 @@ unix?= We run ${OS}.
# need to make sure this is set
MACHINE_ARCH.${MACHINE} ?= ${MACHINE}
.if empty(MACHINE_ARCH)
MACHINE_ARCH = ${MACHINE_ARCH.${MACHINE}}
MACHINE_ARCH ?= ${MACHINE_ARCH.${MACHINE}}
.endif
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AR ?= ar
ARFLAGS ?= rl
RANLIB ?= ranlib
AS?= as
AFLAGS?=
AS ?= as
AFLAGS ?=
.if ${MACHINE_ARCH} == "sparc64"
AFLAGS+= -Wa,-Av9a
.endif
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.s ?= ${CC} ${AFLAGS} -c
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
CC ?= cc
.if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "m68k" || \
${MACHINE_ARCH} == "sparc" || \
${MACHINE_ARCH} == "vax"
DBG?= -O2
DBG ?= -O2
.else
DBG?= -O
DBG ?= -O
.endif
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= c++
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC ?= ${CC}
OBJCFLAGS ?= ${CFLAGS}
COMPILE.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m ?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
CPP ?= cpp
CPPFLAGS ?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
FC ?= f77
FFLAGS ?= -O
RFLAGS ?=
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
INSTALL ?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LEX ?= lex
LFLAGS ?=
LEX.l ?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LD ?= ld
LDFLAGS ?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LINT ?= lint
LINTFLAGS ?= -chapbxzF
LORDER?= lorder
LORDER ?= lorder
NM?= nm
NM ?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
PC ?= pc
PFLAGS ?=
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SIZE?= size
SIZE ?= size
TSORT?= tsort -q
TSORT ?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
YACC ?= yacc
YFLAGS ?=
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,19 +1,19 @@
# $Id: SunOS.mk,v 1.9 2020/04/17 21:08:17 sjg Exp $
# $Id: SunOS.mk,v 1.11 2020/06/29 14:34:42 sjg Exp $
.if ${.PARSEFILE} == "sys.mk"
.include <host-target.mk>
OS?= SunOS.${HOST_OSMAJOR}
unix?= We run ${OS}.
OS ?= SunOS.${HOST_OSMAJOR}
unix ?= We run ${OS}.
.endif
.if ${HOST_OSMAJOR} > 4
ROOT_GROUP= root
ROOT_GROUP ?= root
SHLIB_FULLVERSION = ${SHLIB_MAJOR}
SHLIB_FULLVERSION ?= ${SHLIB_MAJOR}
# suppress the dependency
LIBCRT0= /dev/null
LIBCRT0 ?= /dev/null
.ifndef CC
# the PATH below may find an ancient gcc
@ -22,21 +22,21 @@ CC := ${gcc:L:${M_whence}}
.endif
# the stuff in /usr/xpg4/bin is usually more sane.
PATH=/usr/xpg4/bin:/usr/sbin:/usr/bin:/usr/ucb:/usr/sfw/bin:/opt/gnu/bin:/usr/ccs/bin:/usr/local/bin
PATH ?=/usr/xpg4/bin:/usr/sbin:/usr/bin:/usr/ucb:/usr/sfw/bin:/opt/gnu/bin:/usr/ccs/bin:/usr/local/bin
.export PATH
DSHLIBEXT = .so
HOST_LIBDIRS = /usr/lib /lib /usr/sfw/lib
DSHLIBEXT ?= .so
HOST_LIBDIRS ?= /usr/lib /lib /usr/sfw/lib
# no -X
LD_X=
LD_x=
RANLIB= :
CPP= /usr/ccs/lib/cpp
RANLIB ?= :
CPP ?= /usr/ccs/lib/cpp
.else
ROOT_GROUP= wheel
RANLIB= ranlib
CPP= cpp
ROOT_GROUP ?= wheel
RANLIB ?= ranlib
CPP ?= cpp
.endif
# the rest is common
@ -45,71 +45,71 @@ CPP= cpp
.LIBS: .a
AR= ar
ARFLAGS= rl
AR ?= ar
ARFLAGS ?= rl
AS= as
AS_STDIN= -
AS ?= as
AS_STDIN ?= -
AFLAGS=
COMPILE.s= ${AS} ${AFLAGS}
LINK.s= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.s ?= ${AS} ${AFLAGS}
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/opt/gnu/bin/gcc) || exists(/usr/local/bin/gcc)
CC ?= gcc -pipe
DBG= -O -g
STATIC= -static
DBG ?= -O -g
STATIC ?= -static
.else
CC ?= cc
DBG= -g
STATIC= -Bstatic
DBG ?= -g
STATIC ?= -Bstatic
.endif
CFLAGS= ${DBG}
COMPILE.c= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX= g++
CXXFLAGS= ${CFLAGS}
COMPILE.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX ?= g++
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
.endif
MK_DEP= mkdeps.sh -N
FC= f77
FFLAGS= -O
MK_DEP ?= mkdeps.sh -N
FC ?= f77
FFLAGS ?= -O
RFLAGS=
COMPILE.f= ${FC} ${FFLAGS} -c
LINK.f= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
LEX= lex
LEX ?= lex
LFLAGS=
LEX.l= ${LEX} ${LFLAGS}
LEX.l ?= ${LEX} ${LFLAGS}
LD= ld
LD ?= ld
LDFLAGS=
LINT= lint
LINTFLAGS= -chapbx
LINT ?= lint
LINTFLAGS ?= -chapbx
PC= pc
PC ?= pc
PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/local/bin/bison) || exists(/opt/gnu/bin/bison)
YACC= bison -y
YACC ?= bison -y
.else
YACC= yacc
YACC ?= yacc
.endif
YFLAGS= -d
YACC.y= ${YACC} ${YFLAGS}
YFLAGS ?= -d
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,16 +1,16 @@
# $Id: UnixWare.mk,v 1.4 2020/04/17 21:08:17 sjg Exp $
# $Id: UnixWare.mk,v 1.6 2020/06/29 14:34:42 sjg Exp $
# based on "Id: SunOS.5.sys.mk,v 1.6 2003/09/30 16:42:23 sjg Exp "
# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
OS?= UnixWare
unix?= We run ${OS}.
ROOT_GROUP= root
OS ?= UnixWare
unix ?= We run ${OS}.
ROOT_GROUP ?= root
# can't fine one anywhere, so just stop the dependency
LIBCRT0= /dev/null
LIBCRT0 ?= /dev/null
PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/ccs/lib:/usr/ucb:/usr/local/bin
PATH ?=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/ccs/lib:/usr/ucb:/usr/local/bin
.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4
@ -19,119 +19,119 @@ PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/ccs/lib:/usr/ucb:/usr/local/bin
# no -X
LD_X=
LD_x=
AR?= ar
ARFLAGS?= rl
RANLIB?= :
AR ?= ar
ARFLAGS ?= rl
RANLIB ?= :
AS?= as
AS_STDIN?= -
AFLAGS?=
COMPILE.s?= ${AS} ${AFLAGS}
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
AS ?= as
AS_STDIN ?= -
AFLAGS ?=
COMPILE.s ?= ${AS} ${AFLAGS}
LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
# at least gcc 2.95 on UnixWare has no internal macro to identify the system
.if exists(/usr/local/bin/gcc)
CC?= gcc -pipe -DUNIXWARE
DBG?= -O -g
STATIC?= -static
CC ?= gcc -pipe -DUNIXWARE
DBG ?= -O -g
STATIC ?= -static
.else
CC?= cc
DBG?= -g
STATIC?= -Bstatic # XXX: don't know about UDK compilers
CC ?= cc
DBG ?= -g
STATIC ?= -Bstatic # XXX: don't know about UDK compilers
.endif
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS ?= ${DBG}
COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/local/bin/g++)
CXX?= g++ -DUNIXWARE
CXX ?= g++ -DUNIXWARE
.else
CXX?= c++ # XXX: don't know about UDK compilers
CXX ?= c++ # XXX: don't know about UDK compilers
.endif
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXXFLAGS ?= ${CFLAGS}
COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= /usr/ccs/lib/cpp
CPP ?= /usr/ccs/lib/cpp
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
.endif
MK_DEP?= mkdeps.sh -N
MK_DEP ?= mkdeps.sh -N
.if exists(/usr/local/bin/g77)
FC?= g77
FC ?= g77
.else
FC?= f77 # XXX: don't know about UDK compilers
FC ?= f77 # XXX: don't know about UDK compilers
.endif
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
FFLAGS ?= -O
RFLAGS ?=
COMPILE.f ?= ${FC} ${FFLAGS} -c
LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= /usr/ucb/install # BSD install
INSTALL ?= /usr/ucb/install # BSD install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LEX ?= lex
LFLAGS ?=
LEX.l ?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LD ?= ld
LDFLAGS ?=
LIBC?= ${DESTDIR}/usr/ccs/lib/libc.a
LIBCOMPAT?=
LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a
LIBCURSES?= ${DESTDIR}/usr/ccs/lib/libcurses.a
LIBDBM?=
LIBDES?=
LIBEDIT?=
LIBGCC?=
LIBKDB?=
LIBKRB?=
LIBKVM?=
LIBL?= ${DESTDIR}/usr/ccs/lib/libl.a
LIBM?= ${DESTDIR}/usr/ccs/lib/libm.a
LIBMP?=
LIBPC?=
LIBPCAP?=
LIBPLOT?=
LIBRESOLV?=
LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a
LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a
LIBTERMCAP?= ${DESTDIR}/usr/ccs/lib/libtermcap.a
LIBUTIL?=
LIBWRAP?=
LIBY?= ${DESTDIR}/usr/ccs/lib/liby.a
LIBZ?=
LIBC ?= ${DESTDIR}/usr/ccs/lib/libc.a
LIBCOMPAT ?=
LIBCRYPT ?= ${DESTDIR}/usr/lib/libcrypt.a
LIBCURSES ?= ${DESTDIR}/usr/ccs/lib/libcurses.a
LIBDBM ?=
LIBDES ?=
LIBEDIT ?=
LIBGCC ?=
LIBKDB ?=
LIBKRB ?=
LIBKVM ?=
LIBL ?= ${DESTDIR}/usr/ccs/lib/libl.a
LIBM ?= ${DESTDIR}/usr/ccs/lib/libm.a
LIBMP ?=
LIBPC ?=
LIBPCAP ?=
LIBPLOT ?=
LIBRESOLV ?=
LIBRPCSVC ?= ${DESTDIR}/usr/lib/librpcsvc.a
LIBSKEY ?= ${DESTDIR}/usr/lib/libskey.a
LIBTERMCAP ?= ${DESTDIR}/usr/ccs/lib/libtermcap.a
LIBUTIL ?=
LIBWRAP ?=
LIBY ?= ${DESTDIR}/usr/ccs/lib/liby.a
LIBZ ?=
LINT?= lint
LINTFLAGS?= -pF
LINT ?= lint
LINTFLAGS ?= -pF
LORDER?= lorder
LORDER ?= lorder
NM?= nm
NM ?= nm
PC?= pc # XXX: UDK probably does not have pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
PC ?= pc # XXX: UDK probably does not have pc
PFLAGS ?=
COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SIZE?= size
SIZE ?= size
TSORT?= tsort
TSORT ?= tsort
.if exists(/usr/local/bin/bison)
YACC?= bison -y
YACC ?= bison -y
.else
YACC?= yacc
YACC ?= yacc
.endif
YFLAGS?= -d
YACC.y?= ${YACC} ${YFLAGS}
YFLAGS ?= -d
YACC.y ?= ${YACC} ${YFLAGS}
# C
.c:

View File

@ -1,4 +1,4 @@
/* $NetBSD: nonints.h,v 1.75 2020/04/25 18:20:57 christos Exp $ */
/* $NetBSD: nonints.h,v 1.78 2020/07/03 07:40:13 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@ -139,7 +139,7 @@ Lst Parse_MainName(void);
char *str_concat(const char *, const char *, int);
char **brk_string(const char *, int *, Boolean, char **);
char *Str_FindSubstring(const char *, const char *);
int Str_Match(const char *, const char *);
Boolean Str_Match(const char *, const char *);
char *Str_SYSVMatch(const char *, const char *, size_t *, Boolean *);
void Str_SYSVSubst(Buffer *, char *, char *, size_t, Boolean);
@ -185,13 +185,20 @@ void Targ_Propagate(void);
void Targ_Propagate_Wait(void);
/* var.c */
typedef enum {
VARF_UNDEFERR = 1,
VARF_WANTRES = 2,
VARF_ASSIGN = 4
} Varf_Flags;
void Var_Delete(const char *, GNode *);
void Var_Set(const char *, const char *, GNode *, int);
void Var_Set(const char *, const char *, GNode *);
void Var_Append(const char *, const char *, GNode *);
Boolean Var_Exists(const char *, GNode *);
char *Var_Value(const char *, GNode *, char **);
char *Var_Parse(const char *, GNode *, int, int *, void **);
char *Var_Subst(const char *, const char *, GNode *, int);
char *Var_Parse(const char *, GNode *, Varf_Flags, int *, void **);
char *Var_Subst(const char *, const char *, GNode *, Varf_Flags);
char *Var_GetTail(const char *);
char *Var_GetHead(const char *);
void Var_Init(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.233 2019/09/26 21:09:55 sjg Exp $ */
/* $NetBSD: parse.c,v 1.236 2020/07/03 08:13:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.233 2019/09/26 21:09:55 sjg Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.236 2020/07/03 08:13:23 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: parse.c,v 1.233 2019/09/26 21:09:55 sjg Exp $");
__RCSID("$NetBSD: parse.c,v 1.236 2020/07/03 08:13:23 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -657,14 +657,14 @@ ParseFindKeyword(const char *str)
diff = strcmp(str, parseKeywords[cur].name);
if (diff == 0) {
return (cur);
return cur;
} else if (diff < 0) {
end = cur - 1;
} else {
start = cur + 1;
}
} while (start <= end);
return (-1);
return -1;
}
/*-
@ -889,7 +889,7 @@ ParseLinkSrc(void *pgnp, void *cgnp)
Targ_PrintNode(pgn, 0);
Targ_PrintNode(cgn, 0);
}
return (0);
return 0;
}
/*-
@ -926,7 +926,7 @@ ParseDoOp(void *gnp, void *opp)
!OP_NOP(gn->type) && !OP_NOP(op))
{
Parse_Error(PARSE_FATAL, "Inconsistent operator for %s", gn->name);
return (1);
return 1;
}
if ((op == OP_DOUBLEDEP) && ((gn->type & OP_OPMASK) == OP_DOUBLEDEP)) {
@ -970,7 +970,7 @@ ParseDoOp(void *gnp, void *opp)
gn->type |= op;
}
return (0);
return 0;
}
/*-
@ -1146,7 +1146,7 @@ static int
ParseAddDir(void *path, void *name)
{
(void)Dir_AddDir((Lst) path, (char *)name);
return(0);
return 0;
}
/*-
@ -1605,7 +1605,7 @@ ParseDoDependency(char *line)
break;
#ifdef POSIX
case Posix:
Var_Set("%POSIX", "1003.2", VAR_GLOBAL, 0);
Var_Set("%POSIX", "1003.2", VAR_GLOBAL);
break;
#endif
default:
@ -1980,13 +1980,13 @@ Parse_DoVar(char *line, GNode *ctxt)
* so that it gets substituted!
*/
if (!Var_Exists(line, ctxt))
Var_Set(line, "", ctxt, 0);
Var_Set(line, "", ctxt);
cp = Var_Subst(NULL, cp, ctxt, VARF_WANTRES|VARF_ASSIGN);
oldVars = oldOldVars;
freeCp = TRUE;
Var_Set(line, cp, ctxt, 0);
Var_Set(line, cp, ctxt);
} else if (type == VAR_SHELL) {
char *res;
const char *error;
@ -2002,7 +2002,7 @@ Parse_DoVar(char *line, GNode *ctxt)
}
res = Cmd_Exec(cp, &error);
Var_Set(line, res, ctxt, 0);
Var_Set(line, res, ctxt);
free(res);
if (error)
@ -2011,7 +2011,7 @@ Parse_DoVar(char *line, GNode *ctxt)
/*
* Normal assignment -- just do it.
*/
Var_Set(line, cp, ctxt, 0);
Var_Set(line, cp, ctxt);
}
if (strcmp(line, MAKEOVERRIDES) == 0)
Main_ExportMAKEFLAGS(FALSE); /* re-export MAKEFLAGS */
@ -2115,7 +2115,7 @@ ParseAddCmd(void *gnp, void *cmd)
gn->name);
#endif
}
return(0);
return 0;
}
/*-
@ -2367,9 +2367,9 @@ ParseSetIncludedFile(void)
char *pd, *dp = NULL;
pf = Var_Value(".PARSEFILE", VAR_GLOBAL, &fp);
Var_Set(".INCLUDEDFROMFILE", pf, VAR_GLOBAL, 0);
Var_Set(".INCLUDEDFROMFILE", pf, VAR_GLOBAL);
pd = Var_Value(".PARSEDIR", VAR_GLOBAL, &dp);
Var_Set(".INCLUDEDFROMDIR", pd, VAR_GLOBAL, 0);
Var_Set(".INCLUDEDFROMDIR", pd, VAR_GLOBAL);
if (DEBUG(PARSE))
fprintf(debug_file, "%s: ${.INCLUDEDFROMDIR} = `%s' "
@ -2401,16 +2401,16 @@ ParseSetParseFile(const char *filename)
slash = strrchr(filename, '/');
if (slash == NULL) {
Var_Set(".PARSEDIR", pd = curdir, VAR_GLOBAL, 0);
Var_Set(".PARSEFILE", pf = filename, VAR_GLOBAL, 0);
Var_Set(".PARSEDIR", pd = curdir, VAR_GLOBAL);
Var_Set(".PARSEFILE", pf = filename, VAR_GLOBAL);
dirname= NULL;
} else {
len = slash - filename;
dirname = bmake_malloc(len + 1);
memcpy(dirname, filename, len);
dirname[len] = '\0';
Var_Set(".PARSEDIR", pd = dirname, VAR_GLOBAL, 0);
Var_Set(".PARSEFILE", pf = slash + 1, VAR_GLOBAL, 0);
Var_Set(".PARSEDIR", pd = dirname, VAR_GLOBAL);
Var_Set(".PARSEFILE", pf = slash + 1, VAR_GLOBAL);
}
if (DEBUG(PARSE))
fprintf(debug_file, "%s: ${.PARSEDIR} = `%s' ${.PARSEFILE} = `%s'\n",
@ -2431,7 +2431,7 @@ ParseTrackInput(const char *name)
char *ep;
char *fp = NULL;
size_t name_len = strlen(name);
old = Var_Value(MAKE_MAKEFILES, VAR_GLOBAL, &fp);
if (old) {
ep = old + strlen(old) - name_len;
@ -2772,7 +2772,7 @@ ParseEOF(void)
/* Restore the PARSEDIR/PARSEFILE variables */
ParseSetParseFile(curFile->fname);
return (CONTINUE);
return CONTINUE;
}
#define PARSE_RAW 1
@ -3009,7 +3009,7 @@ ParseReadLine(void)
/* Read next line from for-loop buffer */
continue;
}
return (line);
return line;
}
}
@ -3119,7 +3119,7 @@ Parse_File(const char *name, int fd)
strncmp(cp, "warning", 7) == 0) {
if (ParseMessage(cp))
continue;
}
}
}
if (*line == '\t') {
@ -3350,7 +3350,7 @@ Parse_MainName(void)
else
(void)Lst_AtEnd(mainList, mainNode);
Var_Append(".TARGETS", mainNode->name, VAR_GLOBAL);
return (mainList);
return mainList;
}
/*-

View File

@ -1,4 +1,4 @@
/* $NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $ */
/* $NetBSD: str.c,v 1.51 2020/07/03 07:40:13 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $";
static char rcsid[] = "$NetBSD: str.c,v 1.51 2020/07/03 07:40:13 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
__RCSID("$NetBSD: str.c,v 1.42 2020/05/06 02:30:10 christos Exp $");
__RCSID("$NetBSD: str.c,v 1.51 2020/07/03 07:40:13 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -119,7 +119,7 @@ str_concat(const char *s1, const char *s2, int flags)
/* copy second string plus EOS into place */
memcpy(result + len1, s2, len2 + 1);
return(result);
return result;
}
/*-
@ -304,7 +304,7 @@ Str_FindSubstring(const char *string, const char *substring)
* substring.
*/
for (b = substring; *string != 0; string += 1) {
for (b = substring; *string != 0; string++) {
if (*string != *b)
continue;
a = string;
@ -320,121 +320,110 @@ Str_FindSubstring(const char *string, const char *substring)
}
/*
* Str_Match --
*
* See if a particular string matches a particular pattern.
*
* Results: Non-zero is returned if string matches pattern, 0 otherwise. The
* matching operation permits the following special characters in the
* pattern: *?\[] (see the man page for details on what these mean).
* Str_Match -- Test if a string matches a pattern like "*.[ch]".
*
* XXX this function does not detect or report malformed patterns.
*
* Results:
* Non-zero is returned if string matches the pattern, 0 otherwise. The
* matching operation permits the following special characters in the
* pattern: *?\[] (as in fnmatch(3)).
*
* Side effects: None.
*/
int
Str_Match(const char *string, const char *pattern)
Boolean
Str_Match(const char *str, const char *pat)
{
char c2;
for (;;) {
/*
* See if we're at the end of both the pattern and the
* string. If, we succeeded. If we're at the end of the
* pattern but not at the end of the string, we failed.
*/
if (*pattern == 0)
return(!*string);
if (*string == 0 && *pattern != '*')
return(0);
/*
* Check for a "*" as the next pattern character. It matches
* any substring. We handle this by calling ourselves
* recursively for each postfix of string, until either we
* match or we reach the end of the string.
*/
if (*pattern == '*') {
pattern += 1;
if (*pattern == 0)
return(1);
while (*string != 0) {
if (Str_Match(string, pattern))
return(1);
++string;
}
return(0);
}
/*
* Check for a "?" as the next pattern character. It matches
* any single character.
*/
if (*pattern == '?')
goto thisCharOK;
/*
* Check for a "[" as the next pattern character. It is
* followed by a list of characters that are acceptable, or
* by a range (two characters separated by "-").
*/
if (*pattern == '[') {
int nomatch;
if (*pat == 0)
return *str == 0;
if (*str == 0 && *pat != '*')
return FALSE;
++pattern;
if (*pattern == '^') {
++pattern;
nomatch = 1;
} else
nomatch = 0;
for (;;) {
if ((*pattern == ']') || (*pattern == 0)) {
if (nomatch)
break;
return(0);
}
if (*pattern == *string)
break;
if (pattern[1] == '-') {
c2 = pattern[2];
if (c2 == 0)
return(nomatch);
if ((*pattern <= *string) &&
(c2 >= *string))
break;
if ((*pattern >= *string) &&
(c2 <= *string))
break;
pattern += 2;
}
++pattern;
/*
* A '*' in the pattern matches any substring. We handle this
* by calling ourselves for each suffix of the string.
*/
if (*pat == '*') {
pat++;
while (*pat == '*')
pat++;
if (*pat == 0)
return TRUE;
while (*str != 0) {
if (Str_Match(str, pat))
return TRUE;
str++;
}
if (nomatch && (*pattern != ']') && (*pattern != 0))
return 0;
while ((*pattern != ']') && (*pattern != 0))
++pattern;
if (*pattern == 0)
--pattern;
return FALSE;
}
/* A '?' in the pattern matches any single character. */
if (*pat == '?')
goto thisCharOK;
/*
* A '[' in the pattern matches a character from a list.
* The '[' is followed by the list of acceptable characters,
* or by ranges (two characters separated by '-'). In these
* character lists, the backslash is an ordinary character.
*/
if (*pat == '[') {
Boolean neg = pat[1] == '^';
pat += 1 + neg;
for (;;) {
if (*pat == ']' || *pat == 0) {
if (neg)
break;
return FALSE;
}
if (*pat == *str)
break;
if (pat[1] == '-') {
if (pat[2] == 0)
return neg;
if (*pat <= *str && pat[2] >= *str)
break;
if (*pat >= *str && pat[2] <= *str)
break;
pat += 2;
}
pat++;
}
if (neg && *pat != ']' && *pat != 0)
return FALSE;
while (*pat != ']' && *pat != 0)
pat++;
if (*pat == 0)
pat--;
goto thisCharOK;
}
/*
* If the next pattern character is '/', just strip off the
* '/' so we do exact matching on the character that follows.
* A backslash in the pattern matches the character following
* it exactly.
*/
if (*pattern == '\\') {
++pattern;
if (*pattern == 0)
return(0);
if (*pat == '\\') {
pat++;
if (*pat == 0)
return FALSE;
}
/*
* There's no special character. Just make sure that the
* next characters of each string match.
*/
if (*pattern != *string)
return(0);
thisCharOK: ++pattern;
++string;
if (*pat != *str)
return FALSE;
thisCharOK:
pat++;
str++;
}
}
/*-
*-----------------------------------------------------------------------
* Str_SYSVMatch --

View File

@ -1,4 +1,4 @@
/* $NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $ */
/* $NetBSD: suff.c,v 1.88 2020/07/03 08:02:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $";
static char rcsid[] = "$NetBSD: suff.c,v 1.88 2020/07/03 08:02:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
#else
__RCSID("$NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $");
__RCSID("$NetBSD: suff.c,v 1.88 2020/07/03 08:02:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -266,7 +266,7 @@ SuffStrIsPrefix(const char *pref, const char *str)
str++;
}
return (*pref ? NULL : str);
return *pref ? NULL : str;
}
/*-
@ -304,7 +304,7 @@ SuffSuffIsSuffix(const Suff *s, const SuffixCmpData *sd)
p2--;
}
return (p1 == s->name - 1 ? p2 : NULL);
return p1 == s->name - 1 ? p2 : NULL;
}
/*-
@ -324,7 +324,7 @@ SuffSuffIsSuffix(const Suff *s, const SuffixCmpData *sd)
static int
SuffSuffIsSuffixP(const void *s, const void *sd)
{
return(!SuffSuffIsSuffix(s, sd));
return !SuffSuffIsSuffix(s, sd);
}
/*-
@ -347,7 +347,7 @@ SuffSuffIsSuffixP(const void *s, const void *sd)
static int
SuffSuffHasNameP(const void *s, const void *sname)
{
return (strcmp(sname, ((const Suff *)s)->name));
return strcmp(sname, ((const Suff *)s)->name);
}
/*-
@ -394,7 +394,7 @@ SuffSuffIsPrefix(const void *s, const void *str)
static int
SuffGNHasNameP(const void *gn, const void *name)
{
return (strcmp(name, ((const GNode *)gn)->name));
return strcmp(name, ((const GNode *)gn)->name);
}
/*********** Maintenance Functions ************/
@ -632,9 +632,9 @@ SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
*/
*srcPtr = single;
*targPtr = suffNull;
return(TRUE);
return TRUE;
}
return (FALSE);
return FALSE;
}
src = (Suff *)Lst_Datum(srcLn);
str2 = str + src->nameLen;
@ -646,7 +646,7 @@ SuffParseTransform(char *str, Suff **srcPtr, Suff **targPtr)
if (targLn != NULL) {
*srcPtr = src;
*targPtr = (Suff *)Lst_Datum(targLn);
return (TRUE);
return TRUE;
}
}
}
@ -674,7 +674,7 @@ Suff_IsTransform(char *str)
{
Suff *src, *targ;
return (SuffParseTransform(str, &src, &targ));
return SuffParseTransform(str, &src, &targ);
}
/*-
@ -738,7 +738,7 @@ Suff_AddTransform(char *line)
SuffInsert(t->children, s);
SuffInsert(s->parents, t);
return (gn);
return gn;
}
/*-
@ -860,7 +860,7 @@ SuffRebuildGraph(void *transformp, void *sp)
s2 = (Suff *)Lst_Datum(ln);
SuffInsert(s2->children, s);
SuffInsert(s->parents, s2);
return(0);
return 0;
}
}
@ -889,7 +889,7 @@ SuffRebuildGraph(void *transformp, void *sp)
SuffInsert(s2->parents, s);
}
}
return(0);
return 0;
}
/*-
@ -1035,7 +1035,7 @@ Suff_GetPath(char *sname)
return NULL;
} else {
s = (Suff *)Lst_Datum(ln);
return (s->searchPath);
return s->searchPath;
}
}
@ -1093,9 +1093,9 @@ Suff_DoPaths(void)
}
}
Var_Set(".INCLUDES", ptr = Dir_MakeFlags("-I", inIncludes), VAR_GLOBAL, 0);
Var_Set(".INCLUDES", ptr = Dir_MakeFlags("-I", inIncludes), VAR_GLOBAL);
free(ptr);
Var_Set(".LIBS", ptr = Dir_MakeFlags("-L", inLibs), VAR_GLOBAL, 0);
Var_Set(".LIBS", ptr = Dir_MakeFlags("-L", inLibs), VAR_GLOBAL);
free(ptr);
Lst_Destroy(inIncludes, Dir_Destroy);
@ -1239,7 +1239,7 @@ SuffAddSrc(void *sp, void *lsp)
fprintf(debug_file, "\n");
#endif
return(0);
return 0;
}
/*-
@ -1399,7 +1399,7 @@ SuffFindThem(Lst srcs, Lst slst)
if (DEBUG(SUFF) && rs) {
fprintf(debug_file, "got it\n");
}
return (rs);
return rs;
}
/*-
@ -1505,7 +1505,7 @@ SuffFindCmds(Src *targ, Lst slst)
if (DEBUG(SUFF)) {
fprintf(debug_file, "\tusing existing source %s\n", s->name);
}
return (ret);
return ret;
}
/*-
@ -1831,7 +1831,7 @@ SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
* called to link an OP_MEMBER and OP_ARCHV node), so return
* FALSE.
*/
return(FALSE);
return FALSE;
}
gn = (GNode *)Lst_Datum(ln);
@ -1864,7 +1864,7 @@ SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
*/
(void)Lst_AtEnd(sGn->iParents, tGn);
return(TRUE);
return TRUE;
}
@ -1941,7 +1941,7 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
*/
for (i = (sizeof(copy)/sizeof(copy[0]))-1; i >= 0; i--) {
char *p1;
Var_Set(copy[i], Var_Value(copy[i], mem, &p1), gn, 0);
Var_Set(copy[i], Var_Value(copy[i], mem, &p1), gn);
free(p1);
}
@ -1961,13 +1961,13 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
/*
* Set the other two local variables required for this target.
*/
Var_Set(MEMBER, name, gn, 0);
Var_Set(ARCHIVE, gn->name, gn, 0);
Var_Set(MEMBER, name, gn);
Var_Set(ARCHIVE, gn->name, gn);
/*
* Set $@ for compatibility with other makes
*/
Var_Set(TARGET, gn->name, gn, 0);
Var_Set(TARGET, gn->name, gn);
/*
* Now we've got the important local variables set, expand any sources
@ -2213,10 +2213,10 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
}
}
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn, 0);
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn);
pref = (targ != NULL) ? targ->pref : gn->name;
Var_Set(PREFIX, pref, gn, 0);
Var_Set(PREFIX, pref, gn);
/*
* Now we've got the important local variables set, expand any sources
@ -2246,7 +2246,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
targ->suff->searchPath));
if (gn->path != NULL) {
char *ptr;
Var_Set(TARGET, gn->path, gn, 0);
Var_Set(TARGET, gn->path, gn);
if (targ != NULL) {
/*
@ -2269,7 +2269,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
else
ptr = gn->path;
Var_Set(PREFIX, ptr, gn, 0);
Var_Set(PREFIX, ptr, gn);
gn->path[savep] = savec;
} else {
@ -2286,7 +2286,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
else
ptr = gn->path;
Var_Set(PREFIX, ptr, gn, 0);
Var_Set(PREFIX, ptr, gn);
}
}
}
@ -2373,9 +2373,9 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
*/
targ->node->type |= OP_DEPS_FOUND;
Var_Set(PREFIX, targ->pref, targ->node, 0);
Var_Set(PREFIX, targ->pref, targ->node);
Var_Set(TARGET, targ->node->name, targ->node, 0);
Var_Set(TARGET, targ->node->name, targ->node);
}
}
@ -2458,8 +2458,8 @@ SuffFindDeps(GNode *gn, Lst slst)
/*
* Make sure we have these set, may get revised below.
*/
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn, 0);
Var_Set(PREFIX, gn->name, gn, 0);
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn);
Var_Set(PREFIX, gn->name, gn);
if (DEBUG(SUFF)) {
fprintf(debug_file, "SuffFindDeps (%s)\n", gn->name);
@ -2488,14 +2488,14 @@ SuffFindDeps(GNode *gn, Lst slst)
Arch_FindLib(gn, s->searchPath);
} else {
gn->suffix = NULL;
Var_Set(TARGET, gn->name, gn, 0);
Var_Set(TARGET, gn->name, gn);
}
/*
* Because a library (-lfoo) target doesn't follow the standard
* filesystem conventions, we don't set the regular variables for
* the thing. .PREFIX is simply made empty...
*/
Var_Set(PREFIX, "", gn, 0);
Var_Set(PREFIX, "", gn);
} else {
SuffFindNormalDeps(gn, slst);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: targ.c,v 1.62 2017/04/16 19:53:58 riastradh Exp $ */
/* $NetBSD: targ.c,v 1.63 2020/07/03 08:02:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: targ.c,v 1.62 2017/04/16 19:53:58 riastradh Exp $";
static char rcsid[] = "$NetBSD: targ.c,v 1.63 2020/07/03 08:02:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: targ.c,v 1.62 2017/04/16 19:53:58 riastradh Exp $");
__RCSID("$NetBSD: targ.c,v 1.63 2020/07/03 08:02:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@ -269,7 +269,7 @@ Targ_NewGN(const char *name)
Lst_AtEnd(allGNs, gn);
#endif
return (gn);
return gn;
}
#ifdef CLEANUP
@ -389,7 +389,7 @@ Targ_FindList(Lst names, int flags)
nodes = Lst_Init(FALSE);
if (Lst_Open(names) == FAILURE) {
return (nodes);
return nodes;
}
while ((ln = Lst_Next(names)) != NULL) {
name = (char *)Lst_Datum(ln);
@ -406,7 +406,7 @@ Targ_FindList(Lst names, int flags)
}
}
Lst_Close(names);
return (nodes);
return nodes;
}
/*-
@ -428,9 +428,9 @@ Boolean
Targ_Ignore(GNode *gn)
{
if (ignoreErrors || gn->type & OP_IGNORE) {
return (TRUE);
return TRUE;
} else {
return (FALSE);
return FALSE;
}
}
@ -453,9 +453,9 @@ Boolean
Targ_Silent(GNode *gn)
{
if (beSilent || gn->type & OP_SILENT) {
return (TRUE);
return TRUE;
} else {
return (FALSE);
return FALSE;
}
}
@ -478,9 +478,9 @@ Boolean
Targ_Precious(GNode *gn)
{
if (allPrecious || (gn->type & (OP_PRECIOUS|OP_DOUBLEDEP))) {
return (TRUE);
return TRUE;
} else {
return (FALSE);
return FALSE;
}
}
@ -549,7 +549,7 @@ Targ_FmtTime(time_t tm)
parts = localtime(&tm);
(void)strftime(buf, sizeof buf, "%k:%M:%S %b %d, %Y", parts);
return(buf);
return buf;
}
/*-
@ -698,7 +698,7 @@ Targ_PrintNode(void *gnp, void *passp)
Lst_ForEach(gn->cohorts, Targ_PrintNode, &pass);
}
}
return (0);
return 0;
}
/*-
@ -794,7 +794,7 @@ TargPropagateNode(void *gnp, void *junk MAKE_ATTR_UNUSED)
if (gn->type & OP_DOUBLEDEP)
Lst_ForEach(gn->cohorts, TargPropagateCohort, gnp);
return (0);
return 0;
}
/*-
@ -822,7 +822,7 @@ TargPropagateCohort(void *cgnp, void *pgnp)
GNode *pgn = (GNode *)pgnp;
cgn->type |= pgn->type & ~OP_OPMASK;
return (0);
return 0;
}
/*-

View File

@ -1,4 +1,4 @@
/* $NetBSD: trace.c,v 1.11 2008/12/28 18:31:51 christos Exp $ */
/* $NetBSD: trace.c,v 1.12 2020/07/03 08:13:23 rillig Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -31,11 +31,11 @@
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: trace.c,v 1.11 2008/12/28 18:31:51 christos Exp $";
static char rcsid[] = "$NetBSD: trace.c,v 1.12 2020/07/03 08:13:23 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: trace.c,v 1.11 2008/12/28 18:31:51 christos Exp $");
__RCSID("$NetBSD: trace.c,v 1.12 2020/07/03 08:13:23 rillig Exp $");
#endif /* not lint */
#endif
@ -90,7 +90,7 @@ void
Trace_Log(TrEvent event, Job *job)
{
struct timeval rightnow;
if (trfile == NULL)
return;

View File

@ -1,86 +1,105 @@
# $Id: Makefile,v 1.54 2020/05/17 17:26:14 sjg Exp $
# $Id: Makefile,v 1.60 2020/07/10 00:48:32 sjg Exp $
#
# $NetBSD: Makefile,v 1.58 2020/05/17 12:36:26 rillig Exp $
# $NetBSD: Makefile,v 1.63 2020/07/09 22:40:14 sjg Exp $
#
# Unit tests for make(1)
# The main targets are:
#
# all: run all the tests
# test: run 'all', and compare to expected results
# accept: move generated output to expected results
#
# Adding a test case.
# The main targets are:
#
# all:
# run all the tests
# test:
# run 'all', and compare to expected results
# accept:
# move generated output to expected results
#
# Settable variables
#
# TEST_MAKE
# The make program to be tested.
#
#
# Adding a test case
#
# Each feature should get its own set of tests in its own suitably
# named makefile (*.mk), with its own set of expected results (*.exp),
# and it should be added to the TESTNAMES list.
#
# and it should be added to the TESTS list.
#
# Any added files must also be added to src/distrib/sets/lists/tests/mi.
# Makefiles that are not added to TESTS must be ignored in
# src/tests/usr.bin/make/t_make.sh (example: include-sub).
#
# Each test is in a sub-makefile.
# Keep the list sorted.
TESTS+= comment
TESTS+= cond-late
TESTS+= cond-short
TESTS+= cond1
TESTS+= cond2
TESTS+= dollar
TESTS+= doterror
TESTS+= dotwait
TESTS+= error
TESTS+= # escape # broken by reverting POSIX changes
TESTS+= export
TESTS+= export-all
TESTS+= export-env
TESTS+= forloop
TESTS+= forsubst
TESTS+= hash
TESTS+= # impsrc # broken by reverting POSIX changes
TESTS+= include-main
TESTS+= misc
TESTS+= moderrs
TESTS+= modmatch
TESTS+= modmisc
TESTS+= modorder
TESTS+= modts
TESTS+= modword
TESTS+= order
TESTS+= # phony-end # broken by reverting POSIX changes
TESTS+= posix
TESTS+= # posix1 # broken by reverting POSIX changes
TESTS+= qequals
TESTS+= # suffixes # broken by reverting POSIX changes
TESTS+= sunshcmd
TESTS+= sysv
TESTS+= ternary
TESTS+= unexport
TESTS+= unexport-env
TESTS+= varcmd
TESTS+= varmisc
TESTS+= varmod-edge
TESTS+= varquote
TESTS+= varshell
# Override make flags for certain tests; default is -k.
FLAGS.doterror= # none
FLAGS.order= -j1
# Some tests need extra post-processing.
SED_CMDS.modmisc+= -e 's,\(substitution error:\).*,\1 (details omitted),'
SED_CMDS.varshell+= -e 's,^[a-z]*sh: ,,'
SED_CMDS.varshell+= -e '/command/s,No such.*,not found,'
# End of the configuration section.
.MAIN: all
.-include "Makefile.config"
UNIT_TESTS:= ${.PARSEDIR}
UNIT_TESTS:= ${.PARSEDIR}
.PATH: ${UNIT_TESTS}
# Each test is in a sub-makefile.
# Keep the list sorted.
TESTNAMES= \
comment \
cond-late \
cond1 \
cond2 \
dollar \
doterror \
dotwait \
error \
export \
export-all \
export-env \
forloop \
forsubst \
hash \
include-main \
misc \
moderrs \
modmatch \
modmisc \
modorder \
modts \
modword \
order \
posix \
qequals \
sunshcmd \
sysv \
ternary \
unexport \
unexport-env \
varcmd \
varmisc \
varmod-edge \
varquote \
varshell
# these tests were broken by referting POSIX chanegs
STRICT_POSIX_TESTS = \
escape \
impsrc \
phony-end \
posix1 \
suffixes
# Override make flags for certain tests
flags.doterror=
flags.order=-j1
OUTFILES= ${TESTNAMES:S/$/.out/}
OUTFILES= ${TESTS:=.out}
all: ${OUTFILES}
CLEANFILES += *.rawout *.out *.status *.tmp *.core *.tmp
CLEANFILES += obj*.[och] lib*.a # posix1.mk
CLEANFILES += issue* .[ab]* # suffixes.mk
CLEANRECURSIVE += dir dummy # posix1.mk
CLEANFILES+= *.rawout *.out *.status *.tmp *.core *.tmp
CLEANFILES+= obj*.[och] lib*.a # posix1.mk
CLEANFILES+= issue* .[ab]* # suffixes.mk
CLEANRECURSIVE+= dir dummy # posix1.mk
clean:
rm -f ${CLEANFILES}
@ -88,42 +107,42 @@ clean:
rm -rf ${CLEANRECURSIVE}
.endif
TEST_MAKE?= ${.MAKE}
TOOL_SED?= sed
TOOL_TR?= tr
TOOL_DIFF?= diff
TEST_MAKE?= ${.MAKE}
TOOL_SED?= sed
TOOL_TR?= tr
TOOL_DIFF?= diff
DIFF_FLAGS?= -u
.if defined(.PARSEDIR)
# ensure consistent results from sort(1)
LC_ALL= C
LANG= C
LC_ALL= C
LANG= C
.export LANG LC_ALL
.endif
# some tests need extra post-processing
SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
-e '/command/s,No such.*,not found,'
# the tests are actually done with sub-makes.
.SUFFIXES: .mk .rawout .out
.mk.rawout:
@echo ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC}
@echo ${TEST_MAKE} ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC}
-@cd ${.OBJDIR} && \
{ ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC} \
{ ${TEST_MAKE} ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC} \
2>&1 ; echo $$? >${.TARGET:R}.status ; } > ${.TARGET}.tmp
@mv ${.TARGET}.tmp ${.TARGET}
# We always pretend .MAKE was called 'make'
# and strip ${.CURDIR}/ from the output
# and replace anything after 'stopped in' with unit-tests
# so the results can be compared.
# Post-process the test output so that the results can be compared.
#
# always pretend .MAKE was called 'make'
_SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
_SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,'
# replace anything after 'stopped in' with unit-tests
_SED_CMDS+= -e '/stopped/s, /.*, unit-tests,'
# strip ${.CURDIR}/ from the output
_SED_CMDS+= -e 's,${.CURDIR:S,.,\\.,g}/,,g'
_SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
.rawout.out:
@echo postprocess ${.TARGET}
@${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}[][0-9]*:,make:,' \
-e 's,${TEST_MAKE:C/\./\\\./g},make,' \
-e '/stopped/s, /.*, unit-tests,' \
-e 's,${.CURDIR:C/\./\\\./g}/,,g' \
-e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' ${SED_CMDS.${.TARGET:T:R}} \
@${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.TARGET:R}} \
< ${.IMPSRC} > ${.TARGET}.tmp
@echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp
@mv ${.TARGET}.tmp ${.TARGET}
@ -131,7 +150,7 @@ SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
# Compare all output files
test: ${OUTFILES} .PHONY
@failed= ; \
for test in ${TESTNAMES}; do \
for test in ${TESTS}; do \
${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
|| failed="$${failed}$${failed:+ }$${test}" ; \
done ; \
@ -142,14 +161,14 @@ test: ${OUTFILES} .PHONY
fi
accept:
@for test in ${TESTNAMES}; do \
@for test in ${TESTS}; do \
cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
|| { echo "Replacing $${test}.exp" ; \
cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
done
.if exists(${TEST_MAKE})
${TESTNAMES:S/$/.rawout/}: ${TEST_MAKE}
${TESTS:=.rawout}: ${TEST_MAKE}
.endif
.-include <obj.mk>

View File

@ -0,0 +1,16 @@
expected and
expected and exists
expected and empty
expected U23 condition
expected VAR23
expected M pattern
expected or
expected or exists
expected or empty
defined(V42) && 42 > 0: Ok
defined(V66) && ( "" < 42 ): Ok
1 || 42 < 42: Ok
1 || < 42: Ok
0 || 42 <= 42: Ok
0 || < 42: Ok
exit status 0

View File

@ -0,0 +1,153 @@
# $NetBSD: cond-short.mk,v 1.7 2020/07/09 22:34:09 sjg Exp $
#
# Demonstrates that in conditions, the right-hand side of an && or ||
# is only evaluated if it can actually influence the result.
#
# Between 2015-10-11 and 2020-06-28, the right-hand side of an && or ||
# operator was always evaluated, which was wrong.
#
# The && operator.
.if 0 && ${echo "unexpected and" 1>&2 :L:sh}
.endif
.if 1 && ${echo "expected and" 1>&2 :L:sh}
.endif
.if 0 && exists(nonexistent${echo "unexpected and exists" 1>&2 :L:sh})
.endif
.if 1 && exists(nonexistent${echo "expected and exists" 1>&2 :L:sh})
.endif
.if 0 && empty(${echo "unexpected and empty" 1>&2 :L:sh})
.endif
.if 1 && empty(${echo "expected and empty" 1>&2 :L:sh})
.endif
# "VAR U11" is not evaluated; it was evaluated before 2020-07-02.
# The whole !empty condition is only parsed and then discarded.
VAR= ${VAR${:U11${echo "unexpected VAR U11" 1>&2 :L:sh}}}
VAR13= ${VAR${:U12${echo "unexpected VAR13" 1>&2 :L:sh}}}
.if 0 && !empty(VAR${:U13${echo "unexpected U13 condition" 1>&2 :L:sh}})
.endif
VAR= ${VAR${:U21${echo "unexpected VAR U21" 1>&2 :L:sh}}}
VAR23= ${VAR${:U22${echo "expected VAR23" 1>&2 :L:sh}}}
.if 1 && !empty(VAR${:U23${echo "expected U23 condition" 1>&2 :L:sh}})
.endif
VAR= # empty again, for the following tests
# The :M modifier is only parsed, not evaluated.
# Before 2020-07-02, it was wrongly evaluated.
.if 0 && !empty(VAR:M${:U${echo "unexpected M pattern" 1>&2 :L:sh}})
.endif
.if 1 && !empty(VAR:M${:U${echo "expected M pattern" 1>&2 :L:sh}})
.endif
.if 0 && !empty(VAR:S,from,${:U${echo "unexpected S modifier" 1>&2 :L:sh}},)
.endif
.if 0 && !empty(VAR:C,from,${:U${echo "unexpected C modifier" 1>&2 :L:sh}},)
.endif
.if 0 && !empty("" == "" :? ${:U${echo "unexpected ? modifier" 1>&2 :L:sh}} :)
.endif
.if 0 && !empty(VAR:old=${:U${echo "unexpected = modifier" 1>&2 :L:sh}})
.endif
.if 0 && !empty(1 2 3:L:@var@${:U${echo "unexpected @ modifier" 1>&2 :L:sh}}@)
.endif
.if 0 && !empty(:U${:!echo "unexpected exclam modifier" 1>&2 !})
.endif
# The || operator.
.if 1 || ${echo "unexpected or" 1>&2 :L:sh}
.endif
.if 0 || ${echo "expected or" 1>&2 :L:sh}
.endif
.if 1 || exists(nonexistent${echo "unexpected or exists" 1>&2 :L:sh})
.endif
.if 0 || exists(nonexistent${echo "expected or exists" 1>&2 :L:sh})
.endif
.if 1 || empty(${echo "unexpected or empty" 1>&2 :L:sh})
.endif
.if 0 || empty(${echo "expected or empty" 1>&2 :L:sh})
.endif
# Unreachable nested conditions are skipped completely as well.
.if 0
. if ${echo "unexpected nested and" 1>&2 :L:sh}
. endif
.endif
.if 1
.elif ${echo "unexpected nested or" 1>&2 :L:sh}
.endif
# make sure these do not cause complaint
#.MAKEFLAGS: -dc
V42 = 42
iV1 = ${V42}
iV2 = ${V66}
.if defined(V42) && ${V42} > 0
x=Ok
.else
x=Fail
.endif
x!= echo 'defined(V42) && ${V42} > 0: $x' >&2; echo
# this one throws both String comparison operator and
# Malformed conditional with cond.c 1.78
# indirect iV2 would expand to "" and treated as 0
.if defined(V66) && ( ${iV2} < ${V42} )
x=Fail
.else
x=Ok
.endif
x!= echo 'defined(V66) && ( "${iV2}" < ${V42} ): $x' >&2; echo
# next two thow String comparison operator with cond.c 1.78
# indirect iV1 would expand to 42
.if 1 || ${iV1} < ${V42}
x=Ok
.else
x=Fail
.endif
x!= echo '1 || ${iV1} < ${V42}: $x' >&2; echo
.if 1 || ${iV2:U2} < ${V42}
x=Ok
.else
x=Fail
.endif
x!= echo '1 || ${iV2:U2} < ${V42}: $x' >&2; echo
# the same expressions are fine when the lhs is expanded
# ${iV1} expands to 42
.if 0 || ${iV1} <= ${V42}
x=Ok
.else
x=Fail
.endif
x!= echo '0 || ${iV1} <= ${V42}: $x' >&2; echo
# ${iV2:U2} expands to 2
.if 0 || ${iV2:U2} < ${V42}
x=Ok
.else
x=Fail
.endif
x!= echo '0 || ${iV2:U2} < ${V42}: $x' >&2; echo
all:
@:;:

View File

@ -15,7 +15,7 @@ res = no
res = OK
.endif
all: show-libs check-cclass
all: show-libs check-cclass slow
show-libs:
@for x in $X; do ${.MAKE} -f ${MAKEFILE} show LIB=$$x; done
@ -32,3 +32,8 @@ check-cclass:
@echo Upper=${LIST:M[A-Z]*}
@echo Lower=${LIST:M[^A-Z]*}
@echo nose=${LIST:M[^s]*[ex]}
# Before 2020-06-13, this expression took quite a long time in Str_Match,
# calling itself 601080390 times for 16 asterisks.
slow: .PHONY
@:;: ${:U****************:M****************b:Q}

View File

@ -7,4 +7,45 @@ path_/usr/xbin=/opt/xbin/
paths=/bin /tmp / /no/such/dir /opt/xbin
PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN
The answer is 42
dirname of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'a/b . . a.b . . . . .'
basename of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'c def a.b.c c a a.a .gitignore a a.a'
suffix of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'c b/c a gitignore a'
root of 'a/b/c def a.b.c a.b/c a a.a .gitignore a a.a' is 'a/b/c def a.b a a a a a'
S:
C:
@:
S:empty
C:empty
@:
:a b b c:
:a b b c:
: b c:
:a c:
:x__ 3 x__ 3:
:a b b c:
:a b b c:
: b c:
make: RE substitution error: (details omitted)
make: Unclosed substitution for (, missing)
:C,word,____,:Q}:
:a c:
:x__ 3 x__ 3:
:+one+ +two+ +three+:
mod-at-resolve:w1d2d3w w2i3w w1i2d3 2i${RES3}w w1d2d3 2i${RES3} 1i${RES2}w:
mod-subst-dollar:$1:
mod-subst-dollar:$2:
mod-subst-dollar:$3:
mod-subst-dollar:$4:
mod-subst-dollar:$5:
mod-subst-dollar:$6:
mod-subst-dollar:$7:
mod-subst-dollar:$8:
mod-subst-dollar:U8:
mod-subst-dollar:$$$$:
mod-loop-dollar:1:
mod-loop-dollar:${word}:
mod-loop-dollar:$3$:
mod-loop-dollar:$${word}$:
mod-loop-dollar:$$5$$:
mod-loop-dollar:$$${word}$$:
exit status 0

View File

@ -1,4 +1,4 @@
# $Id: modmisc.mk,v 1.1.1.1 2014/08/30 18:57:18 sjg Exp $
# $Id: modmisc.mk,v 1.1.1.3 2020/07/09 22:35:19 sjg Exp $
#
# miscellaneous modifier tests
@ -15,7 +15,9 @@ MOD_HOMES=S,/home/,/homes/,
MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/usr,/opt,}}@
MOD_SEP=S,:, ,g
all: modvar modvarloop modsysv
all: modvar modvarloop modsysv mod-HTE emptyvar undefvar
all: mod-S mod-C mod-at-varname mod-at-resolve
all: mod-subst-dollar mod-loop-dollar
modsysv:
@echo "The answer is ${libfoo.a:L:libfoo.a=42}"
@ -36,3 +38,90 @@ modvarloop:
@echo "path_/usr/xbin=${path_/usr/xbin}"
@echo "paths=${paths}"
@echo "PATHS=${paths:tu}"
PATHNAMES= a/b/c def a.b.c a.b/c a a.a .gitignore a a.a
mod-HTE:
@echo "dirname of '"${PATHNAMES:Q}"' is '"${PATHNAMES:H:Q}"'"
@echo "basename of '"${PATHNAMES:Q}"' is '"${PATHNAMES:T:Q}"'"
@echo "suffix of '"${PATHNAMES:Q}"' is '"${PATHNAMES:E:Q}"'"
@echo "root of '"${PATHNAMES:Q}"' is '"${PATHNAMES:R:Q}"'"
# When a modifier is applied to the "" variable, the result is discarded.
emptyvar:
@echo S:${:S,^$,empty,}
@echo C:${:C,^$,empty,}
@echo @:${:@var@${var}@}
# The :U modifier turns even the "" variable into something that has a value.
# The resulting variable is empty, but is still considered to contain a
# single empty word. This word can be accessed by the :S and :C modifiers,
# but not by the :@ modifier since it explicitly skips empty words.
undefvar:
@echo S:${:U:S,^$,empty,}
@echo C:${:U:C,^$,empty,}
@echo @:${:U:@var@empty@}
mod-S:
@echo :${:Ua b b c:S,a b,,:Q}:
@echo :${:Ua b b c:S,a b,,1:Q}:
@echo :${:Ua b b c:S,a b,,W:Q}:
@echo :${:Ua b b c:S,b,,g:Q}:
@echo :${:U1 2 3 1 2 3:S,1 2,___,Wg:S,_,x,:Q}:
mod-C:
@echo :${:Ua b b c:C,a b,,:Q}:
@echo :${:Ua b b c:C,a b,,1:Q}:
@echo :${:Ua b b c:C,a b,,W:Q}:
@echo :${:Uword1 word2:C,****,____,g:C,word,____,:Q}:
@echo :${:Ua b b c:C,b,,g:Q}:
@echo :${:U1 2 3 1 2 3:C,1 2,___,Wg:C,_,x,:Q}:
# In the :@ modifier, the name of the loop variable can even be generated
# dynamically. There's no practical use-case for this, and hopefully nobody
# will ever depend on this, but technically it's possible.
mod-at-varname:
@echo :${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@:Q}:
# The :@ modifier resolves the variables a little more often than expected.
# In particular, it resolves _all_ variables from the context, and not only
# the loop variable (in this case v).
#
# The d means direct reference, the i means indirect reference.
RESOLVE= ${RES1} $${RES1}
RES1= 1d${RES2} 1i$${RES2}
RES2= 2d${RES3} 2i$${RES3}
RES3= 3
mod-at-resolve:
@echo $@:${RESOLVE:@v@w${v}w@:Q}:
# No matter how many dollar characters there are, they all get merged
# into a single dollar by the :S modifier.
mod-subst-dollar:
@echo $@:${:U1:S,^,$,:Q}:
@echo $@:${:U2:S,^,$$,:Q}:
@echo $@:${:U3:S,^,$$$,:Q}:
@echo $@:${:U4:S,^,$$$$,:Q}:
@echo $@:${:U5:S,^,$$$$$,:Q}:
@echo $@:${:U6:S,^,$$$$$$,:Q}:
@echo $@:${:U7:S,^,$$$$$$$,:Q}:
@echo $@:${:U8:S,^,$$$$$$$$,:Q}:
# This generates no dollar at all:
@echo $@:${:UU8:S,^,${:U$$$$$$$$},:Q}:
# Here is an alternative way to generate dollar characters.
# It's unexpectedly complicated though.
@echo $@:${:U:range=5:ts\x24:C,[0-9],,g:Q}:
# Demonstrate that it is possible to generate dollar characters using the
# :@ modifier.
#
# These are edge cases that could have resulted in a parse error as well
# since the $@ at the end could have been interpreted as a variable, which
# would mean a missing closing @ delimiter.
mod-loop-dollar:
@echo $@:${:U1:@word@${word}$@:Q}:
@echo $@:${:U2:@word@$${word}$$@:Q}:
@echo $@:${:U3:@word@$$${word}$$$@:Q}:
@echo $@:${:U4:@word@$$$${word}$$$$@:Q}:
@echo $@:${:U5:@word@$$$$${word}$$$$$@:Q}:
@echo $@:${:U6:@word@$$$$$${word}$$$$$$@:Q}:

View File

@ -1,5 +1,6 @@
LIST = one two three four five six seven eight nine ten
LIST:O = eight five four nine one seven six ten three two
LIST:Or = two three ten six seven one nine four five eight
LIST:Ox = Ok
LIST:O:Ox = Ok
LISTX = Ok

View File

@ -1,4 +1,4 @@
# $NetBSD: modorder.mk,v 1.2 2020/01/07 22:42:14 rillig Exp $
# $NetBSD: modorder.mk,v 1.3 2020/06/09 01:48:17 sjg Exp $
LIST= one two three four five six seven eight nine ten
LISTX= ${LIST:Ox}
@ -10,6 +10,7 @@ TEST_RESULT= && echo Ok || echo Failed
all:
@echo "LIST = ${LIST}"
@echo "LIST:O = ${LIST:O}"
@echo "LIST:Or = ${LIST:Or}"
# Note that 1 in every 10! trials two independently generated
# randomized orderings will be the same. The test framework doesn't
# support checking probabilistic output, so we accept that each of the

View File

@ -12,4 +12,5 @@ asam.c.c
asam.c
a.c.c
ax:Q b c d eb
exit status 0

View File

@ -1,4 +1,4 @@
# $Id: sysv.mk,v 1.4 2020/05/07 01:17:51 sjg Exp $
# $Id: sysv.mk,v 1.5 2020/07/04 18:16:55 sjg Exp $
FOO ?=
FOOBAR = ${FOO:=bar}
@ -11,7 +11,7 @@ FUN = ${B}${S}fun
SUN = the Sun
# we expect nothing when FOO is empty
all: foo fun sam bla
all: foo fun sam bla words
foo:
@echo FOOBAR = ${FOOBAR}
@ -41,3 +41,8 @@ BLA=
bla:
@echo $(BLA:%=foo/%x)
# The :Q looks like a modifier but isn't.
# It is part of the replacement string.
words:
@echo a${a b c d e:L:%a=x:Q}b

View File

@ -22,4 +22,5 @@ date=20160401
Version=123.456.789 == 123456789
Literal=3.4.5 == 3004005
We have target specific vars
MAN= make.1
exit status 0

View File

@ -1,9 +1,9 @@
# $Id: varmisc.mk,v 1.9 2017/02/01 18:44:54 sjg Exp $
# $Id: varmisc.mk,v 1.11 2020/07/02 15:43:43 sjg Exp $
#
# Miscellaneous variable tests.
all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \
strftime cmpv
strftime cmpv manok
unmatched_var_paren:
@echo ${foo::=foo-text}
@ -60,3 +60,25 @@ cmpv:
@echo Version=${Version} == ${Version:${M_cmpv}}
@echo Literal=3.4.5 == ${3.4.5:L:${M_cmpv}}
@echo We have ${${.TARGET:T}.only}
# catch misshandling of nested vars in .for loop
MAN=
MAN1= make.1
.for s in 1 2
.if defined(MAN$s) && !empty(MAN$s)
MAN+= ${MAN$s}
.endif
.endfor
manok:
@echo MAN=${MAN}
# This is an expanded variant of the above .for loop.
# Between 2020-08-28 and 2020-07-02 this paragraph generated a wrong
# error message "Variable VARNAME is recursive".
# When evaluating the !empty expression, the ${:U1} was not expanded and
# thus resulted in the seeming definition VARNAME=${VARNAME}, which is
# obviously recursive.
VARNAME= ${VARNAME${:U1}}
.if defined(VARNAME${:U2}) && !empty(VARNAME${:U2})
.endif

View File

@ -1,9 +1,9 @@
/* $NetBSD: util.c,v 1.55 2020/01/07 21:24:16 rillig Exp $ */
/* $NetBSD: util.c,v 1.57 2020/07/03 08:13:23 rillig Exp $ */
/*
* Missing stuff from OS's
*
* $Id: util.c,v 1.34 2020/01/22 01:19:25 sjg Exp $
* $Id: util.c,v 1.35 2020/07/04 18:16:55 sjg Exp $
*/
#if defined(__MINT__) || defined(__linux__)
#include <signal.h>
@ -12,10 +12,10 @@
#include "make.h"
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: util.c,v 1.55 2020/01/07 21:24:16 rillig Exp $";
static char rcsid[] = "$NetBSD: util.c,v 1.57 2020/07/03 08:13:23 rillig Exp $";
#else
#ifndef lint
__RCSID("$NetBSD: util.c,v 1.55 2020/01/07 21:24:16 rillig Exp $");
__RCSID("$NetBSD: util.c,v 1.57 2020/07/03 08:13:23 rillig Exp $");
#endif
#endif
@ -68,7 +68,7 @@ getenv(const char *name)
{
int offset;
return(findenv(name, &offset));
return findenv(name, &offset);
}
int
@ -173,7 +173,7 @@ strrcpy(char *ptr, char *str)
while (len)
*--ptr = str[--len];
return (ptr);
return ptr;
} /* end strrcpy */
@ -276,7 +276,7 @@ getwd(char *pathname)
if (st_cur.st_ino == st_root.st_ino &&
DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) {
(void)strcpy(pathname, *pathptr != '/' ? "/" : pathptr);
return (pathname);
return pathname;
}
/* open the parent directory */
@ -399,7 +399,7 @@ vsnprintf(char *s, size_t n, const char *fmt, va_list args)
putc('\0', &fakebuf);
if (fakebuf._cnt<0)
fakebuf._cnt = 0;
return (n-fakebuf._cnt-1);
return n-fakebuf._cnt-1;
#else
#ifndef _PATH_DEVNULL
# define _PATH_DEVNULL "/dev/null"
@ -442,7 +442,7 @@ size_t
strftime(char *buf, size_t len, const char *fmt, const struct tm *tm)
{
static char months[][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ SRCTOP?= ${.CURDIR:H:H}
# things set by configure
_MAKE_VERSION?=20200606
_MAKE_VERSION?=20200710
prefix?= /usr
srcdir= ${SRCTOP}/contrib/bmake

View File

@ -245,7 +245,7 @@
#define PACKAGE_NAME "bmake"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "bmake 20200524"
#define PACKAGE_STRING "bmake 20200710"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "bmake"
@ -254,7 +254,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "20200524"
#define PACKAGE_VERSION "20200710"
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void

View File

@ -1,89 +1,106 @@
# This is a generated file, do NOT edit!
# See contrib/bmake/bsd.after-import.mk
#
# $FreeBSD$
SRCTOP?= ${.CURDIR:H:H:H}
# $Id: Makefile.in,v 1.49 2018/09/21 21:39:05 sjg Exp $
# $Id: Makefile,v 1.60 2020/07/10 00:48:32 sjg Exp $
#
# $NetBSD: Makefile,v 1.53 2018/05/24 00:25:44 christos Exp $
# $NetBSD: Makefile,v 1.63 2020/07/09 22:40:14 sjg Exp $
#
# Unit tests for make(1)
# The main targets are:
#
# all: run all the tests
# test: run 'all', and compare to expected results
# accept: move generated output to expected results
#
# Adding a test case.
# The main targets are:
#
# all:
# run all the tests
# test:
# run 'all', and compare to expected results
# accept:
# move generated output to expected results
#
# Settable variables
#
# TEST_MAKE
# The make program to be tested.
#
#
# Adding a test case
#
# Each feature should get its own set of tests in its own suitably
# named makefile (*.mk), with its own set of expected results (*.exp),
# and it should be added to the TESTNAMES list.
#
srcdir= ${SRCTOP}/contrib/bmake/unit-tests
.MAIN: all
UNIT_TESTS:= ${srcdir}
.PATH: ${UNIT_TESTS}
# and it should be added to the TESTS list.
#
# Any added files must also be added to src/distrib/sets/lists/tests/mi.
# Makefiles that are not added to TESTS must be ignored in
# src/tests/usr.bin/make/t_make.sh (example: include-sub).
#
# Each test is in a sub-makefile.
# Keep the list sorted.
TESTNAMES= \
comment \
cond1 \
cond2 \
error \
export \
export-all \
export-env \
doterror \
dotwait \
forloop \
forsubst \
hash \
misc \
moderrs \
modmatch \
modmisc \
modorder \
modts \
modword \
order \
posix \
qequals \
sunshcmd \
sysv \
ternary \
unexport \
unexport-env \
varcmd \
varmisc \
varquote \
varshell
TESTS+= comment
TESTS+= cond-late
TESTS+= cond-short
TESTS+= cond1
TESTS+= cond2
TESTS+= dollar
TESTS+= doterror
TESTS+= dotwait
TESTS+= error
TESTS+= # escape # broken by reverting POSIX changes
TESTS+= export
TESTS+= export-all
TESTS+= export-env
TESTS+= forloop
TESTS+= forsubst
TESTS+= hash
TESTS+= # impsrc # broken by reverting POSIX changes
TESTS+= include-main
TESTS+= misc
TESTS+= moderrs
TESTS+= modmatch
TESTS+= modmisc
TESTS+= modorder
TESTS+= modts
TESTS+= modword
TESTS+= order
TESTS+= # phony-end # broken by reverting POSIX changes
TESTS+= posix
TESTS+= # posix1 # broken by reverting POSIX changes
TESTS+= qequals
TESTS+= # suffixes # broken by reverting POSIX changes
TESTS+= sunshcmd
TESTS+= sysv
TESTS+= ternary
TESTS+= unexport
TESTS+= unexport-env
TESTS+= varcmd
TESTS+= varmisc
TESTS+= varmod-edge
TESTS+= varquote
TESTS+= varshell
# these tests were broken by referting POSIX chanegs
STRICT_POSIX_TESTS = \
escape \
impsrc \
phony-end \
posix1 \
suffixes
# Override make flags for certain tests; default is -k.
FLAGS.doterror= # none
FLAGS.order= -j1
# Override make flags for certain tests
flags.doterror=
flags.order=-j1
# Some tests need extra post-processing.
SED_CMDS.modmisc+= -e 's,\(substitution error:\).*,\1 (details omitted),'
SED_CMDS.varshell+= -e 's,^[a-z]*sh: ,,'
SED_CMDS.varshell+= -e '/command/s,No such.*,not found,'
OUTFILES= ${TESTNAMES:S/$/.out/}
# End of the configuration section.
.MAIN: all
.-include "Makefile.config"
UNIT_TESTS:= ${srcdir}
.PATH: ${UNIT_TESTS}
OUTFILES= ${TESTS:=.out}
all: ${OUTFILES}
CLEANFILES += *.rawout *.out *.status *.tmp *.core *.tmp
CLEANFILES += obj*.[och] lib*.a # posix1.mk
CLEANFILES += issue* .[ab]* # suffixes.mk
CLEANRECURSIVE += dir dummy # posix1.mk
CLEANFILES+= *.rawout *.out *.status *.tmp *.core *.tmp
CLEANFILES+= obj*.[och] lib*.a # posix1.mk
CLEANFILES+= issue* .[ab]* # suffixes.mk
CLEANRECURSIVE+= dir dummy # posix1.mk
clean:
rm -f ${CLEANFILES}
@ -91,43 +108,42 @@ clean:
rm -rf ${CLEANRECURSIVE}
.endif
TEST_MAKE?= ${.MAKE}
TOOL_SED?= sed
TOOL_TR?= tr
TOOL_DIFF?= diff
DIFF_FLAGS?= -u
TEST_MAKE?= ${.MAKE}
TOOL_SED?= sed
TOOL_TR?= tr
TOOL_DIFF?= diff
DIFF_FLAGS?= -u
.if defined(.PARSEDIR)
# ensure consistent results from sort(1)
LC_ALL= C
LANG= C
LC_ALL= C
LANG= C
.export LANG LC_ALL
.endif
# some tests need extra post-processing
SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
-e '/command/s,No such.*,not found,'
# the tests are actually done with sub-makes.
.SUFFIXES: .mk .rawout .out
.mk.rawout:
@echo ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC}
@echo ${TEST_MAKE} ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC}
-@cd ${.OBJDIR} && \
{ ${TEST_MAKE} ${flags.${.TARGET:R}:U-k} -f ${.IMPSRC} \
{ ${TEST_MAKE} ${FLAGS.${.TARGET:R}:U-k} -f ${.IMPSRC} \
2>&1 ; echo $$? >${.TARGET:R}.status ; } > ${.TARGET}.tmp
@mv ${.TARGET}.tmp ${.TARGET}
# We always pretend .MAKE was called 'make'
# and strip ${.CURDIR}/ from the output
# and replace anything after 'stopped in' with unit-tests
# so the results can be compared.
# Post-process the test output so that the results can be compared.
#
# always pretend .MAKE was called 'make'
_SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
_SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,'
# replace anything after 'stopped in' with unit-tests
_SED_CMDS+= -e '/stopped/s, /.*, unit-tests,'
# strip ${.CURDIR}/ from the output
_SED_CMDS+= -e 's,${.CURDIR:S,.,\\.,g}/,,g'
_SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
.rawout.out:
@echo postprocess ${.TARGET}
@${TOOL_SED} -e 's,^${TEST_MAKE:T:C/\./\\\./g}[][0-9]*:,make:,' \
-e 's,${TEST_MAKE:C/\./\\\./g},make,' \
-e '/stopped/s, /.*, unit-tests,' \
-e 's,${.CURDIR:C/\./\\\./g}/,,g' \
-e 's,${UNIT_TESTS:C/\./\\\./g}/,,g' ${SED_CMDS.${.TARGET:T:R}} \
@${TOOL_SED} ${_SED_CMDS} ${SED_CMDS.${.TARGET:R}} \
< ${.IMPSRC} > ${.TARGET}.tmp
@echo "exit status `cat ${.TARGET:R}.status`" >> ${.TARGET}.tmp
@mv ${.TARGET}.tmp ${.TARGET}
@ -135,7 +151,7 @@ SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
# Compare all output files
test: ${OUTFILES} .PHONY
@failed= ; \
for test in ${TESTNAMES}; do \
for test in ${TESTS}; do \
${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
|| failed="$${failed}$${failed:+ }$${test}" ; \
done ; \
@ -146,14 +162,14 @@ test: ${OUTFILES} .PHONY
fi
accept:
@for test in ${TESTNAMES}; do \
@for test in ${TESTS}; do \
cmp -s ${UNIT_TESTS}/$${test}.exp $${test}.out \
|| { echo "Replacing $${test}.exp" ; \
cp $${test}.out ${UNIT_TESTS}/$${test}.exp ; } \
done
.if exists(${TEST_MAKE})
${TESTNAMES:S/$/.rawout/}: ${TEST_MAKE}
${TESTS:=.rawout}: ${TEST_MAKE}
.endif
.sinclude <bsd.obj.mk>
.-include <bsd.obj.mk>