Import bmake-20140101

This commit is contained in:
Simon J. Gerraty 2014-01-26 07:40:17 +00:00
parent 55ec07f91d
commit d4343fd891
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/bmake/dist/; revision=261182
svn path=/vendor/NetBSD/bmake/20140101/; revision=261183; tag=vendor/NetBSD/bmake/20140101
22 changed files with 312 additions and 128 deletions

View File

@ -1,3 +1,37 @@
2014-01-03 Simon J. Gerraty <sjg@bad.crufty.net>
* boot-strap: ignore mksrc=none
2014-01-02 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (DEFAULT_SYS_PATH?): use just ${prefix}/share/mk
2014-01-01 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20140101
* configure.in: set bmake_path_max to min(_SC_PATH_MAX,1024)
* Makefile.config: defined BMAKE_PATH_MAX to bmake_path_max
* make.h: use BMAKE_PATH_MAX if MAXPATHLEN not defined (needed for
Hurd)
* configure.in: Add AC_PREREQ and check for
sysctl; patch from Andrew Shadura andrewsh at debian.org
2013-10-16 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20131010
* lose the const from arg to systcl to avoid problems on older BSDs.
2013-10-01 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20131001
Merge with NetBSD make, pick up
o main.c: for NATIVE build sysctl to get MACHINE_ARCH from
hw.machine_arch if necessary.
o meta.c: meta_oodate - need to look at src of Link and target
of Move as well.
* main.c: check that CTL_HW and HW_MACHINE_ARCH exist.
provide __arraycount() if needed.
2013-09-04 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130904

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.20 2013/09/04 15:42:03 sjg Exp $
# $Id: Makefile,v 1.23 2014/01/02 22:20:52 sjg Exp $
# Base version on src date
MAKE_VERSION= 20130904
MAKE_VERSION= 20140101
PROG= bmake
@ -68,7 +68,7 @@ SRCS+= ${LIBOBJS:T:.o=.c}
prefix?= /usr
srcdir?= ${.CURDIR}
DEFAULT_SYS_PATH?= .../share/mk:${prefix}/share/mk
DEFAULT_SYS_PATH?= ${prefix}/share/mk
CPPFLAGS+= -DUSE_META
CFLAGS+= ${CPPFLAGS}

View File

@ -14,3 +14,7 @@ LIBOBJS= @LIBOBJS@
LDADD= @LIBS@
USE_META= @use_meta@
FILEMON_H= @filemon_h@
BMAKE_PATH_MAX?= @bmake_path_max@
# used if MAXPATHLEN not defined
CPPFLAGS+= -DBMAKE_PATH_MAX=${BMAKE_PATH_MAX}

