Import bmake-20200629

from ChangeLog:

    o cond.c: do not eval unnecessary terms of conditionals.

    o meta.c: report error if lseek in filemon_read fails

    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

    o unit test for :Or
This commit is contained in:
Simon J. Gerraty 2020-07-01 02:13:04 +00:00
parent abd272d7ca
commit 6e0296234f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/bmake/dist/; revision=362821
svn path=/vendor/NetBSD/bmake/20200629/; revision=362822; tag=vendor/NetBSD/bmake/20200629
32 changed files with 941 additions and 703 deletions

View File

@ -1,3 +1,42 @@
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

3
FILES
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

59
LICENSE Normal file
View File

@ -0,0 +1,59 @@
The individual files in this distribution are copyright their
original contributors or assignees.
Including:
Copyright (c) 1993-2020, Simon J Gerraty
Copyright (c) 2009-2016, Juniper Networks, Inc.
Copyright (c) 2009, John Birrell.
Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
Copyright (c) 1989 by Berkeley Softworks
Copyright (c) 1988, 1989, 1990, 1992, 1993
The Regents of the University of California.
Copyright (c) 1988, 1989 by Adam de Boor
With the exception of the GNU configure script, which states:
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
The license for this distribution is considered to be:
SPDX-License-Identifier: BSD-3-Clause
example (from https://opensource.org/licenses/BSD-3-Clause):
Copyright <YEAR> <COPYRIGHT HOLDER>
Redistribution and use in source and binary forms, with or without
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.
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.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
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 A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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.

View File

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

28
cond.c
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.76 2020/06/28 11:06:26 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: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $";
static char rcsid[] = "$NetBSD: cond.c,v 1.76 2020/06/28 11:06:26 rillig 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.76 2020/06/28 11:06:26 rillig 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 *);
@ -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;
@ -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);
@ -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);
@ -813,7 +811,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 +825,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 +862,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 +890,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 +915,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 == '!')

17
job.c
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.198 2020/06/19 21:17:48 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: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $";
static char rcsid[] = "$NetBSD: job.c,v 1.198 2020/06/19 21:17:48 sjg 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.198 2020/06/19 21:17:48 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -1058,10 +1058,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 {
@ -3039,6 +3040,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");
}

33
main.c
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.276 2020/06/22 20:15:25 sjg 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.276 2020/06/22 20:15:25 sjg 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.276 2020/06/22 20:15:25 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -1889,6 +1889,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");
}
@ -2041,6 +2043,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,6 +2071,10 @@ 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);

3
make.h
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.108 2020/06/19 21:17:48 sjg 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);

20
meta.c
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.82 2020/06/25 15:45:37 sjg Exp $ */
/*
* Implement 'meta' mode.
@ -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)

View File

@ -1,3 +1,20 @@
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: 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

@ -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.173 2020/06/23 04:16:35 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20200606
MK_VERSION=20200622
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:

36
str.c
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.48 2020/06/15 14:46:28 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.48 2020/06/15 14:46:28 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.48 2020/06/15 14:46:28 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;
@ -344,9 +344,9 @@ Str_Match(const char *string, const char *pattern)
* pattern but not at the end of the string, we failed.
*/
if (*pattern == 0)
return(!*string);
return !*string;
if (*string == 0 && *pattern != '*')
return(0);
return 0;
/*
* Check for a "*" as the next pattern character. It matches
* any substring. We handle this by calling ourselves
@ -354,15 +354,17 @@ Str_Match(const char *string, const char *pattern)
* match or we reach the end of the string.
*/
if (*pattern == '*') {
pattern += 1;
pattern++;
while (*pattern == '*')
pattern++;
if (*pattern == 0)
return(1);
return 1;
while (*string != 0) {
if (Str_Match(string, pattern))
return(1);
return 1;
++string;
}
return(0);
return 0;
}
/*
* Check for a "?" as the next pattern character. It matches
@ -388,14 +390,14 @@ Str_Match(const char *string, const char *pattern)
if ((*pattern == ']') || (*pattern == 0)) {
if (nomatch)
break;
return(0);
return 0;
}
if (*pattern == *string)
break;
if (pattern[1] == '-') {
c2 = pattern[2];
if (c2 == 0)
return(nomatch);
return nomatch;
if ((*pattern <= *string) &&
(c2 >= *string))
break;
@ -415,20 +417,20 @@ Str_Match(const char *string, const char *pattern)
goto thisCharOK;
}
/*
* If the next pattern character is '/', just strip off the
* '/' so we do exact matching on the character that follows.
* If the next pattern character is a backslash, just strip it
* off so we do exact matching on the character that follows.
*/
if (*pattern == '\\') {
++pattern;
if (*pattern == 0)
return(0);
return 0;
}
/*
* There's no special character. Just make sure that the
* next characters of each string match.
*/
if (*pattern != *string)
return(0);
return 0;
thisCharOK: ++pattern;
++string;
}

View File

@ -1,6 +1,6 @@
# $Id: Makefile,v 1.54 2020/05/17 17:26:14 sjg Exp $
# $Id: Makefile,v 1.55 2020/06/29 14:47:56 sjg Exp $
#
# $NetBSD: Makefile,v 1.58 2020/05/17 12:36:26 rillig Exp $
# $NetBSD: Makefile,v 1.59 2020/06/28 09:42:40 rillig Exp $
#
# Unit tests for make(1)
# The main targets are:
@ -27,6 +27,7 @@ UNIT_TESTS:= ${.PARSEDIR}
TESTNAMES= \
comment \
cond-late \
cond-short \
cond1 \
cond2 \
dollar \

View File

@ -0,0 +1,7 @@
expected and
expected and exists
expected and empty
expected or
expected or exists
expected or empty
exit status 0

62
unit-tests/cond-short.mk Normal file
View File

@ -0,0 +1,62 @@
# $NetBSD: cond-short.mk,v 1.2 2020/06/28 11:06:26 rillig 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
# 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
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

@ -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