Merge bmake-20130904

This commit is contained in:
sjg 2013-09-05 15:57:26 +00:00
commit 61d13f6983
22 changed files with 189 additions and 50 deletions

View File

@ -1,3 +1,24 @@
2013-09-04 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130904
Merge with NetBSD make, pick up
o Add VAR_INTERNAL context, so that internal setting of
MAKEFILE does not override value set by makefiles.
2013-09-02 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130902
Merge with NetBSD make, pick up
o CompatRunCommand: only apply shellErrFlag when errCheck is true
2013-08-28 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130828
Merge with NetBSD make, pick up
o Fix VAR :sh = syntax from Will Andrews at freebsd.org
o Call Job_SetPrefix() from Job_Init() so makefiles have
opportunity to set .MAKE.JOB.PREFIX
2013-07-30 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130730

View File

@ -114,6 +114,7 @@ unit-tests/order
unit-tests/phony-end
unit-tests/posix
unit-tests/qequals
unit-tests/sunshcmd
unit-tests/sysv
unit-tests/ternary
unit-tests/test.exp

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.17 2013/07/30 19:13:53 sjg Exp $
# $Id: Makefile,v 1.20 2013/09/04 15:42:03 sjg Exp $
# Base version on src date
MAKE_VERSION= 20130730
MAKE_VERSION= 20130904
PROG= bmake

View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.220 2013/07/30 19:09:57 sjg Exp $
.\" $NetBSD: make.1,v 1.222 2013/08/11 09:53:49 apb 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 July 30, 2013
.Dd August 11, 2013
.Dt MAKE 1
.Os
.Sh NAME
@ -1971,6 +1971,12 @@ If the source is the special
.Ic .DOTLAST
target, then the current working
directory is searched last.
.It Ic .PATH. Ns Va suffix
Like
.Ic .PATH
but applies only to files with a particular suffix.
The suffix must have been previously declared with
.Ic .SUFFIXES .
.It Ic .PHONY
Apply the
.Ic .PHONY

View File