17
bmake.1
View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.222 2013/08/11 09:53:49 apb Exp $
.\" $NetBSD: make.1,v 1.226 2013/11/07 18:50:46 dholland 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 August 11, 2013
.Dd October 25, 2013
.Dt MAKE 1
.Os
.Sh NAME
@ -745,7 +745,7 @@ then output for each target is prefixed with a token
.Ql --- target ---
the first part of which can be controlled via
.Va .MAKE.JOB.PREFIX .
If
If
.Va .MAKE.JOB.PREFIX
is empty, no token is printed.
.br
@ -1066,6 +1066,13 @@ may
be used.
The wildcard characters may be escaped with a backslash
.Pq Ql \e .
As a consequence of the way values are split into words, matched,
and then joined, a construct like
.Dl ${VAR:M*}
will normalise the inter-word spacing, removing all leading and
trailing space, and converting multiple consecutive spaces
to single spaces.
.
.It Cm \&:N Ns Ar pattern
This is identical to
.Ql Cm \&:M ,
@ -1209,7 +1216,7 @@ The
modifier is just like the
.Cm \&:S
modifier except that the old and new strings, instead of being
simple strings, are a regular expression (see
simple strings, are an extended regular expression (see
.Xr regex 3 )
string
.Ar pattern
@ -1751,7 +1758,7 @@ or
.Fl t
options were specified.
Normally used to mark recursive
.Nm Ns 's .
.Nm Ns s .
.It Ic .META
Create a meta file for the target, even if it is flagged as
.Ic .PHONY ,

View File

@ -690,7 +690,13 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
::MM_p_a_t_t_e_r_n
Select only those words that match _p_a_t_t_e_r_n. The standard shell
wildcard characters (`*', `?', and `[]') may be used. The wildcard
characters may be escaped with a backslash (`\').
characters may be escaped with a backslash (`\'). As a consequence
of the way values are split into words, matched, and then joined, a
construct like
${VAR:M*}
will normalise the inter-word spacing, removing all leading and
trailing space, and converting multiple consecutive spaces to single
spaces.
::NN_p_a_t_t_e_r_n
This is identical to `::MM', but selects all words which do not match
@ -777,18 +783,18 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
::CC/_p_a_t_t_e_r_n/_r_e_p_l_a_c_e_m_e_n_t/[11ggWW]
The ::CC modifier is just like the ::SS modifier except that the old and
new strings, instead of being simple strings, are a regular expres-
sion (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style string
_r_e_p_l_a_c_e_m_e_n_t. Normally, the first occurrence of the pattern _p_a_t_t_e_r_n
in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t. The `1'
modifier causes the substitution to apply to at most one word; the
`g' modifier causes the substitution to apply to as many instances
of the search pattern _p_a_t_t_e_r_n as occur in the word or words it is
found in; the `W' modifier causes the value to be treated as a sin-
gle word (possibly containing embedded white space). Note that `1'
and `g' are orthogonal; the former specifies whether multiple words
are potentially affected, the latter whether multiple substitutions
can potentially occur within each affected word.
new strings, instead of being simple strings, are an extended regu-
lar expression (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style
string _r_e_p_l_a_c_e_m_e_n_t. Normally, the first occurrence of the pattern
_p_a_t_t_e_r_n in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t.
The `1' modifier causes the substitution to apply to at most one
word; the `g' modifier causes the substitution to apply to as many
instances of the search pattern _p_a_t_t_e_r_n as occur in the word or
words it is found in; the `W' modifier causes the value to be
treated as a single word (possibly containing embedded white space).
Note that `1' and `g' are orthogonal; the former specifies whether
multiple words are potentially affected, the latter whether multiple
substitutions can potentially occur within each affected word.
::TT Replaces each word in the variable with its last component.
@ -1107,7 +1113,7 @@ SSPPEECCIIAALL SSOOUURRCCEESS ((AATTTTRRIIBBUUTTEESS))
..MMAAKKEE Execute the commands associated with this target even if the --nn
or --tt options were specified. Normally used to mark recursive
bbmmaakkee's.
bbmmaakkees.
..MMEETTAA Create a meta file for the target, even if it is flagged as
..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL. Usage in conjunction with ..MMAAKKEE is
@ -1378,4 +1384,4 @@ BBUUGGSS
There is no way of escaping a space character in a filename.
NetBSD 5.1 August 11, 2013 NetBSD 5.1
NetBSD 5.1 October 25, 2013 NetBSD 5.1

View File

@ -111,7 +111,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: boot-strap,v 1.43 2013/03/02 18:55:23 sjg Exp $
# $Id: boot-strap,v 1.44 2014/01/08 14:49:10 sjg Exp $
#
# @(#) Copyright (c) 2001 Simon J. Gerraty
#
@ -216,11 +216,9 @@ do
--share=*) share_dir=`get_optarg "$1"`;;
--share) share_dir="$2"; shift;;
--with-default-sys-path=*)
CONFIGURE_ARGS="$1"
MAKESYSPATH=`get_optarg "$1"`;;
CONFIGURE_ARGS="$1";;
--with-default-sys-path)
CONFIGURE_ARGS="$1 $2"
MAKESYSPATH="$2"; shift;;
CONFIGURE_ARGS="$1 $2";;
--install) INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix};;
--install-host-target)
INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix}
@ -330,8 +328,8 @@ add_path () {
srcdir=`GetDir /bmake make-bootstrap.sh.in "$srcdir" "$2" "$Mydir" ./bmake* "$Mydir"/../bmake*`
[ -d "${srcdir:-/dev/null}" ] || Usage
case "$mksrc" in
none|-) # we don't want it
mksrc=
none|-) # we ignore this now
mksrc=$Mydir/mk
;;
.../*) # find here or above
mksrc=`FindHereOrAbove -C "$Mydir" -s "$mksrc/sys.mk"`

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.93 2013/09/02 19:26:42 sjg Exp $ */
/* $NetBSD: compat.c,v 1.94 2014/01/03 00:02:01 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.93 2013/09/02 19:26:42 sjg Exp $";
static char rcsid[] = "$NetBSD: compat.c,v 1.94 2014/01/03 00:02:01 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.93 2013/09/02 19:26:42 sjg Exp $");
__RCSID("$NetBSD: compat.c,v 1.94 2014/01/03 00:02:01 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -133,7 +133,7 @@ Compat_Init(void)
Shell_Init(); /* setup default shell */
for (cp = "#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) {
for (cp = "~#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) {
meta[(unsigned char) *cp] = 1;
}
/*

31
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for bmake 20130706.
# Generated by GNU Autoconf 2.64 for bmake 20140101.
#
# Report bugs to <sjg@NetBSD.org>.
#
@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bmake'
PACKAGE_TARNAME='bmake'
PACKAGE_VERSION='20130706'
PACKAGE_STRING='bmake 20130706'
PACKAGE_VERSION='20140101'
PACKAGE_STRING='bmake 20140101'
PACKAGE_BUGREPORT='sjg@NetBSD.org'
PACKAGE_URL=''
@ -602,6 +602,7 @@ machine_arch
force_machine
machine
LIBOBJS
bmake_path_max
ac_exe_suffix
INSTALL_DATA
INSTALL_SCRIPT
@ -1220,7 +1221,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bmake 20130706 to adapt to many kinds of systems.
\`configure' configures bmake 20140101 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1281,7 +1282,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bmake 20130706:";;
short | recursive ) echo "Configuration of bmake 20140101:";;
esac
cat <<\_ACEOF
@ -1386,7 +1387,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bmake configure 20130706
bmake configure 20140101
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
@ -1907,7 +1908,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bmake $as_me 20130706, which was
It was created by bmake $as_me 20140101, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
@ -4244,7 +4245,15 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
if test -x /usr/bin/getconf; then
bmake_path_max=`getconf PATH_MAX / 2> /dev/null`
fi
bmake_path_max=${bmake_path_max:-1024}
if test $bmake_path_max -gt 1024; then
# this is all we expect
bmake_path_max=1024
fi
echo "Using: BMAKE_PATH_MAX=$bmake_path_max" >&6
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
@ -4569,6 +4578,7 @@ for ac_header in \
sys/mman.h \
sys/select.h \
sys/socket.h \
sys/sysctl.h \
sys/time.h \
sys/uio.h \
unistd.h \
@ -5435,6 +5445,7 @@ for ac_func in \
strsep \
strtod \
strtol \
sysctl \
unsetenv \
vsnprintf \
wait3 \
@ -6367,7 +6378,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bmake $as_me 20130706, which was
This file was extended by bmake $as_me 20140101, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6427,7 +6438,7 @@ Report bugs to <sjg@NetBSD.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
bmake config.status 20130706
bmake config.status 20140101
configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -1,10 +1,11 @@
dnl
dnl RCSid:
dnl $Id: configure.in,v 1.49 2013/07/06 18:25:19 sjg Exp $
dnl $Id: configure.in,v 1.51 2014/01/02 22:20:52 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_INIT([bmake], [20130706], [sjg@NetBSD.org])
AC_PREREQ(2.50)
AC_INIT([bmake], [20140101], [sjg@NetBSD.org])
AC_CONFIG_HEADER(config.h)
dnl make srcdir absolute
@ -77,7 +78,18 @@ AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
dnl Executable suffix - normally empty; .exe on os2.
AC_SUBST(ac_exe_suffix)dnl
dnl
dnl Hurd refuses to define PATH_MAX or MAXPATHLEN
if test -x /usr/bin/getconf; then
bmake_path_max=`getconf PATH_MAX / 2> /dev/null`
fi
bmake_path_max=${bmake_path_max:-1024}
if test $bmake_path_max -gt 1024; then
# this is all we expect
bmake_path_max=1024
fi
echo "Using: BMAKE_PATH_MAX=$bmake_path_max" >&6
AC_SUBST(bmake_path_max)dnl
dnl
dnl AC_C_CROSS
dnl
@ -98,6 +110,7 @@ AC_CHECK_HEADERS( \
sys/mman.h \
sys/select.h \
sys/socket.h \
sys/sysctl.h \
sys/time.h \
sys/uio.h \
unistd.h \
@ -159,6 +172,7 @@ AC_CHECK_FUNCS( \
strsep \
strtod \
strtol \
sysctl \
unsetenv \
vsnprintf \
wait3 \

9
hash.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $ */
/* $NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 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: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $";
static char rcsid[] = "$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: hash.c,v 1.19 2009/01/24 10:59:09 dsl Exp $");
__RCSID("$NetBSD: hash.c,v 1.20 2013/11/14 00:27:05 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -221,6 +221,9 @@ Hash_FindEntry(Hash_Table *t, const char *key)
unsigned h;
const char *p;
if (t == NULL || t->bucketPtr == NULL) {
return NULL;
}
for (h = 0, p = key; *p;)
h = (h << 5) - h + *p++;
p = key;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $ */
/* $NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $";
static char rcsid[] = "$NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lstMember.c,v 1.13 2009/01/23 21:26:30 dsl Exp $");
__RCSID("$NetBSD: lstMember.c,v 1.14 2013/11/14 00:01:28 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -58,6 +58,9 @@ Lst_Member(Lst l, void *d)
List list = l;
ListNode lNode;
if (list == NULL) {
return NULL;
}
lNode = list->firstPtr;
if (lNode == NULL) {
return NULL;

28
main.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.224 2013/09/04 15:38:26 sjg Exp $ */
/* $NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.224 2013/09/04 15:38:26 sjg Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt 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.224 2013/09/04 15:38:26 sjg Exp $");
__RCSID("$NetBSD: main.c,v 1.225 2013/09/14 15:09:34 matt Exp $");
#endif
#endif /* not lint */
#endif
@ -118,6 +118,9 @@ __RCSID("$NetBSD: main.c,v 1.224 2013/09/04 15:38:26 sjg Exp $");
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/stat.h>
#if defined(MAKE_NATIVE) && defined(HAVE_SYSCTL)
#include <sys/sysctl.h>
#endif
#include <sys/utsname.h>
#include "wait.h"
@ -145,6 +148,10 @@ __RCSID("$NetBSD: main.c,v 1.224 2013/09/04 15:38:26 sjg Exp $");
#define DEFMAXLOCAL DEFMAXJOBS
#endif /* DEFMAXLOCAL */
#ifndef __arraycount
# define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
#endif
Lst create; /* Targets to be made */
time_t now; /* Time at start of make */
GNode *DEFAULT; /* .DEFAULT node */
@ -910,6 +917,20 @@ main(int argc, char **argv)
}
if (!machine_arch) {
#if defined(MAKE_NATIVE) && defined(HAVE_SYSCTL) && defined(CTL_HW) && defined(HW_MACHINE_ARCH)
static char machine_arch_buf[sizeof(utsname.machine)];
int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
size_t len = sizeof(machine_arch_buf);
if (sysctl(mib, __arraycount(mib), machine_arch_buf,
&len, NULL, 0) < 0) {
(void)fprintf(stderr, "%s: sysctl failed (%s).\n", progname,
strerror(errno));
exit(2);
}
machine_arch = machine_arch_buf;
#else
#ifndef MACHINE_ARCH
#ifdef MAKE_MACHINE_ARCH
machine_arch = MAKE_MACHINE_ARCH;
@ -918,6 +939,7 @@ main(int argc, char **argv)
#endif
#else
machine_arch = MACHINE_ARCH;
#endif
#endif
}

