Update bmake to version 20180919

Cleanup of stats cache
and new :q modifier.
This commit is contained in:
sjg 2018-12-06 20:56:19 +00:00
commit 9944792304
20 changed files with 160 additions and 94 deletions

View File

@ -1,3 +1,14 @@
2018-09-21 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20180919
Merge with NetBSD make, pick up
o var.c: add :q
o dir.c: cleanup caching of stats
2018-09-21 Simon J Gerraty <sjg@beast.crufty.net>
* Makefile.config.in: use += where it makes sense.
2018-05-12 Simon J. Gerraty <sjg@bad.crufty.net> 2018-05-12 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20180512 * VERSION: 20180512

View File

@ -163,6 +163,8 @@ unit-tests/varcmd.exp
unit-tests/varcmd.mk unit-tests/varcmd.mk
unit-tests/varmisc.exp unit-tests/varmisc.exp
unit-tests/varmisc.mk unit-tests/varmisc.mk
unit-tests/varquote.exp
unit-tests/varquote.mk
unit-tests/varshell.exp unit-tests/varshell.exp
unit-tests/varshell.mk unit-tests/varshell.mk
util.c util.c

View File

@ -1,6 +1,6 @@
# things set by configure # things set by configure
_MAKE_VERSION=@_MAKE_VERSION@ _MAKE_VERSION?=@_MAKE_VERSION@
prefix?= @prefix@ prefix?= @prefix@
srcdir= @srcdir@ srcdir= @srcdir@
@ -11,9 +11,9 @@ DEFAULT_SYS_PATH?= @default_sys_path@
CPPFLAGS+= @CPPFLAGS@ CPPFLAGS+= @CPPFLAGS@
CFLAGS+= ${CPPFLAGS} @DEFS@ CFLAGS+= ${CPPFLAGS} @DEFS@
LDFLAGS= @LDFLAGS@ LDFLAGS+= @LDFLAGS@
LIBOBJS= @LIBOBJS@ LIBOBJS+= @LIBOBJS@
LDADD= @LIBS@ LDADD+= @LIBS@
USE_META= @use_meta@ USE_META= @use_meta@
FILEMON_H?= @filemon_h@ FILEMON_H?= @filemon_h@
BMAKE_PATH_MAX?= @bmake_path_max@ BMAKE_PATH_MAX?= @bmake_path_max@

View File

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