@ -1257,6 +1257,10 @@ SSPPEECCIIAALL TTAARRGGEETTSS
source is the special ..DDOOTTLLAASSTT target, then the current working
directory is searched last.
..PPAATTHH.._s_u_f_f_i_x
Like ..PPAATTHH but applies only to files with a particular suffix.
The suffix must have been previously declared with ..SSUUFFFFIIXXEESS.
..PPHHOONNYY Apply the ..PPHHOONNYY attribute to any specified sources.
..PPRREECCIIOOUUSS
@ -1374,4 +1378,4 @@ BBUUGGSS
There is no way of escaping a space character in a filename.
NetBSD 5.1 July 30, 2013 NetBSD 5.1
NetBSD 5.1 August 11, 2013 NetBSD 5.1

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.92 2013/07/05 22:14:56 sjg Exp $ */
/* $NetBSD: compat.c,v 1.93 2013/09/02 19:26:42 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: compat.c,v 1.92 2013/07/05 22:14:56 sjg Exp $";
static char rcsid[] = "$NetBSD: compat.c,v 1.93 2013/09/02 19:26:42 sjg 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.92 2013/07/05 22:14:56 sjg Exp $");
__RCSID("$NetBSD: compat.c,v 1.93 2013/09/02 19:26:42 sjg Exp $");
#endif
#endif /* not lint */
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.175 2013/07/30 19:09:57 sjg Exp $ */
/* $NetBSD: job.c,v 1.176 2013/08/04 16:48:15 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.175 2013/07/30 19:09:57 sjg Exp $";
static char rcsid[] = "$NetBSD: job.c,v 1.176 2013/08/04 16:48:15 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.175 2013/07/30 19:09:57 sjg Exp $");
__RCSID("$NetBSD: job.c,v 1.176 2013/08/04 16:48:15 sjg Exp $");
#endif
#endif /* not lint */
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.222 2013/07/18 15:31:49 sjg Exp $ */
/* $NetBSD: main.c,v 1.224 2013/09/04 15:38:26 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.222 2013/07/18 15:31:49 sjg Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.224 2013/09/04 15:38:26 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.222 2013/07/18 15:31:49 sjg Exp $");
__RCSID("$NetBSD: main.c,v 1.224 2013/09/04 15:38:26 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -1414,7 +1414,7 @@ ReadMakefile(const void *p, const void *q MAKE_ATTR_UNUSED)
if (!strcmp(fname, "-")) {
Parse_File(NULL /*stdin*/, -1);
Var_Set("MAKEFILE", "", VAR_GLOBAL, 0);
Var_Set("MAKEFILE", "", VAR_INTERNAL, 0);
} else {
/* if we've chdir'd, rebuild the path name */
if (strcmp(curdir, objdir) && *fname != '/') {
@ -1463,7 +1463,7 @@ ReadMakefile(const void *p, const void *q MAKE_ATTR_UNUSED)
*/
found:
if (!doing_depend)
Var_Set("MAKEFILE", fname, VAR_GLOBAL, 0);
Var_Set("MAKEFILE", fname, VAR_INTERNAL, 0);
Parse_File(fname, fd);
}
free(path);

View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.220 2013/07/30 19:09:57 sjg Exp $
.\" $NetBSD: make.1,v 1.222 2013/08/11 09:53:49 apb 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 July 30, 2013
.Dd August 11, 2013
.Dt MAKE 1
.Os
.Sh NAME
@ -1982,6 +1982,12 @@ If the source is the special
.Ic .DOTLAST
target, then the current working
directory is searched last.
.It Ic .PATH. Ns Va suffix
Like
.Ic .PATH
but applies only to files with a particular suffix.
The suffix must have been previously declared with
.Ic .SUFFIXES .
.It Ic .PHONY
Apply the
.Ic .PHONY

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.91 2013/06/18 20:06:09 sjg Exp $ */
/* $NetBSD: make.h,v 1.92 2013/09/04 15:38:26 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -404,6 +404,10 @@ extern Boolean varNoExportEnv; /* TRUE if we should not export variables
extern GNode *DEFAULT; /* .DEFAULT rule */
extern GNode *VAR_INTERNAL; /* Variables defined internally by make
* which should not override those set by
* makefiles.
*/
extern GNode *VAR_GLOBAL; /* Variables defined in a global context, e.g
* in the Makefile itself */
extern GNode *VAR_CMD; /* Variables defined on the command line */

View File

@ -1,3 +1,14 @@
2013-09-04 Simon J. Gerraty <sjg@bad.crufty.net>
* gendirdeps.mk (_objtops): fix typo also
while processing M2D_OBJROOTS to gather qualdir_list
qualify $ql with loop iterator to ensure correct results.
2013-08-01 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20130801
* libs.mk: update to match progs.mk
2013-07-26 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20130726

View File

@ -1,4 +1,4 @@
# $Id: gendirdeps.mk,v 1.22 2013/05/11 05:16:26 sjg Exp $
# $Id: gendirdeps.mk,v 1.23 2013/09/04 17:49:20 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -162,7 +162,7 @@ dir_list != cd ${_OBJDIR} && \
.warning Skipping ${_DEPENDFILE:S,${SRCTOP}/,,}
# we are not going to update anything
.else
dpadd_dir_list=
.if !empty(DPADD)
_nonlibs := ${DPADD:T:Nlib*:N*include}
.if !empty(_nonlibs)
@ -174,6 +174,7 @@ ddep_list += $f.dirdep
ddep_list += ${f:H}.dirdep
.else
dir_list += ${f:H:tA}
dpadd_dir_list += ${f:H:tA}
.endif
.endfor
.if !empty(ddep_list)
@ -197,7 +198,7 @@ dir_list += ${ddeps}
# so we add
# ${"${dir_list:M*bsd/sys/${MACHINE_ARCH}/include}":?bsd/include:}
# to GENDIRDEPS_DIR_LIST_XTRAS
_objtops = ${OBJTOP} ${_OBJTOP} ${_obtop}
_objtops = ${OBJTOP} ${_OBJTOP} ${_objtop}
_objtops := ${_objtops:O:u}
dirdep_list = \
${_objtops:@o@${dir_list:M$o*/*:C,$o[^/]*/,,}@} \
@ -212,8 +213,11 @@ M2D_OBJROOTS := ${M2D_OBJROOTS:O:u:[-1..1]}
skip_ql= ${SRCTOP}* ${_objtops:@o@$o*@}
.for o in ${M2D_OBJROOTS:${skip_ql:${M_ListToSkip}}}
# we need := so only skip_ql to this point applies
ql := ${dir_list:${skip_ql:${M_ListToSkip}}:M$o*/*/*:C,$o([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,}
qualdir_list += ${ql}
ql.$o := ${dir_list:${skip_ql:${M_ListToSkip}}:M$o*/*/*:C,$o([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,}
qualdir_list += ${ql.$o}
.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
.info ${RELDIR}: o=$o ${ql.$o qualdir_list:L:@v@$v=${$v}@}
.endif
skip_ql+= $o*
.endfor
@ -241,6 +245,7 @@ DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:O:u}
.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
.info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS}
.info ${RELDIR}: dir_list='${dir_list}'
.info ${RELDIR}: dpadd_dir_list='${dpadd_dir_list}'
.info ${RELDIR}: dirdep_list='${dirdep_list}'
.info ${RELDIR}: qualdir_list='${qualdir_list}'
.info ${RELDIR}: SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS}'

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.92 2013/07/27 05:37:37 sjg Exp $
# $Id: install-mk,v 1.93 2013/08/02 18:28:47 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20130726
MK_VERSION=20130801
OWNER=
GROUP=
MODE=444

View File

@ -1,4 +1,4 @@
# $Id: libs.mk,v 1.2 2007/04/30 17:39:27 sjg Exp $
# $Id: libs.mk,v 1.3 2013/08/02 18:28:48 sjg Exp $
#
# @(#) Copyright (c) 2006, Simon J. Gerraty
#
@ -17,7 +17,15 @@
.if defined(LIBS)
# In meta mode, we can capture dependenices for _one_ of the progs.
# if makefile doesn't nominate one, we use the first.
.ifndef UPDATE_DEPENDFILE_LIB
UPDATE_DEPENDFILE_LIB = ${LIBS:[1]}
.export UPDATE_DEPENDFILE_LIB
.endif
.ifndef LIB
# They may have asked us to build just one
.for t in ${LIBS:R:T:S,^lib,,}
.if make(lib$t)
LIB?= $t
@ -28,14 +36,41 @@ lib$t: all
.if defined(LIB)
# just one of many
.for v in DPADD SRCS CFLAGS ${LIB_VARS}
$v += ${${v}_lib${LIB}}
LIB_VARS += \
LIBDIR \
CFLAGS \
COPTS \
CPPFLAGS \
CXXFLAGS \
DPADD \
DPLIBS \
LDADD \
LDFLAGS \
MAN \
SRCS
.for v in ${LIB_VARS:O:u}
.if defined(${v}.${LIB}) || defined(${v}_${LIB})
$v += ${${v}_${LIB}:U${${v}.${LIB}}}
.endif
.endfor
# for meta mode, there can be only one!
.if ${LIB} == ${UPDATE_DEPENDFILE_LIB:Uno}
UPDATE_DEPENDFILE ?= yes
.endif
UPDATE_DEPENDFILE ?= NO
# ensure that we don't clobber each other's dependencies
DEPENDFILE?= .depend.${LIB}
# lib.mk will do the rest
.else
all: ${LIBS:S,^lib,,:@t@lib$t.a@} .MAKE
# We cannot capture dependencies for meta mode here
UPDATE_DEPENDFILE = NO
# nor can we safely run in parallel.
.NOTPARALLEL:
.endif
.endif
@ -43,12 +78,16 @@ all: ${LIBS:S,^lib,,:@t@lib$t.a@} .MAKE
.include <${.PARSEFILE:S,libs,lib,}>
.ifndef LIB
.for t in ${LIBS:R:T:S,^lib,,}
lib$t.a: ${SRCS} ${DPADD} ${SRCS_lib$t} ${DPADD_lib$t}
(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$t)
# tell libs.mk we might want to install things
LIBS_TARGETS+= cleandepend cleandir cleanobj depend install
clean: $t.clean
$t.clean:
(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$t ${@:E})
.for b in ${LIBS:R:T:S,^lib,,}
lib$b.a: ${SRCS} ${DPADD} ${SRCS_lib$b} ${DPADD_lib$b}
(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b)
.for t in ${LIBS_TARGETS:O:u}
$b.$t: .PHONY .MAKE
(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} LIB=$b ${@:E})
.endfor
.endfor
.endif

View File

@ -1,4 +1,4 @@
# $Id: progs.mk,v 1.12 2013/04/22 18:10:04 sjg Exp $
# $Id: progs.mk,v 1.13 2013/08/02 18:28:48 sjg Exp $
#
# @(#) Copyright (c) 2006, Simon J. Gerraty
#
@ -35,9 +35,21 @@ PROG ?= $t
.if defined(PROG)
# just one of many
PROG_VARS += BINDIR CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS
PROG_VARS += \
BINDIR \
CFLAGS \
COPTS \
CPPFLAGS \
CXXFLAGS \
DPADD \
DPLIBS \
LDADD \
LDFLAGS \
MAN \
SRCS
.for v in ${PROG_VARS:O:u}
.if defined(${v}.${PROG})
.if defined(${v}.${PROG}) || defined(${v}_${PROG})
$v += ${${v}_${PROG}:U${${v}.${PROG}}}
.endif
.endfor

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.189 2013/06/18 19:31:27 sjg Exp $ */
/* $NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.189 2013/06/18 19:31:27 sjg Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 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.189 2013/06/18 19:31:27 sjg Exp $");
__RCSID("$NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -1751,6 +1751,12 @@ Parse_IsVar(char *line)
ch = *line++;
wasSpace = TRUE;
}
#ifdef SUNSHCMD
if (ch == ':' && strncmp(line, "sh", 2) == 0) {
line += 2;
continue;
}
#endif
if (ch == '=')
return TRUE;
if (*line == '=' && ISEQOPERATOR(ch))

View File

@ -1,6 +1,6 @@
# $Id: Makefile.in,v 1.43 2013/07/16 21:14:30 sjg Exp $
# $Id: Makefile.in,v 1.44 2013/08/28 22:09:29 sjg Exp $
#
# $NetBSD: Makefile,v 1.37 2013/07/16 19:59:28 sjg Exp $
# $NetBSD: Makefile,v 1.38 2013/08/28 21:56:50 sjg Exp $
#
# Unit tests for make(1)
# The main targets are:
@ -45,6 +45,7 @@ SUBFILES= \
phony-end \
posix \
qequals \
sunshcmd \
sysv \
ternary \
unexport \

View File

@ -0,0 +1,10 @@
BYECMD = echo bye
LATERCMD = echo later
TEST1 :sh = echo hello
TEST2 :sh = ${BYECMD}
TEST3 = ${LATERCMD:sh}
all:
@echo "TEST1=${TEST1}"
@echo "TEST2=${TEST2}"
@echo "TEST3=${TEST3}"

View File

@ -349,6 +349,9 @@ Now we expect an error...
*** Error code 1 (continuing)
`all' not remade because of errors.
V.i386 ?= OK
TEST1=hello
TEST2=bye
TEST3=later
FOOBAR =
FOOBAR = foobar fubar
fun

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.183 2013/07/16 20:00:56 sjg Exp $ */
/* $NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.183 2013/07/16 20:00:56 sjg Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 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.183 2013/07/16 20:00:56 sjg Exp $");
__RCSID("$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -187,6 +187,7 @@ static char varNoError[] = "";
* The four contexts are searched in the reverse order from which they are
* listed.
*/
GNode *VAR_INTERNAL; /* variables from make itself */
GNode *VAR_GLOBAL; /* variables from the makefile */
GNode *VAR_CMD; /* variables defined on the command-line */
@ -419,6 +420,10 @@ VarFind(const char *name, GNode *ctxt, int flags)
(ctxt != VAR_GLOBAL))
{
var = Hash_FindEntry(&VAR_GLOBAL->context, name);
if ((var == NULL) && (ctxt != VAR_INTERNAL)) {
/* VAR_INTERNAL is subordinate to VAR_GLOBAL */
var = Hash_FindEntry(&VAR_INTERNAL->context, name);
}
}
if ((var == NULL) && (flags & FIND_ENV)) {
char *env;
@ -440,6 +445,9 @@ VarFind(const char *name, GNode *ctxt, int flags)
(ctxt != VAR_GLOBAL))
{
var = Hash_FindEntry(&VAR_GLOBAL->context, name);
if ((var == NULL) && (ctxt != VAR_INTERNAL)) {
var = Hash_FindEntry(&VAR_INTERNAL->context, name);
}
if (var == NULL) {
return NULL;
} else {
@ -4182,6 +4190,7 @@ Var_GetHead(char *file)
void
Var_Init(void)
{
VAR_INTERNAL = Targ_NewGN("Internal");
VAR_GLOBAL = Targ_NewGN("Global");
VAR_CMD = Targ_NewGN("Command");

View File

@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
CLEANDIRS+= FreeBSD
CLEANFILES+= bootstrap
# $Id: Makefile,v 1.17 2013/07/30 19:13:53 sjg Exp $
# $Id: Makefile,v 1.20 2013/09/04 15:42:03 sjg Exp $
# Base version on src date
MAKE_VERSION= 20130810
MAKE_VERSION= 20130904
PROG?= ${.CURDIR:T}

View File

@ -5,9 +5,9 @@
SRCTOP?= ${.CURDIR:H:H:H}
# $Id: Makefile.in,v 1.43 2013/07/16 21:14:30 sjg Exp $
# $Id: Makefile.in,v 1.44 2013/08/28 22:09:29 sjg Exp $
#
# $NetBSD: Makefile,v 1.37 2013/07/16 19:59:28 sjg Exp $
# $NetBSD: Makefile,v 1.38 2013/08/28 21:56:50 sjg Exp $
#
# Unit tests for make(1)
# The main targets are:
@ -52,6 +52,7 @@ SUBFILES= \
phony-end \
posix \
qequals \
sunshcmd \
sysv \
ternary \
unexport \