View File

@ -11,7 +11,7 @@ yes) XDEFS="-DUSE_META ${XDEFS}";;
esac
CC="@CC@"
CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS}"
CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@"
MAKE_VERSION=`sed -n '/^MAKE_VERSION=/s,.*=[^0-9]*,,p' $srcdir/Makefile`

17
make.1
View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.222 2013/08/11 09:53:49 apb Exp $
.\" $NetBSD: make.1,v 1.226 2013/11/07 18:50:46 dholland 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 August 11, 2013
.Dd October 25, 2013
.Dt MAKE 1
.Os
.Sh NAME
@ -745,7 +745,7 @@ then output for each target is prefixed with a token
.Ql --- target ---
the first part of which can be controlled via
.Va .MAKE.JOB.PREFIX .
If
If
.Va .MAKE.JOB.PREFIX
is empty, no token is printed.
.br
@ -1066,6 +1066,13 @@ may
be used.
The wildcard characters may be escaped with a backslash
.Pq Ql \e .
As a consequence of the way values are split into words, matched,
and then joined, a construct like
.Dl ${VAR:M*}
will normalise the inter-word spacing, removing all leading and
trailing space, and converting multiple consecutive spaces
to single spaces.
.
.It Cm \&:N Ns Ar pattern
This is identical to
.Ql Cm \&:M ,
@ -1209,7 +1216,7 @@ The
modifier is just like the
.Cm \&:S
modifier except that the old and new strings, instead of being
simple strings, are a regular expression (see
simple strings, are an extended regular expression (see
.Xr regex 3 )
string
.Ar pattern
@ -1751,7 +1758,7 @@ or
.Fl t
options were specified.
Normally used to mark recursive
.Nm Ns 's .
.Nm Ns s .
.It Ic .META
Create a meta file for the target, even if it is flagged as
.Ic .PHONY ,

4
make.h
View File

@ -518,4 +518,8 @@ int str2Lst_Append(Lst, char *, const char *);
#define MAX(a, b) ((a > b) ? a : b)
#endif
#ifndef MAXPATHLEN
#define MAXPATHLEN BMAKE_PATH_MAX
#endif
#endif /* _MAKE_H_ */

79
meta.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.32 2013/06/25 00:20:54 sjg Exp $ */
/* $NetBSD: meta.c,v 1.33 2013/10/01 05:37:17 sjg Exp $ */
/*
* Implement 'meta' mode.
@ -860,6 +860,13 @@ string_match(const void *p, const void *q)
continue; \
}
#define DEQUOTE(p) if (*p == '\'') { \
char *ep; \
p++; \
if ((ep = strchr(p, '\''))) \
*ep = '\0'; \
}
Boolean
meta_oodate(GNode *gn, Boolean oodate)
{
@ -872,6 +879,8 @@ meta_oodate(GNode *gn, Boolean oodate)
char fname2[MAXPATHLEN];
char *p;
char *cp;
char *link_src;
char *move_target;
static size_t cwdlen = 0;
static size_t tmplen = 0;
FILE *fp;
@ -938,6 +947,8 @@ meta_oodate(GNode *gn, Boolean oodate)
oodate = TRUE;
break;
}
link_src = NULL;
move_target = NULL;
/* Find the start of the build monitor section. */
if (!f) {
if (strncmp(buf, "-- filemon", 10) == 0) {
@ -1051,16 +1062,21 @@ meta_oodate(GNode *gn, Boolean oodate)
break;
case 'M': /* renaMe */
if (Lst_IsEmpty(missingFiles))
break;
/*
* For 'M'oves we want to check
* the src as for 'R'ead
* and the target as for 'W'rite.
*/
cp = p; /* save this for a second */
/* now get target */
if (strsep(&p, " ") == NULL)
continue;
CHECK_VALID_META(p);
move_target = p;
p = cp;
/* 'L' and 'M' put single quotes around the args */
if (*p == '\'') {
char *ep;
p++;
if ((ep = strchr(p, '\'')))
*ep = '\0';
}
DEQUOTE(p);
DEQUOTE(move_target);
/* FALLTHROUGH */
case 'D': /* unlink */
if (*p == '/' && !Lst_IsEmpty(missingFiles)) {
@ -1072,22 +1088,39 @@ meta_oodate(GNode *gn, Boolean oodate)
ln = NULL; /* we're done with it */
}
}
if (buf[0] == 'M') {
/* the target of the mv is a file 'W'ritten */
#ifdef DEBUG_META_MODE
if (DEBUG(META))
fprintf(debug_file, "meta_oodate: M %s -> %s\n",
p, move_target);
#endif
p = move_target;
goto check_write;
}
break;
case 'L': /* Link */
/* we want the target */
/*
* For 'L'inks check
* the src as for 'R'ead
* and the target as for 'W'rite.
*/
link_src = p;
/* now get target */
if (strsep(&p, " ") == NULL)
continue;
CHECK_VALID_META(p);
/* 'L' and 'M' put single quotes around the args */
if (*p == '\'') {
char *ep;
p++;
if ((ep = strchr(p, '\'')))
*ep = '\0';
}
DEQUOTE(p);
DEQUOTE(link_src);
#ifdef DEBUG_META_MODE
if (DEBUG(META))
fprintf(debug_file, "meta_oodate: L %s -> %s\n",
link_src, p);
#endif
/* FALLTHROUGH */
case 'W': /* Write */
check_write:
/*
* If a file we generated within our bailiwick
* but outside of .OBJDIR is missing,
@ -1119,6 +1152,14 @@ meta_oodate(GNode *gn, Boolean oodate)
Lst_AtEnd(missingFiles, bmake_strdup(p));
}
break;
check_link_src:
p = link_src;
link_src = NULL;
#ifdef DEBUG_META_MODE
if (DEBUG(META))
fprintf(debug_file, "meta_oodate: L src %s\n", p);
#endif
/* FALLTHROUGH */
case 'R': /* Read */
case 'E': /* Exec */
/*
@ -1213,6 +1254,8 @@ meta_oodate(GNode *gn, Boolean oodate)
default:
break;
}
if (!oodate && buf[0] == 'L' && link_src != NULL)
goto check_link_src;
} else if (strcmp(buf, "CMD") == 0) {
/*
* Compare the current command with the one in the

View File

@ -1,3 +1,22 @@
2013-12-12 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): bump version
* meta2deps.py: convert to print function for python3 compat.
we also need to open files with mode 'r' rather than 'rb'
otherwise we get bytes instead of strings.
2013-10-10 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): bump version
* dirdeps.mk: when TARGET_SPEC_VARS is more than just MACHINE
apply the same filtering (M_dep_qual_fixes) when setting _machines
as _build_dirs.
Also fix the filtering of Makefile.depend files - for reporting
what we are looking for (M_dep_qual_fixes can get confused by
Makefile.depend)
Add some more debug info.
2013-09-04 Simon J. Gerraty <sjg@bad.crufty.net>
* gendirdeps.mk (_objtops): fix typo also

View File

@ -1,4 +1,4 @@
# $Id: dirdeps.mk,v 1.28 2013/03/25 21:11:43 sjg Exp $
# $Id: dirdeps.mk,v 1.29 2013/10/13 18:43:53 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -149,11 +149,11 @@ DEP_$v ?= ${$v}
JOT ?= jot
_tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh}
# this handles unqualified entries
M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.${DEP_TARGET_SPEC};
M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC};
# there needs to be at least one item missing for these to make sense
.for i in ${_tspec_x:[2..-1]}
_tspec_m$i := ${TARGET_SPEC_VARS:[2..$i]:@w@[^,]+@:ts,}
_tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$${DEP_$v}@:ts,}
_tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$$$${DEP_$v}@:ts,}
M_dep_qual_fixes += C;(\.${_tspec_m$i})$$;\1${_tspec_a$i};
.endfor
.else
@ -359,7 +359,8 @@ _machines := ${_machines:O:u}
.if ${TARGET_SPEC_VARS:[#]} > 1
# we need to tweak _machines
_dm := ${DEP_MACHINE}
_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@}
# apply the same filtering that we do when qualifying DIRDEPS.
_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@:${M_dep_qual_fixes:ts:}:O:u}
DEP_MACHINE := ${_dm}
.endif
@ -464,6 +465,9 @@ ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
.if ${_DIRDEP_CHECKED:M$d} == ""
# once only
_DIRDEP_CHECKED += $d
.if !empty(_debug_search)
.info checking $d
.endif
# Note: _build_dirs is fully qualifed so d:R is always the directory
.if exists(${d:R})
# Warning: there is an assumption here that MACHINE is always
@ -471,7 +475,8 @@ _DIRDEP_CHECKED += $d
# If TARGET_SPEC and MACHINE are insufficient, you have a problem.
_m := ${.MAKE.DEPENDFILE_PREFERENCE:T:S;${TARGET_SPEC}$;${d:E};:S;${MACHINE};${d:E:C/,.*//};:@m@${exists(${d:R}/$m):?${d:R}/$m:}@:[1]}
.if !empty(_m)
_qm := ${_m:${M_dep_qual_fixes:ts:}}
# M_dep_qual_fixes isn't geared to Makefile.depend
_qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}}
.if !empty(_debug_search)
.info Looking for ${_qm}
.endif

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.93 2013/08/02 18:28:47 sjg Exp $
# $Id: install-mk,v 1.95 2013/12/20 06:08:52 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20130801
MK_VERSION=20131212
OWNER=
GROUP=
MODE=444

