aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2013-09-05 15:49:22 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2013-09-05 15:49:22 +0000
commit55ec07f91d773f513ce6737bff154f1b59d740cf (patch)
treefc351927db9fe1a28116c4bcf139e54ae0cdfc8c
parente0f69e1d23f496f590728b9bb0cf0778e4df1210 (diff)
downloadsrc-55ec07f91d773f513ce6737bff154f1b59d740cf.tar.gz
src-55ec07f91d773f513ce6737bff154f1b59d740cf.zip
Import bmake-20130904vendor/NetBSD/bmake/20130904
Notes
Notes: svn path=/vendor/NetBSD/bmake/dist/; revision=255250 svn path=/vendor/NetBSD/bmake/20130904/; revision=255251; tag=vendor/NetBSD/bmake/20130904
-rw-r--r--ChangeLog21
-rw-r--r--FILES1
-rw-r--r--Makefile4
-rw-r--r--bmake.110
-rw-r--r--bmake.cat16
-rw-r--r--compat.c8
-rw-r--r--job.c7
-rw-r--r--main.c11
-rw-r--r--make.110
-rw-r--r--make.h6
-rw-r--r--mk/ChangeLog11
-rw-r--r--mk/gendirdeps.mk15
-rw-r--r--mk/install-mk4
-rw-r--r--mk/libs.mk57
-rw-r--r--mk/progs.mk18
-rw-r--r--parse.c22
-rw-r--r--unit-tests/Makefile.in5
-rw-r--r--unit-tests/sunshcmd10
-rw-r--r--unit-tests/test.exp3
-rw-r--r--var.c15
20 files changed, 196 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index 21ab78e57216..251998fd79c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/FILES b/FILES
index b0d8b2ed6954..d4b5dca38c89 100644
--- a/FILES
+++ b/FILES
@@ -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
diff --git a/Makefile b/Makefile
index 1b1cd5944d4b..98df1e264a80 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/bmake.1 b/bmake.1
index 021a94ad24ac..df604e7c940f 100644
--- a/bmake.1
+++ b/bmake.1
@@ -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
diff --git a/bmake.cat1 b/bmake.cat1
index e18c26729145..ca49bb63c03c 100644
--- a/bmake.cat1
+++ b/bmake.cat1
@@ -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
diff --git a/compat.c b/compat.c
index 35860485581c..b0bbc936f595 100644
--- a/compat.c
+++ b/compat.c
@@ -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
@@ -340,7 +340,7 @@ again:
/*
* The following work for any of the builtin shell specs.
*/
- if (shellErrFlag) {
+ if (errCheck && shellErrFlag) {
shargv[shargc++] = shellErrFlag;
}
if (DEBUG(SHELL))
diff --git a/job.c b/job.c
index 902050d22374..b5dbf4cb56f1 100644
--- a/job.c
+++ b/job.c
@@ -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
@@ -2214,6 +2214,7 @@ Job_SetPrefix(void)
void
Job_Init(void)
{
+ Job_SetPrefix();
/* Allocate space for all the job info */
job_table = bmake_malloc(maxJobs * sizeof *job_table);
memset(job_table, 0, maxJobs * sizeof *job_table);
diff --git a/main.c b/main.c
index 3a164ce33f5d..45a45e0dcd68 100644
--- a/main.c
+++ b/main.c
@@ -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
@@ -1026,7 +1026,6 @@ main(int argc, char **argv)
snprintf(pn, sizeof(pn), "%s[%d]", progname, makelevel);
progname = bmake_strdup(pn);
}
- Job_SetPrefix();
#ifdef USE_META
meta_init();
@@ -1415,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 != '/') {
@@ -1464,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);
diff --git a/make.1 b/make.1
index 4e3c11170051..142e989adc30 100644
--- a/make.1
+++ b/make.1
@@ -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
diff --git a/make.h b/make.h
index c51fbe5ef629..b13716fd3b48 100644
--- a/make.h
+++ b/make.h
@@ -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 */
diff --git a/mk/ChangeLog b/mk/ChangeLog
index db1e289f92b1..b5471975a010 100644
--- a/mk/ChangeLog
+++ b/mk/ChangeLog
@@ -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
diff --git a/mk/gendirdeps.mk b/mk/gendirdeps.mk
index 9be367369f57..20e2b152a3fa 100644
--- a/mk/gendirdeps.mk
+++ b/mk/gendirdeps.mk
@@ -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}'
diff --git a/mk/install-mk b/mk/install-mk
index 59b1b0151fee..0640906a2438 100644
--- a/mk/install-mk
+++ b/mk/install-mk
@@ -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
diff --git a/mk/libs.mk b/mk/libs.mk
index 05b450689b11..7f974bfa86b9 100644
--- a/mk/libs.mk
+++ b/mk/libs.mk
@@ -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
diff --git a/mk/progs.mk b/mk/progs.mk
index f74f64012849..7ccebbffb44c 100644
--- a/mk/progs.mk
+++ b/mk/progs.mk
@@ -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
diff --git a/parse.c b/parse.c
index 928ff4aa2930..41323b51fa8b 100644
--- a/parse.c
+++ b/parse.c
@@ -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))
@@ -2582,6 +2588,16 @@ ParseGetLine(int flags, int *length)
if (cf->P_end == NULL)
/* End of string (aka for loop) data */
break;
+ /* see if there is more we can parse */
+ while (ptr++ < cf->P_end) {
+ if ((ch = *ptr) == '\n') {
+ if (ptr > line && ptr[-1] == '\\')
+ continue;
+ Parse_Error(PARSE_WARNING,
+ "Zero byte read from file, skipping rest of line.");
+ break;
+ }
+ }
if (cf->nextbuf != NULL) {
/*
* End of this buffer; return EOF and outer logic
diff --git a/unit-tests/Makefile.in b/unit-tests/Makefile.in
index 78ca92faa1d9..3f70f8a4d9fa 100644
--- a/unit-tests/Makefile.in
+++ b/unit-tests/Makefile.in
@@ -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 \
diff --git a/unit-tests/sunshcmd b/unit-tests/sunshcmd
new file mode 100644
index 000000000000..e3baf901e51d
--- /dev/null
+++ b/unit-tests/sunshcmd
@@ -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}"
diff --git a/unit-tests/test.exp b/unit-tests/test.exp
index b6fad78d21bc..aaecb960fc99 100644
--- a/unit-tests/test.exp
+++ b/unit-tests/test.exp
@@ -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
diff --git a/var.c b/var.c
index c5c16b8803b6..290ad3a2b293 100644
--- a/var.c
+++ b/var.c
@@ -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
@@ -176,6 +176,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 */
@@ -408,6 +409,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;
@@ -429,6 +434,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 {
@@ -4137,6 +4145,7 @@ Var_GetHead(char *file)
void
Var_Init(void)
{
+ VAR_INTERNAL = Targ_NewGN("Internal");
VAR_GLOBAL = Targ_NewGN("Global");
VAR_CMD = Targ_NewGN("Command");