View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.272 2018/04/02 04:26:17 dholland Exp $ .\" $NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $
.\" .\"
.\" Copyright (c) 1990, 1993 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\" .\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\" .\"
.Dd June 22, 2017 .Dd May 26, 2018
.Dt BMAKE 1 .Dt BMAKE 1
.Os .Os
.Sh NAME .Sh NAME
@ -1227,8 +1227,15 @@ due uno quattro tre
.Ed .Ed
.It Cm \&:Q .It Cm \&:Q
Quotes every shell meta-character in the variable, so that it can be passed Quotes every shell meta-character in the variable, so that it can be passed
safely to the shell.
.It Cm \&:q
Quotes every shell meta-character in the variable, and also doubles
.Sq $
characters so that it can be passed
safely through recursive invocations of safely through recursive invocations of
.Nm . .Nm .
This is equivalent to:
.Sq \&:S/\e\&$/&&/g:Q .
.It Cm \&:R .It Cm \&:R
Replaces each word in the variable with everything but its suffix. Replaces each word in the variable with everything but its suffix.
.It Cm \&:range[=count] .It Cm \&:range[=count]

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $ */ /* $NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $"; static char rcsid[] = "$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else #else
__RCSID("$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $"); __RCSID("$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -268,15 +268,6 @@ struct cache_st {
}; };
/* minimize changes below */ /* minimize changes below */
static time_t
Hash_GetTimeValue(Hash_Entry *entry)
{
struct cache_st *cst;
cst = entry->clientPtr;
return cst->mtime;
}
#define CST_LSTAT 1 #define CST_LSTAT 1
#define CST_UPDATE 2 #define CST_UPDATE 2
@ -298,6 +289,10 @@ cached_stats(Hash_Table *htp, const char *pathname, struct stat *st, int flags)
memset(st, 0, sizeof(*st)); memset(st, 0, sizeof(*st));
st->st_mtime = cst->mtime; st->st_mtime = cst->mtime;
st->st_mode = cst->mode; st->st_mode = cst->mode;
if (DEBUG(DIR)) {
fprintf(debug_file, "Using cached time %s for %s\n",
Targ_FmtTime(st->st_mtime), pathname);
}
return 0; return 0;
} }
@ -315,6 +310,10 @@ cached_stats(Hash_Table *htp, const char *pathname, struct stat *st, int flags)
cst = entry->clientPtr; cst = entry->clientPtr;
cst->mtime = st->st_mtime; cst->mtime = st->st_mtime;
cst->mode = st->st_mode; cst->mode = st->st_mode;
if (DEBUG(DIR)) {
fprintf(debug_file, " Caching %s for %s\n",
Targ_FmtTime(st->st_mtime), pathname);
}
return 0; return 0;
} }
@ -995,14 +994,6 @@ DirLookupSubdir(Path *p, const char *name)
} }
if (cached_stat(file, &stb) == 0) { if (cached_stat(file, &stb) == 0) {
/*
* Save the modification time so if it's needed, we don't have
* to fetch it again.
*/
if (DEBUG(DIR)) {
fprintf(debug_file, " Caching %s for %s\n", Targ_FmtTime(stb.st_mtime),
file);
}
nearmisses += 1; nearmisses += 1;
return (file); return (file);
} }
@ -1134,7 +1125,6 @@ Dir_FindFile(const char *name, Lst path)
Boolean hasLastDot = FALSE; /* true we should search dot last */ Boolean hasLastDot = FALSE; /* true we should search dot last */
Boolean hasSlash; /* true if 'name' contains a / */ Boolean hasSlash; /* true if 'name' contains a / */
struct stat stb; /* Buffer for stat, if necessary */ struct stat stb; /* Buffer for stat, if necessary */
Hash_Entry *entry; /* Entry for mtimes table */
const char *trailing_dot = "."; const char *trailing_dot = ".";
/* /*
@ -1395,24 +1385,14 @@ Dir_FindFile(const char *name, Lst path)
} }
bigmisses += 1; bigmisses += 1;
entry = Hash_FindEntry(&mtimes, name); if (cached_stat(name, &stb) == 0) {
if (entry != NULL) {
if (DEBUG(DIR)) {
fprintf(debug_file, " got it (in mtime cache)\n");
}
return(bmake_strdup(name));
} else if (cached_stat(name, &stb) == 0) {
if (DEBUG(DIR)) {
fprintf(debug_file, " Caching %s for %s\n", Targ_FmtTime(stb.st_mtime),
name);
}
return (bmake_strdup(name)); return (bmake_strdup(name));
} else {
if (DEBUG(DIR)) {
fprintf(debug_file, " failed. Returning NULL\n");
}
return NULL;
} }
if (DEBUG(DIR)) {
fprintf(debug_file, " failed. Returning NULL\n");
}
return NULL;
#endif /* notdef */ #endif /* notdef */
} }
@ -1518,7 +1498,6 @@ Dir_MTime(GNode *gn, Boolean recheck)
{ {
char *fullName; /* the full pathname of name */ char *fullName; /* the full pathname of name */
struct stat stb; /* buffer for finding the mod time */ struct stat stb; /* buffer for finding the mod time */
Hash_Entry *entry;
if (gn->type & OP_ARCHV) { if (gn->type & OP_ARCHV) {
return Arch_MTime(gn); return Arch_MTime(gn);
@ -1569,17 +1548,7 @@ Dir_MTime(GNode *gn, Boolean recheck)
fullName = bmake_strdup(gn->name); fullName = bmake_strdup(gn->name);
} }
if (!recheck) if (cached_stats(&mtimes, fullName, &stb, recheck ? CST_UPDATE : 0) < 0) {
entry = Hash_FindEntry(&mtimes, fullName);
else
entry = NULL;
if (entry != NULL) {
stb.st_mtime = Hash_GetTimeValue(entry);
if (DEBUG(DIR)) {
fprintf(debug_file, "Using cached time %s for %s\n",
Targ_FmtTime(stb.st_mtime), fullName);
}
} else if (cached_stats(&mtimes, fullName, &stb, recheck ? CST_UPDATE : 0) < 0) {
if (gn->type & OP_MEMBER) { if (gn->type & OP_MEMBER) {
if (fullName != gn->path) if (fullName != gn->path)
free(fullName); free(fullName);

View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.272 2018/04/02 04:26:17 dholland Exp $ .\" $NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $
.\" .\"
.\" Copyright (c) 1990, 1993 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\" .\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\" .\"
.Dd September 27, 2018 .Dd December 5, 2018
.Dt MAKE 1 .Dt MAKE 1
.Os .Os
.Sh NAME .Sh NAME
@ -1238,8 +1238,15 @@ due uno quattro tre
.Ed .Ed
.It Cm \&:Q .It Cm \&:Q
Quotes every shell meta-character in the variable, so that it can be passed Quotes every shell meta-character in the variable, so that it can be passed
safely to the shell.
.It Cm \&:q
Quotes every shell meta-character in the variable, and also doubles
.Sq $
characters so that it can be passed
safely through recursive invocations of safely through recursive invocations of
.Nm . .Nm .
This is equivalent to:
.Sq \&:S/\e\&$/&&/g:Q .
.It Cm \&:R .It Cm \&:R
Replaces each word in the variable with everything but its suffix. Replaces each word in the variable with everything but its suffix.
.It Cm \&:range[=count] .It Cm \&:range[=count]

View File

@ -1,3 +1,25 @@
2018-09-19 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20180919
* dirdeps-options.mk: .undef cannot handle var that expands to
more than one var.
2018-07-08 Simon J Gerraty <sjg@beast.crufty.net>
* meta.stage.mk: allow wildcards in STAGE_FILES.* etc.
2018-06-01 Simon J Gerraty <sjg@beast.crufty.net>
* meta.autodep.mk: export META_FILES to avoid command line limit
* gendirdeps.mk: if we have lots of .meta files put them in
an @list
2018-05-28 Simon J Gerraty <sjg@beast.crufty.net>
* dirdeps-options.mk: use local.dirdeps-options.mk
not local.dirdeps-option.mk
2018-04-20 Simon J Gerraty <sjg@beast.crufty.net> 2018-04-20 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20180420 * install-mk (MK_VERSION): 20180420

View File

@ -1,4 +1,4 @@
# $Id: dirdeps-options.mk,v 1.5 2018/04/18 15:53:57 sjg Exp $ # $Id: dirdeps-options.mk,v 1.9 2018/09/20 00:07:19 sjg Exp $
# #
# @(#) Copyright (c) 2018, Simon J. Gerraty # @(#) Copyright (c) 2018, Simon J. Gerraty
# #
@ -25,7 +25,7 @@
# If a Makefile.depend.options file exists, it will be included by # If a Makefile.depend.options file exists, it will be included by
# dirdeps.mk and meta.autodep.mk # dirdeps.mk and meta.autodep.mk
# #
# We include local.dirdeps-option.mk which may also define DIRDEPS.* # We include local.dirdeps-options.mk which may also define DIRDEPS.*
# for options. # for options.
# #
# Thus a directory, that is affected by an option FOO would have # Thus a directory, that is affected by an option FOO would have
@ -35,7 +35,7 @@
# DIRDEPS.FOO.yes # DIRDEPS.FOO.yes
# DIRDEPS.FOO.no # DIRDEPS.FOO.no
# to whatever applies for that dir, or it can rely on globals # to whatever applies for that dir, or it can rely on globals
# set in local.dirdeps-option.mk # set in local.dirdeps-options.mk
# Either way, we will .undef DIRDEPS.* when done. # Either way, we will .undef DIRDEPS.* when done.
# This should have been set by Makefile.depend.options # This should have been set by Makefile.depend.options
@ -43,7 +43,7 @@
DIRDEPS_OPTIONS ?= DIRDEPS_OPTIONS ?=
# pickup any DIRDEPS.* we need # pickup any DIRDEPS.* we need
.-include <local.dirdeps-option.mk> .-include <local.dirdeps-options.mk>
.if ${.MAKE.LEVEL} == 0 .if ${.MAKE.LEVEL} == 0
# :U below avoids potential errors when we := # :U below avoids potential errors when we :=
@ -52,7 +52,10 @@ DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U}
.endfor .endfor
DIRDEPS := ${DIRDEPS:O:u} DIRDEPS := ${DIRDEPS:O:u}
# avoid cross contamination # avoid cross contamination
.undef ${DIRDEPS_OPTIONS:tu:@o@DIRDEPS.$o.yes DIRDEPS.$o.no@} .for o in ${DIRDEPS_OPTIONS:tu}
.undef DIRDEPS.$o.yes
.undef DIRDEPS.$o.no
.endfor
.else .else
# whether options are enabled or not, # whether options are enabled or not,
# we want to filter out the relevant DIRDEPS.* # we want to filter out the relevant DIRDEPS.*

View File

@ -1,4 +1,4 @@
# $Id: dirdeps.mk,v 1.95 2018/04/23 17:53:56 sjg Exp $ # $Id: dirdeps.mk,v 1.96 2018/06/20 22:26:39 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc. # Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved. # All rights reserved.
@ -731,6 +731,8 @@ DIRDEPS =
.info loading ${_m} for ${d:E} .info loading ${_m} for ${d:E}
.endif .endif
.include <${_m}> .include <${_m}>
.else
.-include <local.dirdeps-missing.mk>
.endif .endif
.endif .endif
.endif .endif
@ -746,7 +748,7 @@ DIRDEPS =
DEP_RELDIR := ${RELDIR} DEP_RELDIR := ${RELDIR}
_DEP_RELDIR := ${RELDIR} _DEP_RELDIR := ${RELDIR}
# Since we are/should be included by .MAKE.DEPENDFILE # Since we are/should be included by .MAKE.DEPENDFILE
# is is a final opportunity to add/hook global rules. # This is a final opportunity to add/hook global rules.
.-include <local.dirdeps-build.mk> .-include <local.dirdeps-build.mk>
# pickup local dependencies # pickup local dependencies

View File

@ -1,4 +1,4 @@
# $Id: gendirdeps.mk,v 1.38 2018/03/10 00:53:52 sjg Exp $ # $Id: gendirdeps.mk,v 1.39 2018/06/08 01:25:31 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc. # Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved. # All rights reserved.
@ -171,11 +171,27 @@ GENDIRDEPS_SEDCMDS += \
# we canonicalize them to keep things simple # we canonicalize them to keep things simple
# if we are using a split-fs sandbox, it gets a little messier. # if we are using a split-fs sandbox, it gets a little messier.
_objtop := ${_OBJTOP:tA} _objtop := ${_OBJTOP:tA}
# some people put *.meta in META_XTRAS to make sure we get here
_meta_files := ${META_FILES:N\*.meta:O:u}
# assume a big list
_meta_files_arg= @meta.list
.if empty(_meta_files) && ${META_FILES:M\*.meta} != ""
# XXX this should be considered a bad idea,
# since we cannot ignore stale .meta
x != cd ${_OBJDIR} && find . -name '*.meta' -print -o \( -type d ! -name . -prune \) | sed 's,^./,,' > meta.list; echo
.elif ${_meta_files:[#]} > 500
.export _meta_files
x != echo; for m in $$_meta_files; do echo $$m; done > meta.list
.else
_meta_files_arg:= ${_meta_files}
.endif
dir_list != cd ${_OBJDIR} && \ dir_list != cd ${_OBJDIR} && \
${META2DEPS_CMD} MACHINE=${MACHINE} \ ${META2DEPS_CMD} MACHINE=${MACHINE} \
SRCTOP=${SRCTOP} RELDIR=${RELDIR} CURDIR=${_CURDIR} \ SRCTOP=${SRCTOP} RELDIR=${RELDIR} CURDIR=${_CURDIR} \
${META2DEPS_ARGS} \ ${META2DEPS_ARGS} \
${META_FILES:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ ${_meta_files_arg} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \
sed ${GENDIRDEPS_SEDCMDS} sed ${GENDIRDEPS_SEDCMDS}
.if ${dir_list:M*ERROR\:*} != "" .if ${dir_list:M*ERROR\:*} != ""

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net> # Simon J. Gerraty <sjg@crufty.net>
# RCSid: # RCSid:
# $Id: install-mk,v 1.156 2018/04/22 04:42:47 sjg Exp $ # $Id: install-mk,v 1.160 2018/09/20 00:07:19 sjg Exp $
# #
# @(#) Copyright (c) 1994 Simon J. Gerraty # @(#) Copyright (c) 1994 Simon J. Gerraty
# #
@ -70,7 +70,7 @@
# sjg@crufty.net # sjg@crufty.net
# #
MK_VERSION=20180420 MK_VERSION=20180919
OWNER= OWNER=
GROUP= GROUP=
MODE=444 MODE=444

View File

@ -1,4 +1,4 @@
# $Id: meta.autodep.mk,v 1.48 2018/04/15 06:30:04 sjg Exp $ # $Id: meta.autodep.mk,v 1.50 2018/06/08 01:25:31 sjg Exp $
# #
# @(#) Copyright (c) 2010, Simon J. Gerraty # @(#) Copyright (c) 2010, Simon J. Gerraty
@ -20,9 +20,11 @@ __${_this}__: .NOTMAIN
.-include <local.autodep.mk> .-include <local.autodep.mk>
PICO?= .pico
.if defined(SRCS) .if defined(SRCS)
# it would be nice to be able to query .SUFFIXES # it would be nice to be able to query .SUFFIXES
OBJ_EXTENSIONS+= .o .po .lo .So OBJ_EXTENSIONS+= .o .po .lo ${PICO}
# explicit dependencies help short-circuit .SUFFIX searches # explicit dependencies help short-circuit .SUFFIX searches
SRCS_DEP_FILTER+= N*.[hly] SRCS_DEP_FILTER+= N*.[hly]
@ -178,7 +180,7 @@ DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh
@case "${.MAKE.META.FILES:T:M*.po.*}" in \ @case "${.MAKE.META.FILES:T:M*.po.*}" in \
*.po.*) mv $@.${.MAKE.PID} $@;; \ *.po.*) mv $@.${.MAKE.PID} $@;; \
*) { cat $@.${.MAKE.PID}; \ *) { cat $@.${.MAKE.PID}; \
sed 's,\.So:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \ sed 's,\${PICO}:,.o:,;s,\.o:,.po:,' $@.${.MAKE.PID}; } | sort -u > $@; \
rm -f $@.${.MAKE.PID};; \ rm -f $@.${.MAKE.PID};; \
esac esac
.else .else
@ -243,7 +245,7 @@ META_FILES = *.meta
.elif ${OPTIMIZE_OBJECT_META_FILES:Uno:tl} == "no" .elif ${OPTIMIZE_OBJECT_META_FILES:Uno:tl} == "no"
META_FILES = ${.MAKE.META.FILES:T:N.depend*:O:u} META_FILES = ${.MAKE.META.FILES:T:N.depend*:O:u}
.else .else
# if we have 1000's of .o.meta, .So.meta etc we need only look at one set # if we have 1000's of .o.meta, ${PICO}.meta etc we need only look at one set
# it is left as an exercise for the reader to work out what this does # it is left as an exercise for the reader to work out what this does
META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \ META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \
${.MAKE.META.FILES:T:M*.${.MAKE.META.FILES:M*o.meta:R:E:O:u:[1]}.meta:O:u} ${.MAKE.META.FILES:T:M*.${.MAKE.META.FILES:M*o.meta:R:E:O:u:[1]}.meta:O:u}
@ -260,6 +262,9 @@ META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \
.if !empty(GENDIRDEPS_FILTER) .if !empty(GENDIRDEPS_FILTER)
.export GENDIRDEPS_FILTER .export GENDIRDEPS_FILTER
.endif .endif
# export to avoid blowing command line limit
META_FILES := ${META_XTRAS:U:O:u} ${META_FILES:U:T:O:u:${META_FILE_FILTER:ts:}}
.export META_FILES
.endif .endif
# we might have .../ in MAKESYSPATH # we might have .../ in MAKESYSPATH
@ -270,8 +275,7 @@ ${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.MET
SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \ SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \
DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \ DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \
MAKESYSPATH=${_makesyspath} \ MAKESYSPATH=${_makesyspath} \
${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE} \ ${.MAKE} -f gendirdeps.mk RELDIR=${RELDIR} _DEPENDFILE=${_DEPENDFILE})
META_FILES='${META_XTRAS:O:u} ${META_FILES:T:O:u:${META_FILE_FILTER:ts:}}')
@test -s $@ && touch $@; : @test -s $@ && touch $@; :
.endif .endif

View File

@ -1,4 +1,4 @@
# $Id: meta.stage.mk,v 1.55 2017/10/27 01:17:09 sjg Exp $ # $Id: meta.stage.mk,v 1.56 2018/07/08 17:12:54 sjg Exp $
# #
# @(#) Copyright (c) 2011-2017, Simon J. Gerraty # @(#) Copyright (c) 2011-2017, Simon J. Gerraty
# #
@ -141,7 +141,7 @@ _STAGE_AS_BASENAME_USE: .USE .dirdep ${.TARGET:T}
.if !empty(STAGE_INCSDIR) .if !empty(STAGE_INCSDIR)
.if !empty(STAGE_INCS) .if !empty(STAGE_INCS)
stage_incs: ${STAGE_INCS} stage_incs: ${STAGE_INCS:N*\**}
.endif .endif
.if target(stage_incs) || !empty(.ALLTARGETS:Mstage_includes) .if target(stage_incs) || !empty(.ALLTARGETS:Mstage_includes)
STAGE_TARGETS += stage_incs STAGE_TARGETS += stage_incs
@ -156,7 +156,7 @@ stage_incs: .dirdep
.if !empty(STAGE_LIBDIR) .if !empty(STAGE_LIBDIR)
.if !empty(STAGE_LIBS) .if !empty(STAGE_LIBS)
stage_libs: ${STAGE_LIBS} stage_libs: ${STAGE_LIBS:N*\**}
.endif .endif
.if target(stage_libs) .if target(stage_libs)
STAGE_TARGETS += stage_libs STAGE_TARGETS += stage_libs
@ -191,7 +191,7 @@ CLEANFILES += ${STAGE_SETS:@s@stage*$s@}
# some makefiles need to populate multiple directories # some makefiles need to populate multiple directories
.for s in ${STAGE_SETS:O:u} .for s in ${STAGE_SETS:O:u}
.if !empty(STAGE_FILES.$s) .if !empty(STAGE_FILES.$s)
stage_files.$s: ${STAGE_FILES.$s} stage_files.$s: ${STAGE_FILES.$s:N*\**}
.endif .endif
.if target(stage_files.$s) || target(stage_files${s:S,^,.,:N._default}) .if target(stage_files.$s) || target(stage_files${s:S,^,.,:N._default})
STAGE_TARGETS += stage_files STAGE_TARGETS += stage_files
@ -262,7 +262,7 @@ CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@}
# both operations happen together # both operations happen together
.for s in ${STAGE_AS_SETS:O:u} .for s in ${STAGE_AS_SETS:O:u}
.if !empty(STAGE_AS.$s) .if !empty(STAGE_AS.$s)
stage_as.$s: ${STAGE_AS.$s} stage_as.$s: ${STAGE_AS.$s:N*\**}
.endif .endif
.if target(stage_as.$s) .if target(stage_as.$s)
STAGE_TARGETS += stage_as STAGE_TARGETS += stage_as
@ -277,7 +277,7 @@ stage_as.$s: .dirdep
.endif .endif
.if !empty(STAGE_AS_AND_SYMLINK.$s) .if !empty(STAGE_AS_AND_SYMLINK.$s)
stage_as_and_symlink.$s: ${STAGE_AS_AND_SYMLINK.$s} stage_as_and_symlink.$s: ${STAGE_AS_AND_SYMLINK.$s:N*\**}
.endif .endif
.if target(stage_as_and_symlink.$s) .if target(stage_as_and_symlink.$s)
STAGE_TARGETS += stage_as_and_symlink STAGE_TARGETS += stage_as_and_symlink

View File

@ -1,6 +1,6 @@
# $Id: Makefile.in,v 1.48 2015/12/07 04:06:29 sjg Exp $ # $Id: Makefile.in,v 1.49 2018/09/21 21:39:05 sjg Exp $
# #
# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $ # $NetBSD: Makefile,v 1.53 2018/05/24 00:25:44 christos Exp $
# #
# Unit tests for make(1) # Unit tests for make(1)
# The main targets are: # The main targets are:
@ -54,6 +54,7 @@ TESTNAMES= \
unexport-env \ unexport-env \
varcmd \ varcmd \
varmisc \ varmisc \
varquote \
varshell varshell
# these tests were broken by referting POSIX chanegs # these tests were broken by referting POSIX chanegs

View File

@ -0,0 +1,3 @@
-fdebug-prefix-map=$NETBSDSRCDIR=/usr/src -fdebug-regex-map=/usr/src/(.*)/obj$=/usr/obj/\1
-fdebug-prefix-map=$NETBSDSRCDIR=/usr/src -fdebug-regex-map=/usr/src/(.*)/obj$=/usr/obj/\1
exit status 0

View File

@ -0,0 +1,14 @@
# $NetBSD: varquote.mk,v 1.2 2018/05/27 01:14:51 christos Exp $
#
# Test VAR:q modifier
.if !defined(REPROFLAGS)
REPROFLAGS+= -fdebug-prefix-map=\$$NETBSDSRCDIR=/usr/src
REPROFLAGS+= -fdebug-regex-map='/usr/src/(.*)/obj$$=/usr/obj/\1'
all:
@${MAKE} -f ${MAKEFILE} REPROFLAGS=${REPROFLAGS:S/\$/&&/g:Q}
@${MAKE} -f ${MAKEFILE} REPROFLAGS=${REPROFLAGS:q}
.else
all:
@echo ${REPROFLAGS}
.endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.218 2018/02/18 00:52:42 sjg Exp $ */ /* $NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.218 2018/02/18 00:52:42 sjg Exp $"; static char rcsid[] = "$NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: var.c,v 1.218 2018/02/18 00:52:42 sjg Exp $"); __RCSID("$NetBSD: var.c,v 1.220 2018/05/27 01:14:51 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -324,7 +324,7 @@ static Boolean VarLoopExpand(GNode *, Var_Parse_State *,
static char *VarGetPattern(GNode *, Var_Parse_State *, static char *VarGetPattern(GNode *, Var_Parse_State *,
int, const char **, int, int *, int *, int, const char **, int, int *, int *,
VarPattern *); VarPattern *);
static char *VarQuote(char *); static char *VarQuote(char *, Boolean);
static char *VarHash(char *); static char *VarHash(char *);
static char *VarModify(GNode *, Var_Parse_State *, static char *VarModify(GNode *, Var_Parse_State *,
const char *, const char *,
@ -2315,6 +2315,7 @@ VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
* VarQuote -- * VarQuote --
* Quote shell meta-characters and space characters in the string * Quote shell meta-characters and space characters in the string
* if quoteDollar is set, also quote and double any '$' characters.
* *
* Results: * Results:
* The quoted string * The quoted string
@ -2325,7 +2326,7 @@ VarGetPattern(GNode *ctxt, Var_Parse_State *vpstate MAKE_ATTR_UNUSED,
*----------------------------------------------------------------------- *-----------------------------------------------------------------------
*/ */
static char * static char *
VarQuote(char *str) VarQuote(char *str, Boolean quoteDollar)
{ {
Buffer buf; Buffer buf;
@ -2346,6 +2347,8 @@ VarQuote(char *str)
if (isspace((unsigned char)*str) || ismeta((unsigned char)*str)) if (isspace((unsigned char)*str) || ismeta((unsigned char)*str))
Buf_AddByte(&buf, '\\'); Buf_AddByte(&buf, '\\');
Buf_AddByte(&buf, *str); Buf_AddByte(&buf, *str);
if (quoteDollar && *str == '$')
Buf_AddBytes(&buf, 2, "\\$");
} }
str = Buf_Destroy(&buf, FALSE); str = Buf_Destroy(&buf, FALSE);
@ -3485,9 +3488,10 @@ ApplyModifiers(char *nstr, const char *tstr,
break; break;
} }
#endif #endif
case 'q':
case 'Q': case 'Q':
if (tstr[1] == endc || tstr[1] == ':') { if (tstr[1] == endc || tstr[1] == ':') {
newStr = VarQuote(nstr); newStr = VarQuote(nstr, modifier == 'q');
cp = tstr + 1; cp = tstr + 1;
termc = *cp; termc = *cp;
break; break;

View File

@ -7,7 +7,7 @@ SRCTOP?= ${.CURDIR:H:H}
# things set by configure # things set by configure
_MAKE_VERSION=20180512 _MAKE_VERSION?=20180919
prefix?= /usr prefix?= /usr
srcdir= ${SRCTOP}/contrib/bmake srcdir= ${SRCTOP}/contrib/bmake
@ -17,8 +17,8 @@ DEFAULT_SYS_PATH?= .../share/mk:/usr/share/mk
CPPFLAGS+= CPPFLAGS+=
CFLAGS+= ${CPPFLAGS} -DHAVE_CONFIG_H CFLAGS+= ${CPPFLAGS} -DHAVE_CONFIG_H
LDFLAGS+= LDFLAGS+=
LIBOBJS= ${LIBOBJDIR}stresep$U.o LIBOBJS+= ${LIBOBJDIR}stresep$U.o
LDADD= LDADD+=
USE_META= yes USE_META= yes
FILEMON_H?= /usr/include/dev/filemon/filemon.h FILEMON_H?= /usr/include/dev/filemon/filemon.h
BMAKE_PATH_MAX?= 1024 BMAKE_PATH_MAX?= 1024

View File

@ -5,9 +5,9 @@
SRCTOP?= ${.CURDIR:H:H:H} SRCTOP?= ${.CURDIR:H:H:H}
# $Id: Makefile.in,v 1.48 2015/12/07 04:06:29 sjg Exp $ # $Id: Makefile.in,v 1.49 2018/09/21 21:39:05 sjg Exp $
# #
# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $ # $NetBSD: Makefile,v 1.53 2018/05/24 00:25:44 christos Exp $
# #
# Unit tests for make(1) # Unit tests for make(1)
# The main targets are: # The main targets are:
@ -61,6 +61,7 @@ TESTNAMES= \
unexport-env \ unexport-env \
varcmd \ varcmd \
varmisc \ varmisc \
varquote \
varshell varshell
# these tests were broken by referting POSIX chanegs # these tests were broken by referting POSIX chanegs