View File

@ -1,5 +1,7 @@
#!/usr/bin/env python
from __future__ import print_function
"""
This script parses each "meta" file and extracts the
information needed to deduce build and src dependencies.
@ -35,7 +37,7 @@
"""
RCSid:
$Id: meta2deps.py,v 1.15 2013/07/29 20:41:23 sjg Exp $
$Id: meta2deps.py,v 1.16 2013/12/20 06:08:52 sjg Exp $
Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved.
@ -90,14 +92,14 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
continue
p = '/'.join([d,path])
if debug > 2:
print >> debug_out, "looking for:", p,
print("looking for:", p, end=' ', file=debug_out)
if not os.path.exists(p):
if debug > 2:
print >> debug_out, "nope"
print("nope", file=debug_out)
p = None
continue
if debug > 2:
print >> debug_out, "found:", p
print("found:", p, file=debug_out)
return p
return None
@ -236,21 +238,21 @@ def __init__(self, name, conf={}):
self.objroots.sort(reverse=True)
if self.debug:
print >> self.debug_out, "host_target=", self.host_target
print >> self.debug_out, "srctops=", self.srctops
print >> self.debug_out, "objroots=", self.objroots
print("host_target=", self.host_target, file=self.debug_out)
print("srctops=", self.srctops, file=self.debug_out)
print("objroots=", self.objroots, file=self.debug_out)
self.dirdep_re = re.compile(r'([^/]+)/(.+)')
if self.dpdeps and not self.reldir:
if self.debug:
print >> self.debug_out, "need reldir:",
print("need reldir:", end=' ', file=self.debug_out)
if self.curdir:
srctop = self.find_top(self.curdir, self.srctops)
if srctop:
self.reldir = self.curdir.replace(srctop,'')
if self.debug:
print >> self.debug_out, self.reldir
print(self.reldir, file=self.debug_out)
if not self.reldir:
self.dpdeps = None # we cannot do it?
@ -280,7 +282,7 @@ def file_depends(self, out=None):
if not self.reldir:
return None
for f in sort_unique(self.file_deps):
print >> out, 'DPDEPS_%s += %s' % (f, self.reldir)
print('DPDEPS_%s += %s' % (f, self.reldir), file=out)
def seenit(self, dir):
"""rememer that we have seen dir."""
@ -291,14 +293,14 @@ def add(self, list, data, clue=''):
if data not in list:
list.append(data)
if self.debug:
print >> self.debug_out, "%s: %sAdd: %s" % (self.name, clue, data)
print("%s: %sAdd: %s" % (self.name, clue, data), file=self.debug_out)
def find_top(self, path, list):
"""the logical tree may be split accross multiple trees"""
for top in list:
if path.startswith(top):
if self.debug > 2:
print >> self.debug_out, "found in", top
print("found in", top, file=self.debug_out)
return top
return None
@ -307,9 +309,9 @@ def find_obj(self, objroot, dir, path, input):
ddep = None
for ddepf in [path + '.dirdep', dir + '/.dirdep']:
if not ddep and os.path.exists(ddepf):
ddep = open(ddepf, 'rb').readline().strip('# \n')
ddep = open(ddepf, 'r').readline().strip('# \n')
if self.debug > 1:
print >> self.debug_out, "found %s: %s\n" % (ddepf, ddep)
print("found %s: %s\n" % (ddepf, ddep), file=self.debug_out)
if ddep.endswith(self.machine):
ddep = ddep[0:-(1+len(self.machine))]
elif self.target_spec and ddep.endswith(self.target_spec):
@ -331,7 +333,7 @@ def find_obj(self, objroot, dir, path, input):
if not (self.machine == 'host' and
dmachine == self.host_target):
if self.debug > 2:
print >> self.debug_out, "adding .%s to %s" % (dmachine, ddep)
print("adding .%s to %s" % (dmachine, ddep), file=self.debug_out)
ddep += '.' + dmachine
return ddep
@ -342,7 +344,7 @@ def try_parse(self, name=None, file=None):
self.parse(name, file)
except:
# give a useful clue
print >> sys.stderr, '{}:{}: '.format(self.name, self.line),
print('{}:{}: '.format(self.name, self.line), end=' ', file=sys.stderr)
raise
def parse(self, name=None, file=None):
@ -379,7 +381,7 @@ def parse(self, name=None, file=None):
f = file
cwd = last_dir = self.cwd
else:
f = open(self.name, 'rb')
f = open(self.name, 'r')
skip = True
pid_cwd = {}
pid_last_dir = {}
@ -396,7 +398,7 @@ def parse(self, name=None, file=None):
if not line[0] in interesting:
continue
if self.debug > 2:
print >> self.debug_out, "input:", line,
print("input:", line, end=' ', file=self.debug_out)
w = line.split()
if skip:
@ -413,7 +415,7 @@ def parse(self, name=None, file=None):
self.cwd = cwd = last_dir = w[1]
self.seenit(cwd) # ignore this
if self.debug:
print >> self.debug_out, "%s: CWD=%s" % (self.name, cwd)
print("%s: CWD=%s" % (self.name, cwd), file=self.debug_out)
continue
pid = int(w[1])
@ -438,12 +440,12 @@ def parse(self, name=None, file=None):
cwd = cwd[0:-2]
last_dir = cwd
if self.debug > 1:
print >> self.debug_out, "cwd=", cwd
print("cwd=", cwd, file=self.debug_out)
continue
if w[2] in self.seen:
if self.debug > 2:
print >> self.debug_out, "seen:", w[2]
print("seen:", w[2], file=self.debug_out)
continue
# file operations
if w[0] in 'ML':
@ -461,7 +463,7 @@ def parse(self, name=None, file=None):
dir,base = os.path.split(path)
if dir in self.seen:
if self.debug > 2:
print >> self.debug_out, "seen:", dir
print("seen:", dir, file=self.debug_out)
continue
# we can have a path in an objdir which is a link
# to the src dir, we may need to add dependencies for each
@ -472,19 +474,19 @@ def parse(self, name=None, file=None):
# now put path back together
path = '/'.join([dir,base])
if self.debug > 1:
print >> self.debug_out, "raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path)
print("raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path), file=self.debug_out)
if w[0] in 'SRWL':
if w[0] == 'W' and path.endswith('.dirdep'):
continue
if path in [last_dir, cwd, self.cwd, self.curdir]:
if self.debug > 1:
print >> self.debug_out, "skipping:", path
print("skipping:", path, file=self.debug_out)
continue
if os.path.isdir(path):
if w[0] in 'RW':
last_dir = path;
if self.debug > 1:
print >> self.debug_out, "ldir=", last_dir
print("ldir=", last_dir, file=self.debug_out)
continue
if w[0] in 'REWML':
@ -642,10 +644,10 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
debug_out = getv(conf, 'debug_out', sys.stderr)
if debug:
print >> debug_out, "config:"
print >> debug_out, "psyco=", have_psyco
for k,v in conf.items():
print >> debug_out, "%s=%s" % (k,v)
print("config:", file=debug_out)
print("psyco=", have_psyco, file=debug_out)
for k,v in list(conf.items()):
print("%s=%s" % (k,v), file=debug_out)
for a in args:
if a.endswith('.meta'):
@ -657,9 +659,9 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
m = klass(f, conf)
if output:
print m.dirdeps()
print(m.dirdeps())
print m.src_dirdeps('\nsrc:')
print(m.src_dirdeps('\nsrc:'))
dpdeps = getv(conf, 'DPDEPS')
if dpdeps:
@ -672,6 +674,6 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
main(sys.argv)
except:
# yes, this goes to stdout
print "ERROR: ", sys.exc_info()[1]
print("ERROR: ", sys.exc_info()[1])
raise

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $ */
/* $NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.191 2013/08/28 21:56:49 sjg Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos 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.191 2013/08/28 21:56:49 sjg Exp $");
__RCSID("$NetBSD: parse.c,v 1.192 2013/10/18 20:47:06 christos Exp $");
#endif
#endif /* not lint */
#endif
@ -1216,9 +1216,8 @@ ParseDoDependency(char *line)
*/
int length;
void *freeIt;
char *result;
result = Var_Parse(cp, VAR_CMD, TRUE, &length, &freeIt);
(void)Var_Parse(cp, VAR_CMD, TRUE, &length, &freeIt);
if (freeIt)
free(freeIt);
cp += length-1;

11
util.c
View File

@ -1,18 +1,21 @@
/* $NetBSD: util.c,v 1.53 2012/06/04 22:45:05 sjg Exp $ */
/* $NetBSD: util.c,v 1.54 2013/11/26 13:44:41 joerg Exp $ */
/*
* Missing stuff from OS's
*
* $Id: util.c,v 1.32 2012/06/06 20:08:44 sjg Exp $
* $Id: util.c,v 1.33 2014/01/02 02:29:49 sjg Exp $
*/
#if defined(__MINT__) || defined(__linux__)
#include <signal.h>
#endif
#include "make.h"
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: util.c,v 1.53 2012/06/04 22:45:05 sjg Exp $";
static char rcsid[] = "$NetBSD: util.c,v 1.54 2013/11/26 13:44:41 joerg Exp $";
#else
#ifndef lint
__RCSID("$NetBSD: util.c,v 1.53 2012/06/04 22:45:05 sjg Exp $");
__RCSID("$NetBSD: util.c,v 1.54 2013/11/26 13:44:41 joerg Exp $");
#endif
#endif