mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-02 08:42:48 +00:00
Import bmake-20181221
o parse.c: ParseVErrorInternal use .PARSEDIR and apply if relative, and then use .PARSEFILE for consistent result. o var.c: avoid SEGFAULT in .unexport-env when MAKELEVEL is not set
This commit is contained in:
parent
14ed4acf37
commit
4e6c593faa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/bmake/dist/; revision=342372 svn path=/vendor/NetBSD/bmake/20181221/; revision=342373; tag=vendor/NetBSD/bmake/20181221
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
||||
2018-12-21 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION: 20181221
|
||||
Merge with NetBSD make, pick up
|
||||
o parse.c: ParseVErrorInternal use .PARSEDIR
|
||||
and apply if relative, and then use .PARSEFILE
|
||||
for consistent result.
|
||||
|
||||
2018-12-20 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION: 20181220
|
||||
Merge with NetBSD make, pick up
|
||||
o parse.c: ParseVErrorInternal use .CURDIR if .PARSEDIR
|
||||
is relative
|
||||
o var.c: avoid SEGFAULT in .unexport-env
|
||||
when MAKELEVEL is not set
|
||||
|
||||
2018-12-16 Simon J Gerraty <sjg@beast.crufty.net>
|
||||
|
||||
* VERSION: 20181216
|
||||
Merge with NetBSD make, pick up
|
||||
o fix for unit-tests/varquote.mk on Debian
|
||||
|
||||
2018-09-21 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* VERSION: 20180919
|
||||
|
2
VERSION
2
VERSION
@ -1,2 +1,2 @@
|
||||
# keep this compatible with sh and make
|
||||
_MAKE_VERSION=20180919
|
||||
_MAKE_VERSION=20181221
|
||||
|
10
dirname.c
10
dirname.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dirname.c,v 1.13 2014/07/16 10:52:26 christos Exp $ */
|
||||
/* $NetBSD: dirname.c,v 1.14 2018/09/27 00:45:34 kre Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 2002 The NetBSD Foundation, Inc.
|
||||
@ -35,6 +35,11 @@
|
||||
#ifndef HAVE_DIRNAME
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: dirname.c,v 1.14 2018/09/27 00:45:34 kre Exp $");
|
||||
#endif /* !LIBC_SCCS && !lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#ifdef HAVE_LIBGEN_H
|
||||
#include <libgen.h>
|
||||
@ -92,7 +97,8 @@ xdirname_r(const char *path, char *buf, size_t buflen)
|
||||
out:
|
||||
if (buf != NULL && buflen != 0) {
|
||||
buflen = MIN(len, buflen - 1);
|
||||
memcpy(buf, path, buflen);
|
||||
if (buf != path)
|
||||
memcpy(buf, path, buflen);
|
||||
buf[buflen] = '\0';
|
||||
}
|
||||
return len;
|
||||
|
@ -25,7 +25,8 @@ of mk-files (mk.tar.gz_). NetBSD provided much of the original structure.
|
||||
|
||||
Since then I've added a lot of features to NetBSD's make and hence to
|
||||
bmake which is kept closely in sync. The mk-files however have
|
||||
diverged quite a bit, though ideas are still picked up from NetBSD.
|
||||
diverged quite a bit, though ideas are still picked up from NetBSD
|
||||
and FreeBSD.
|
||||
|
||||
Basics
|
||||
------
|
||||
@ -399,6 +400,20 @@ to avoid possible conflicts during parallel builds.
|
||||
This precludes the use of suffix rules to drive ``make depend``, so
|
||||
dep.mk_ handles that if specifically requested.
|
||||
|
||||
options.mk
|
||||
----------
|
||||
|
||||
Inspired by FreeBSD's ``bsd.own.mk`` more flexible.
|
||||
FreeBSD now have similar functionality in ``bsd.mkopt.mk``.
|
||||
|
||||
It allows users to express their intent with respect to options
|
||||
``MK_*`` by setting ``WITH_*`` or ``WITHOUT_*``.
|
||||
|
||||
Note: ``WITHOUT_*`` wins if both are set, and makefiles can set
|
||||
``NO_*`` to say they cannot handle that option, or even ``MK_*`` if
|
||||
they really need to.
|
||||
|
||||
|
||||
own.mk
|
||||
------
|
||||
|
||||
@ -407,6 +422,13 @@ Normally included by ``init.mk`` (included by ``lib.mk`` and
|
||||
|
||||
It includes ``${MAKECONF}`` if it is defined and exists.
|
||||
|
||||
ldorder.mk
|
||||
----------
|
||||
|
||||
Leverages ``bmake`` to compute optimal link order for libraries.
|
||||
This works nicely and makes refactoring a breeze - so long as you
|
||||
have not (or few) cicular dependencies between libraries.
|
||||
|
||||
man.mk
|
||||
------
|
||||
|
||||
@ -477,5 +499,5 @@ where you unpacked the tar file, you can::
|
||||
.. _mk.tar.gz: http://www.crufty.net/ftp/pub/sjg/mk.tar.gz
|
||||
|
||||
:Author: sjg@crufty.net
|
||||
:Revision: $Id: mk-files.txt,v 1.16 2014/09/05 04:41:16 sjg Exp $
|
||||
:Revision: $Id: mk-files.txt,v 1.18 2018/12/08 07:27:15 sjg Exp $
|
||||
:Copyright: Crufty.NET
|
||||
|
33
parse.c
33
parse.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.229 2018/04/05 16:31:54 christos Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.231 2018/12/22 00:36:32 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.229 2018/04/05 16:31:54 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.231 2018/12/22 00:36:32 sjg 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.229 2018/04/05 16:31:54 christos Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.231 2018/12/22 00:36:32 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -691,21 +691,32 @@ ParseVErrorInternal(FILE *f, const char *cfname, size_t clineno, int type,
|
||||
if (cfname != NULL) {
|
||||
(void)fprintf(f, "\"");
|
||||
if (*cfname != '/' && strcmp(cfname, "(stdin)") != 0) {
|
||||
char *cp;
|
||||
const char *dir;
|
||||
char *cp, *cp2;
|
||||
const char *dir, *fname;
|
||||
|
||||
/*
|
||||
* Nothing is more annoying than not knowing
|
||||
* which Makefile is the culprit.
|
||||
* which Makefile is the culprit; we try ${.PARSEDIR}
|
||||
* and apply realpath(3) if not absolute.
|
||||
*/
|
||||
dir = Var_Value(".PARSEDIR", VAR_GLOBAL, &cp);
|
||||
if (dir == NULL || *dir == '\0' ||
|
||||
(*dir == '.' && dir[1] == '\0'))
|
||||
dir = Var_Value(".CURDIR", VAR_GLOBAL, &cp);
|
||||
if (dir == NULL)
|
||||
dir = ".";
|
||||
|
||||
(void)fprintf(f, "%s/%s", dir, cfname);
|
||||
if (*dir != '/') {
|
||||
dir = cp2 = realpath(dir, NULL);
|
||||
free(cp);
|
||||
cp = cp2; /* cp2 set to NULL by Var_Value */
|
||||
}
|
||||
fname = Var_Value(".PARSEFILE", VAR_GLOBAL, &cp2);
|
||||
if (fname == NULL) {
|
||||
if ((fname = strrchr(cfname, '/')))
|
||||
fname++;
|
||||
else
|
||||
fname = cfname;
|
||||
}
|
||||
(void)fprintf(f, "%s/%s", dir, fname);
|
||||
free(cp2);
|
||||
free(cp);
|
||||
} else
|
||||
(void)fprintf(f, "%s", cfname);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: varquote.mk,v 1.2 2018/05/27 01:14:51 christos Exp $
|
||||
# $NetBSD: varquote.mk,v 1.4 2018/12/16 18:53:34 christos Exp $
|
||||
#
|
||||
# Test VAR:q modifier
|
||||
|
||||
@ -10,5 +10,5 @@ all:
|
||||
@${MAKE} -f ${MAKEFILE} REPROFLAGS=${REPROFLAGS:q}
|
||||
.else
|
||||
all:
|
||||
@echo ${REPROFLAGS}
|
||||
@printf "%s %s\n" ${REPROFLAGS}
|
||||
.endif
|
||||
|
9
var.c
9
var.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $ */
|
||||
/* $NetBSD: var.c,v 1.221 2018/12/21 05:50:19 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.221 2018/12/21 05:50:19 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $");
|
||||
__RCSID("$NetBSD: var.c,v 1.221 2018/12/21 05:50:19 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -835,7 +835,8 @@ Var_UnExport(char *str)
|
||||
environ = savedEnv = newenv;
|
||||
newenv[0] = NULL;
|
||||
newenv[1] = NULL;
|
||||
setenv(MAKE_LEVEL_ENV, cp, 1);
|
||||
if (cp && *cp)
|
||||
setenv(MAKE_LEVEL_ENV, cp, 1);
|
||||
} else {
|
||||
for (; *str != '\n' && isspace((unsigned char) *str); str++)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user