Import the 20120831 release of the "Portable" BSD make tool (from NetBSD).
Submitted by: Simon Gerraty <sjg@juniper.net>
This commit is contained in:
parent
e6157a0b0c
commit
f74e4d18d1
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
2012-08-31 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile.in (MAKE_VERSION): bump version to 20120831
|
||||
Merge with NetBSD make, pick up
|
||||
o cast sizeof() to int for comparison
|
||||
o minor make.1 tweak
|
||||
|
||||
2012-08-30 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile.in (MAKE_VERSION): bump version to 20120830
|
||||
Merge with NetBSD make, pick up
|
||||
o .MAKE.EXPAND_VARIABLES knob can control default behavior of -V
|
||||
o debug flag -dV causes -V to show raw value regardless.
|
||||
|
||||
2012-07-05 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* bsd.after-import.mk (after-import): ensure unit-tests/Makefile
|
||||
gets SRCTOP set.
|
||||
|
||||
2012-07-04 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile.in (MAKE_VERSION): bump version to 20120704
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
|
||||
# @(#)Makefile 5.2 (Berkeley) 12/28/90
|
||||
|
||||
# $Id: Makefile.in,v 1.168 2012/07/05 04:10:23 sjg Exp $
|
||||
# $Id: Makefile.in,v 1.170 2012/08/31 06:46:22 sjg Exp $
|
||||
|
||||
PROG= bmake
|
||||
SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
|
||||
@ -21,7 +21,7 @@ srcdir= @srcdir@
|
||||
CC?= @CC@
|
||||
|
||||
# Base version on src date
|
||||
MAKE_VERSION= 20120704
|
||||
MAKE_VERSION= 20120831
|
||||
MACHINE=@machine@
|
||||
MACHINE_ARCH=@machine_arch@
|
||||
DEFAULT_SYS_PATH = @default_sys_path@
|
||||
|
12
bmake.1
12
bmake.1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.204 2012/04/24 20:12:16 sjg Exp $
|
||||
.\" $NetBSD: make.1,v 1.206 2012/08/30 22:35:37 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -29,7 +29,7 @@
|
||||
.\"
|
||||
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
|
||||
.\"
|
||||
.Dd April 24, 2012
|
||||
.Dd August 30, 2012
|
||||
.Dt MAKE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -203,6 +203,10 @@ Print debugging information about makefile parsing.
|
||||
Print debugging information about suffix-transformation rules.
|
||||
.It Ar t
|
||||
Print debugging information about target list maintenance.
|
||||
.It Ar V
|
||||
Force the
|
||||
.Fl V
|
||||
option to print raw values of variables.
|
||||
.It Ar v
|
||||
Print debugging information about variable assignment.
|
||||
.It Ar x
|
||||
@ -675,6 +679,10 @@ and cannot be confused with the special target with the same name.
|
||||
Names the makefile (default
|
||||
.Ql Pa .depend )
|
||||
from which generated dependencies are read.
|
||||
.It Va .MAKE.EXPAND_VARIABLES
|
||||
A boolean that controls the default behavior of the
|
||||
.Fl V
|
||||
option.
|
||||
.It Va .MAKE.EXPORTED
|
||||
The list of variables exported by
|
||||
.Nm .
|
||||
|
1318
bmake.cat1
1318
bmake.cat1
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
# $Id: bsd.after-import.mk,v 1.6 2012/06/27 18:23:32 sjg Exp $
|
||||
# $Id: bsd.after-import.mk,v 1.7 2012/07/06 03:03:44 sjg Exp $
|
||||
|
||||
# This makefile is for use when integrating bmake into a BSD build
|
||||
# system. Use this makefile after importing bmake.
|
||||
@ -13,7 +13,7 @@ all: _makefile
|
||||
all: after-import
|
||||
|
||||
# we rely on bmake
|
||||
.if !defined(.MAKE.LEVEL)
|
||||
.if !defined(.PARSEDIR)
|
||||
.error this makefile requires bmake
|
||||
.endif
|
||||
|
||||
@ -75,7 +75,11 @@ after-import: bootstrap ${MAKEFILE}
|
||||
.for f in ${configured_files:M*Makefile}
|
||||
@echo Capturing $f
|
||||
@mkdir -p ${${.CURDIR}/$f:L:H}
|
||||
@${MAKEFILE_SED} ${HOST_OS}/$f > ${.CURDIR}/$f
|
||||
@(echo '# This is a generated file, do NOT edit!'; \
|
||||
echo '# See ${_this:S,${SRCTOP}/,,}'; \
|
||||
echo '#'; echo '# $$${OS}$$'; echo; \
|
||||
echo 'SRCTOP?= $${.CURDIR:${${.CURDIR}/$f:L:H:S,${SRCTOP}/,,:C,[^/]+,H,g:S,/,:,g}}'; echo; \
|
||||
${MAKEFILE_SED} ${HOST_OS}/$f ) > ${.CURDIR}/$f
|
||||
.endfor
|
||||
|
||||
# this needs the most work
|
||||
|
69
main.c
69
main.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.200 2012/06/12 19:21:51 joerg Exp $ */
|
||||
/* $NetBSD: main.c,v 1.203 2012/08/31 07:00:36 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.200 2012/06/12 19:21:51 joerg Exp $";
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.203 2012/08/31 07:00:36 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.200 2012/06/12 19:21:51 joerg Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.203 2012/08/31 07:00:36 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -159,6 +159,7 @@ int maxJobs; /* -j argument */
|
||||
static int maxJobTokens; /* -j argument */
|
||||
Boolean compatMake; /* -B argument */
|
||||
int debug; /* -d argument */
|
||||
Boolean debugVflag; /* -dV */
|
||||
Boolean noExecute; /* -n flag */
|
||||
Boolean noRecursiveExecute; /* -N flag */
|
||||
Boolean keepgoing; /* -k flag */
|
||||
@ -271,6 +272,9 @@ parse_debug_options(const char *argvalue)
|
||||
case 't':
|
||||
debug |= DEBUG_TARG;
|
||||
break;
|
||||
case 'V':
|
||||
debugVflag = TRUE;
|
||||
break;
|
||||
case 'v':
|
||||
debug |= DEBUG_VAR;
|
||||
break;
|
||||
@ -910,6 +914,7 @@ main(int argc, char **argv)
|
||||
create = Lst_Init(FALSE);
|
||||
makefiles = Lst_Init(FALSE);
|
||||
printVars = FALSE;
|
||||
debugVflag = FALSE;
|
||||
variables = Lst_Init(FALSE);
|
||||
beSilent = FALSE; /* Print commands as executed */
|
||||
ignoreErrors = FALSE; /* Pay attention to non-zero returns */
|
||||
@ -1253,7 +1258,12 @@ main(int argc, char **argv)
|
||||
/* print the values of any variables requested by the user */
|
||||
if (printVars) {
|
||||
LstNode ln;
|
||||
Boolean expandVars;
|
||||
|
||||
if (debugVflag)
|
||||
expandVars = FALSE;
|
||||
else
|
||||
expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
|
||||
for (ln = Lst_First(variables); ln != NULL;
|
||||
ln = Lst_Succ(ln)) {
|
||||
char *var = (char *)Lst_Datum(ln);
|
||||
@ -1261,6 +1271,13 @@ main(int argc, char **argv)
|
||||
|
||||
if (strchr(var, '$')) {
|
||||
value = p1 = Var_Subst(NULL, var, VAR_GLOBAL, 0);
|
||||
} else if (expandVars) {
|
||||
char tmp[128];
|
||||
|
||||
if (snprintf(tmp, sizeof(tmp), "${%s}", var) >= (int)(sizeof(tmp)))
|
||||
Fatal("%s: variable name too big: %s",
|
||||
progname, var);
|
||||
value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL, 0);
|
||||
} else {
|
||||
value = Var_Value(var, VAR_GLOBAL, &p1);
|
||||
}
|
||||
@ -2076,3 +2093,49 @@ mkTempFile(const char *pattern, char **fnamep)
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return a Boolean based on setting of a knob.
|
||||
*
|
||||
* If the knob is not set, the supplied default is the return value.
|
||||
* If set, anything that looks or smells like "No", "False", "Off", "0" etc,
|
||||
* is FALSE, otherwise TRUE.
|
||||
*/
|
||||
Boolean
|
||||
getBoolean(const char *name, Boolean bf)
|
||||
{
|
||||
char tmp[64];
|
||||
char *cp;
|
||||
|
||||
if (snprintf(tmp, sizeof(tmp), "${%s:tl}", name) < (int)(sizeof(tmp))) {
|
||||
cp = Var_Subst(NULL, tmp, VAR_GLOBAL, 0);
|
||||
|
||||
if (cp) {
|
||||
switch(*cp) {
|
||||
case '\0': /* not set - the default wins */
|
||||
break;
|
||||
case '0':
|
||||
case 'f':
|
||||
case 'n':
|
||||
bf = FALSE;
|
||||
break;
|
||||
case 'o':
|
||||
switch (cp[1]) {
|
||||
case 'f':
|
||||
bf = FALSE;
|
||||
break;
|
||||
default:
|
||||
bf = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
bf = TRUE;
|
||||
break;
|
||||
}
|
||||
free(cp);
|
||||
}
|
||||
}
|
||||
return (bf);
|
||||
}
|
||||
|
12
make.1
12
make.1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: make.1,v 1.204 2012/04/24 20:12:16 sjg Exp $
|
||||
.\" $NetBSD: make.1,v 1.206 2012/08/30 22:35:37 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -29,7 +29,7 @@
|
||||
.\"
|
||||
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
|
||||
.\"
|
||||
.Dd April 24, 2012
|
||||
.Dd August 30, 2012
|
||||
.Dt MAKE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -203,6 +203,10 @@ Print debugging information about makefile parsing.
|
||||
Print debugging information about suffix-transformation rules.
|
||||
.It Ar t
|
||||
Print debugging information about target list maintenance.
|
||||
.It Ar V
|
||||
Force the
|
||||
.Fl V
|
||||
option to print raw values of variables.
|
||||
.It Ar v
|
||||
Print debugging information about variable assignment.
|
||||
.It Ar x
|
||||
@ -675,6 +679,10 @@ and cannot be confused with the special target with the same name.
|
||||
Names the makefile (default
|
||||
.Ql Pa .depend )
|
||||
from which generated dependencies are read.
|
||||
.It Va .MAKE.EXPAND_VARIABLES
|
||||
A boolean that controls the default behavior of the
|
||||
.Fl V
|
||||
option.
|
||||
.It Va .MAKE.EXPORTED
|
||||
The list of variables exported by
|
||||
.Nm .
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nonints.h,v 1.64 2012/06/12 19:21:51 joerg Exp $ */
|
||||
/* $NetBSD: nonints.h,v 1.65 2012/08/30 21:17:05 sjg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -120,6 +120,7 @@ void Finish(int) MAKE_ATTR_DEAD;
|
||||
int eunlink(const char *);
|
||||
void execError(const char *, const char *);
|
||||
char *getTmpdir(void);
|
||||
Boolean getBoolean(const char *, Boolean);
|
||||
|
||||
/* parse.c */
|
||||
void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
|
||||
|
Loading…
Reference in New Issue
Block a user