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> 2013-09-04 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130904 * 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 # Base version on src date
MAKE_VERSION= 20130904 MAKE_VERSION= 20140101
PROG= bmake PROG= bmake
@ -68,7 +68,7 @@ SRCS+= ${LIBOBJS:T:.o=.c}
prefix?= /usr prefix?= /usr
srcdir?= ${.CURDIR} srcdir?= ${.CURDIR}
DEFAULT_SYS_PATH?= .../share/mk:${prefix}/share/mk DEFAULT_SYS_PATH?= ${prefix}/share/mk
CPPFLAGS+= -DUSE_META CPPFLAGS+= -DUSE_META
CFLAGS+= ${CPPFLAGS} CFLAGS+= ${CPPFLAGS}

View file

@ -14,3 +14,7 @@ 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@
# 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 .\" 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 August 11, 2013 .Dd October 25, 2013
.Dt MAKE 1 .Dt MAKE 1
.Os .Os
.Sh NAME .Sh NAME
@ -745,7 +745,7 @@ then output for each target is prefixed with a token
.Ql --- target --- .Ql --- target ---
the first part of which can be controlled via the first part of which can be controlled via
.Va .MAKE.JOB.PREFIX . .Va .MAKE.JOB.PREFIX .
If If
.Va .MAKE.JOB.PREFIX .Va .MAKE.JOB.PREFIX
is empty, no token is printed. is empty, no token is printed.
.br .br
@ -1066,6 +1066,13 @@ may
be used. be used.
The wildcard characters may be escaped with a backslash The wildcard characters may be escaped with a backslash
.Pq Ql \e . .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 .It Cm \&:N Ns Ar pattern
This is identical to This is identical to
.Ql Cm \&:M , .Ql Cm \&:M ,
@ -1209,7 +1216,7 @@ The
modifier is just like the modifier is just like the
.Cm \&:S .Cm \&:S
modifier except that the old and new strings, instead of being 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 ) .Xr regex 3 )
string string
.Ar pattern .Ar pattern
@ -1751,7 +1758,7 @@ or
.Fl t .Fl t
options were specified. options were specified.
Normally used to mark recursive Normally used to mark recursive
.Nm Ns 's . .Nm Ns s .
.It Ic .META .It Ic .META
Create a meta file for the target, even if it is flagged as Create a meta file for the target, even if it is flagged as
.Ic .PHONY , .Ic .PHONY ,

View file

@ -690,7 +690,13 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
::MM_p_a_t_t_e_r_n ::MM_p_a_t_t_e_r_n
Select only those words that match _p_a_t_t_e_r_n. The standard shell Select only those words that match _p_a_t_t_e_r_n. The standard shell
wildcard characters (`*', `?', and `[]') may be used. The wildcard 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 ::NN_p_a_t_t_e_r_n
This is identical to `::MM', but selects all words which do not match 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] ::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 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- new strings, instead of being simple strings, are an extended regu-
sion (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style string lar expression (see regex(3)) string _p_a_t_t_e_r_n and an ed(1)-style
_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 string _r_e_p_l_a_c_e_m_e_n_t. Normally, the first occurrence of the pattern
in each word of the value is substituted with _r_e_p_l_a_c_e_m_e_n_t. The `1' _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.
modifier causes the substitution to apply to at most one word; the The `1' modifier causes the substitution to apply to at most one
`g' modifier causes the substitution to apply to as many instances word; the `g' modifier causes the substitution to apply to as many
of the search pattern _p_a_t_t_e_r_n as occur in the word or words it is instances of the search pattern _p_a_t_t_e_r_n as occur in the word or
found in; the `W' modifier causes the value to be treated as a sin- words it is found in; the `W' modifier causes the value to be
gle word (possibly containing embedded white space). Note that `1' treated as a single word (possibly containing embedded white space).
and `g' are orthogonal; the former specifies whether multiple words Note that `1' and `g' are orthogonal; the former specifies whether
are potentially affected, the latter whether multiple substitutions multiple words are potentially affected, the latter whether multiple
can potentially occur within each affected word. substitutions can potentially occur within each affected word.
::TT Replaces each word in the variable with its last component. ::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 ..MMAAKKEE Execute the commands associated with this target even if the --nn
or --tt options were specified. Normally used to mark recursive 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 ..MMEETTAA Create a meta file for the target, even if it is flagged as
..PPHHOONNYY, ..MMAAKKEE, or ..SSPPEECCIIAALL. Usage in conjunction with ..MMAAKKEE is ..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. 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> # Simon J. Gerraty <sjg@crufty.net>
# RCSid: # 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 # @(#) Copyright (c) 2001 Simon J. Gerraty
# #
@ -216,11 +216,9 @@ do
--share=*) share_dir=`get_optarg "$1"`;; --share=*) share_dir=`get_optarg "$1"`;;
--share) share_dir="$2"; shift;; --share) share_dir="$2"; shift;;
--with-default-sys-path=*) --with-default-sys-path=*)
CONFIGURE_ARGS="$1" CONFIGURE_ARGS="$1";;
MAKESYSPATH=`get_optarg "$1"`;;
--with-default-sys-path) --with-default-sys-path)
CONFIGURE_ARGS="$1 $2" CONFIGURE_ARGS="$1 $2";;
MAKESYSPATH="$2"; shift;;
--install) INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix};; --install) INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix};;
--install-host-target) --install-host-target)
INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix} INSTALL_PREFIX=${INSTALL_PREFIX:-$prefix}
@ -330,8 +328,8 @@ add_path () {
srcdir=`GetDir /bmake make-bootstrap.sh.in "$srcdir" "$2" "$Mydir" ./bmake* "$Mydir"/../bmake*` srcdir=`GetDir /bmake make-bootstrap.sh.in "$srcdir" "$2" "$Mydir" ./bmake* "$Mydir"/../bmake*`
[ -d "${srcdir:-/dev/null}" ] || Usage [ -d "${srcdir:-/dev/null}" ] || Usage
case "$mksrc" in case "$mksrc" in
none|-) # we don't want it none|-) # we ignore this now
mksrc= mksrc=$Mydir/mk
;; ;;
.../*) # find here or above .../*) # find here or above
mksrc=`FindHereOrAbove -C "$Mydir" -s "$mksrc/sys.mk"` 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. * 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: 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 #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else #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
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -133,7 +133,7 @@ Compat_Init(void)
Shell_Init(); /* setup default shell */ Shell_Init(); /* setup default shell */
for (cp = "#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) { for (cp = "~#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) {
meta[(unsigned char) *cp] = 1; meta[(unsigned char) *cp] = 1;
} }
/* /*

31
configure vendored
View file

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

View file

@ -1,10 +1,11 @@
dnl dnl
dnl RCSid: 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
dnl Process this file with autoconf to produce a configure script dnl Process this file with autoconf to produce a configure script
dnl dnl
AC_INIT([bmake], [20130706], [sjg@NetBSD.org]) AC_PREREQ(2.50)
AC_INIT([bmake], [20140101], [sjg@NetBSD.org])
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
dnl make srcdir absolute dnl make srcdir absolute
@ -77,7 +78,18 @@ AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL AC_PROG_INSTALL
dnl Executable suffix - normally empty; .exe on os2. dnl Executable suffix - normally empty; .exe on os2.
AC_SUBST(ac_exe_suffix)dnl 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
dnl AC_C_CROSS dnl AC_C_CROSS
dnl dnl
@ -98,6 +110,7 @@ AC_CHECK_HEADERS( \
sys/mman.h \ sys/mman.h \
sys/select.h \ sys/select.h \
sys/socket.h \ sys/socket.h \
sys/sysctl.h \
sys/time.h \ sys/time.h \
sys/uio.h \ sys/uio.h \
unistd.h \ unistd.h \
@ -159,6 +172,7 @@ AC_CHECK_FUNCS( \
strsep \ strsep \
strtod \ strtod \
strtol \ strtol \
sysctl \
unsetenv \ unsetenv \
vsnprintf \ vsnprintf \
wait3 \ 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. * 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: 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 #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)hash.c 8.1 (Berkeley) 6/6/93";
#else #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
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -221,6 +221,9 @@ Hash_FindEntry(Hash_Table *t, const char *key)
unsigned h; unsigned h;
const char *p; const char *p;
if (t == NULL || t->bucketPtr == NULL) {
return NULL;
}
for (h = 0, p = key; *p;) for (h = 0, p = key; *p;)
h = (h << 5) - h + *p++; h = (h << 5) - h + *p++;
p = key; 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 * Copyright (c) 1988, 1989, 1990, 1993
@ -33,14 +33,14 @@
*/ */
#ifndef MAKE_NATIVE #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 #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93";
#else #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
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -58,6 +58,9 @@ Lst_Member(Lst l, void *d)
List list = l; List list = l;
ListNode lNode; ListNode lNode;
if (list == NULL) {
return NULL;
}
lNode = list->firstPtr; lNode = list->firstPtr;
if (lNode == NULL) { if (lNode == NULL) {
return 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 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/ */
#ifndef MAKE_NATIVE #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 #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else #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
#endif /* not lint */ #endif /* not lint */
#endif #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/param.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined(MAKE_NATIVE) && defined(HAVE_SYSCTL)
#include <sys/sysctl.h>
#endif
#include <sys/utsname.h> #include <sys/utsname.h>
#include "wait.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 #define DEFMAXLOCAL DEFMAXJOBS
#endif /* DEFMAXLOCAL */ #endif /* DEFMAXLOCAL */
#ifndef __arraycount
# define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
#endif
Lst create; /* Targets to be made */ Lst create; /* Targets to be made */
time_t now; /* Time at start of make */ time_t now; /* Time at start of make */
GNode *DEFAULT; /* .DEFAULT node */ GNode *DEFAULT; /* .DEFAULT node */
@ -910,6 +917,20 @@ main(int argc, char **argv)
} }
if (!machine_arch) { 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 #ifndef MACHINE_ARCH
#ifdef MAKE_MACHINE_ARCH #ifdef MAKE_MACHINE_ARCH
machine_arch = MAKE_MACHINE_ARCH; machine_arch = MAKE_MACHINE_ARCH;
@ -918,6 +939,7 @@ main(int argc, char **argv)
#endif #endif
#else #else
machine_arch = MACHINE_ARCH; machine_arch = MACHINE_ARCH;
#endif
#endif #endif
} }

View file

@ -11,7 +11,7 @@ yes) XDEFS="-DUSE_META ${XDEFS}";;
esac esac
CC="@CC@" 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` 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 .\" 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 August 11, 2013 .Dd October 25, 2013
.Dt MAKE 1 .Dt MAKE 1
.Os .Os
.Sh NAME .Sh NAME
@ -745,7 +745,7 @@ then output for each target is prefixed with a token
.Ql --- target --- .Ql --- target ---
the first part of which can be controlled via the first part of which can be controlled via
.Va .MAKE.JOB.PREFIX . .Va .MAKE.JOB.PREFIX .
If If
.Va .MAKE.JOB.PREFIX .Va .MAKE.JOB.PREFIX
is empty, no token is printed. is empty, no token is printed.
.br .br
@ -1066,6 +1066,13 @@ may
be used. be used.
The wildcard characters may be escaped with a backslash The wildcard characters may be escaped with a backslash
.Pq Ql \e . .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 .It Cm \&:N Ns Ar pattern
This is identical to This is identical to
.Ql Cm \&:M , .Ql Cm \&:M ,
@ -1209,7 +1216,7 @@ The
modifier is just like the modifier is just like the
.Cm \&:S .Cm \&:S
modifier except that the old and new strings, instead of being 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 ) .Xr regex 3 )
string string
.Ar pattern .Ar pattern
@ -1751,7 +1758,7 @@ or
.Fl t .Fl t
options were specified. options were specified.
Normally used to mark recursive Normally used to mark recursive
.Nm Ns 's . .Nm Ns s .
.It Ic .META .It Ic .META
Create a meta file for the target, even if it is flagged as Create a meta file for the target, even if it is flagged as
.Ic .PHONY , .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) #define MAX(a, b) ((a > b) ? a : b)
#endif #endif
#ifndef MAXPATHLEN
#define MAXPATHLEN BMAKE_PATH_MAX
#endif
#endif /* _MAKE_H_ */ #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. * Implement 'meta' mode.
@ -860,6 +860,13 @@ string_match(const void *p, const void *q)
continue; \ continue; \
} }
#define DEQUOTE(p) if (*p == '\'') { \
char *ep; \
p++; \
if ((ep = strchr(p, '\''))) \
*ep = '\0'; \
}
Boolean Boolean
meta_oodate(GNode *gn, Boolean oodate) meta_oodate(GNode *gn, Boolean oodate)
{ {
@ -872,6 +879,8 @@ meta_oodate(GNode *gn, Boolean oodate)
char fname2[MAXPATHLEN]; char fname2[MAXPATHLEN];
char *p; char *p;
char *cp; char *cp;
char *link_src;
char *move_target;
static size_t cwdlen = 0; static size_t cwdlen = 0;
static size_t tmplen = 0; static size_t tmplen = 0;
FILE *fp; FILE *fp;
@ -938,6 +947,8 @@ meta_oodate(GNode *gn, Boolean oodate)
oodate = TRUE; oodate = TRUE;
break; break;
} }
link_src = NULL;
move_target = NULL;
/* Find the start of the build monitor section. */ /* Find the start of the build monitor section. */
if (!f) { if (!f) {
if (strncmp(buf, "-- filemon", 10) == 0) { if (strncmp(buf, "-- filemon", 10) == 0) {
@ -1051,16 +1062,21 @@ meta_oodate(GNode *gn, Boolean oodate)
break; break;
case 'M': /* renaMe */ 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 */ /* 'L' and 'M' put single quotes around the args */
if (*p == '\'') { DEQUOTE(p);
char *ep; DEQUOTE(move_target);
p++;
if ((ep = strchr(p, '\'')))
*ep = '\0';
}
/* FALLTHROUGH */ /* FALLTHROUGH */
case 'D': /* unlink */ case 'D': /* unlink */
if (*p == '/' && !Lst_IsEmpty(missingFiles)) { if (*p == '/' && !Lst_IsEmpty(missingFiles)) {
@ -1072,22 +1088,39 @@ meta_oodate(GNode *gn, Boolean oodate)
ln = NULL; /* we're done with it */ 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; break;
case 'L': /* Link */ 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) if (strsep(&p, " ") == NULL)
continue; continue;
CHECK_VALID_META(p); CHECK_VALID_META(p);
/* 'L' and 'M' put single quotes around the args */ /* 'L' and 'M' put single quotes around the args */
if (*p == '\'') { DEQUOTE(p);
char *ep; DEQUOTE(link_src);
#ifdef DEBUG_META_MODE
p++; if (DEBUG(META))
if ((ep = strchr(p, '\''))) fprintf(debug_file, "meta_oodate: L %s -> %s\n",
*ep = '\0'; link_src, p);
} #endif
/* FALLTHROUGH */ /* FALLTHROUGH */
case 'W': /* Write */ case 'W': /* Write */
check_write:
/* /*
* If a file we generated within our bailiwick * If a file we generated within our bailiwick
* but outside of .OBJDIR is missing, * but outside of .OBJDIR is missing,
@ -1119,6 +1152,14 @@ meta_oodate(GNode *gn, Boolean oodate)
Lst_AtEnd(missingFiles, bmake_strdup(p)); Lst_AtEnd(missingFiles, bmake_strdup(p));
} }
break; 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 'R': /* Read */
case 'E': /* Exec */ case 'E': /* Exec */
/* /*
@ -1213,6 +1254,8 @@ meta_oodate(GNode *gn, Boolean oodate)
default: default:
break; break;
} }
if (!oodate && buf[0] == 'L' && link_src != NULL)
goto check_link_src;
} else if (strcmp(buf, "CMD") == 0) { } else if (strcmp(buf, "CMD") == 0) {
/* /*
* Compare the current command with the one in the * 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> 2013-09-04 Simon J. Gerraty <sjg@bad.crufty.net>
* gendirdeps.mk (_objtops): fix typo also * 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. # Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved. # All rights reserved.
@ -149,11 +149,11 @@ DEP_$v ?= ${$v}
JOT ?= jot JOT ?= jot
_tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh} _tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh}
# this handles unqualified entries # 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 # there needs to be at least one item missing for these to make sense
.for i in ${_tspec_x:[2..-1]} .for i in ${_tspec_x:[2..-1]}
_tspec_m$i := ${TARGET_SPEC_VARS:[2..$i]:@w@[^,]+@:ts,} _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}; M_dep_qual_fixes += C;(\.${_tspec_m$i})$$;\1${_tspec_a$i};
.endfor .endfor
.else .else
@ -359,7 +359,8 @@ _machines := ${_machines:O:u}
.if ${TARGET_SPEC_VARS:[#]} > 1 .if ${TARGET_SPEC_VARS:[#]} > 1
# we need to tweak _machines # we need to tweak _machines
_dm := ${DEP_MACHINE} _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} DEP_MACHINE := ${_dm}
.endif .endif
@ -464,6 +465,9 @@ ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m}
.if ${_DIRDEP_CHECKED:M$d} == "" .if ${_DIRDEP_CHECKED:M$d} == ""
# once only # once only
_DIRDEP_CHECKED += $d _DIRDEP_CHECKED += $d
.if !empty(_debug_search)
.info checking $d
.endif
# Note: _build_dirs is fully qualifed so d:R is always the directory # Note: _build_dirs is fully qualifed so d:R is always the directory
.if exists(${d:R}) .if exists(${d:R})
# Warning: there is an assumption here that MACHINE is always # 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. # 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]} _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) .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) .if !empty(_debug_search)
.info Looking for ${_qm} .info Looking for ${_qm}
.endif .endif

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.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 # @(#) Copyright (c) 1994 Simon J. Gerraty
# #
@ -70,7 +70,7 @@
# sjg@crufty.net # sjg@crufty.net
# #
MK_VERSION=20130801 MK_VERSION=20131212
OWNER= OWNER=
GROUP= GROUP=
MODE=444 MODE=444

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import print_function
""" """
This script parses each "meta" file and extracts the This script parses each "meta" file and extracts the
information needed to deduce build and src dependencies. information needed to deduce build and src dependencies.
@ -35,7 +37,7 @@
""" """
RCSid: 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. Copyright (c) 2011-2013, Juniper Networks, Inc.
All rights reserved. All rights reserved.
@ -90,14 +92,14 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
continue continue
p = '/'.join([d,path]) p = '/'.join([d,path])
if debug > 2: if debug > 2:
print >> debug_out, "looking for:", p, print("looking for:", p, end=' ', file=debug_out)
if not os.path.exists(p): if not os.path.exists(p):
if debug > 2: if debug > 2:
print >> debug_out, "nope" print("nope", file=debug_out)
p = None p = None
continue continue
if debug > 2: if debug > 2:
print >> debug_out, "found:", p print("found:", p, file=debug_out)
return p return p
return None return None
@ -236,21 +238,21 @@ def __init__(self, name, conf={}):
self.objroots.sort(reverse=True) self.objroots.sort(reverse=True)
if self.debug: if self.debug:
print >> self.debug_out, "host_target=", self.host_target print("host_target=", self.host_target, file=self.debug_out)
print >> self.debug_out, "srctops=", self.srctops print("srctops=", self.srctops, file=self.debug_out)
print >> self.debug_out, "objroots=", self.objroots print("objroots=", self.objroots, file=self.debug_out)
self.dirdep_re = re.compile(r'([^/]+)/(.+)') self.dirdep_re = re.compile(r'([^/]+)/(.+)')
if self.dpdeps and not self.reldir: if self.dpdeps and not self.reldir:
if self.debug: if self.debug:
print >> self.debug_out, "need reldir:", print("need reldir:", end=' ', file=self.debug_out)
if self.curdir: if self.curdir:
srctop = self.find_top(self.curdir, self.srctops) srctop = self.find_top(self.curdir, self.srctops)
if srctop: if srctop:
self.reldir = self.curdir.replace(srctop,'') self.reldir = self.curdir.replace(srctop,'')
if self.debug: if self.debug:
print >> self.debug_out, self.reldir print(self.reldir, file=self.debug_out)
if not self.reldir: if not self.reldir:
self.dpdeps = None # we cannot do it? self.dpdeps = None # we cannot do it?
@ -280,7 +282,7 @@ def file_depends(self, out=None):
if not self.reldir: if not self.reldir:
return None return None
for f in sort_unique(self.file_deps): 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): def seenit(self, dir):
"""rememer that we have seen dir.""" """rememer that we have seen dir."""
@ -291,14 +293,14 @@ def add(self, list, data, clue=''):
if data not in list: if data not in list:
list.append(data) list.append(data)
if self.debug: 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): def find_top(self, path, list):
"""the logical tree may be split accross multiple trees""" """the logical tree may be split accross multiple trees"""
for top in list: for top in list:
if path.startswith(top): if path.startswith(top):
if self.debug > 2: if self.debug > 2:
print >> self.debug_out, "found in", top print("found in", top, file=self.debug_out)
return top return top
return None return None
@ -307,9 +309,9 @@ def find_obj(self, objroot, dir, path, input):
ddep = None ddep = None
for ddepf in [path + '.dirdep', dir + '/.dirdep']: for ddepf in [path + '.dirdep', dir + '/.dirdep']:
if not ddep and os.path.exists(ddepf): 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: 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): if ddep.endswith(self.machine):
ddep = ddep[0:-(1+len(self.machine))] ddep = ddep[0:-(1+len(self.machine))]
elif self.target_spec and ddep.endswith(self.target_spec): 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 if not (self.machine == 'host' and
dmachine == self.host_target): dmachine == self.host_target):
if self.debug > 2: 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 ddep += '.' + dmachine
return ddep return ddep
@ -342,7 +344,7 @@ def try_parse(self, name=None, file=None):
self.parse(name, file) self.parse(name, file)
except: except:
# give a useful clue # give a useful clue
print >> sys.stderr, '{}:{}: '.format(self.name, self.line), print('{}:{}: '.format(self.name, self.line), end=' ', file=sys.stderr)
raise raise
def parse(self, name=None, file=None): def parse(self, name=None, file=None):
@ -379,7 +381,7 @@ def parse(self, name=None, file=None):
f = file f = file
cwd = last_dir = self.cwd cwd = last_dir = self.cwd
else: else:
f = open(self.name, 'rb') f = open(self.name, 'r')
skip = True skip = True
pid_cwd = {} pid_cwd = {}
pid_last_dir = {} pid_last_dir = {}
@ -396,7 +398,7 @@ def parse(self, name=None, file=None):
if not line[0] in interesting: if not line[0] in interesting:
continue continue
if self.debug > 2: if self.debug > 2:
print >> self.debug_out, "input:", line, print("input:", line, end=' ', file=self.debug_out)
w = line.split() w = line.split()
if skip: if skip:
@ -413,7 +415,7 @@ def parse(self, name=None, file=None):
self.cwd = cwd = last_dir = w[1] self.cwd = cwd = last_dir = w[1]
self.seenit(cwd) # ignore this self.seenit(cwd) # ignore this
if self.debug: 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 continue
pid = int(w[1]) pid = int(w[1])
@ -438,12 +440,12 @@ def parse(self, name=None, file=None):
cwd = cwd[0:-2] cwd = cwd[0:-2]
last_dir = cwd last_dir = cwd
if self.debug > 1: if self.debug > 1:
print >> self.debug_out, "cwd=", cwd print("cwd=", cwd, file=self.debug_out)
continue continue
if w[2] in self.seen: if w[2] in self.seen:
if self.debug > 2: if self.debug > 2:
print >> self.debug_out, "seen:", w[2] print("seen:", w[2], file=self.debug_out)
continue continue
# file operations # file operations
if w[0] in 'ML': if w[0] in 'ML':
@ -461,7 +463,7 @@ def parse(self, name=None, file=None):
dir,base = os.path.split(path) dir,base = os.path.split(path)
if dir in self.seen: if dir in self.seen:
if self.debug > 2: if self.debug > 2:
print >> self.debug_out, "seen:", dir print("seen:", dir, file=self.debug_out)
continue continue
# we can have a path in an objdir which is a link # we can have a path in an objdir which is a link
# to the src dir, we may need to add dependencies for each # 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 # now put path back together
path = '/'.join([dir,base]) path = '/'.join([dir,base])
if self.debug > 1: 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] in 'SRWL':
if w[0] == 'W' and path.endswith('.dirdep'): if w[0] == 'W' and path.endswith('.dirdep'):
continue continue
if path in [last_dir, cwd, self.cwd, self.curdir]: if path in [last_dir, cwd, self.cwd, self.curdir]:
if self.debug > 1: if self.debug > 1:
print >> self.debug_out, "skipping:", path print("skipping:", path, file=self.debug_out)
continue continue
if os.path.isdir(path): if os.path.isdir(path):
if w[0] in 'RW': if w[0] in 'RW':
last_dir = path; last_dir = path;
if self.debug > 1: if self.debug > 1:
print >> self.debug_out, "ldir=", last_dir print("ldir=", last_dir, file=self.debug_out)
continue continue
if w[0] in 'REWML': 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) debug_out = getv(conf, 'debug_out', sys.stderr)
if debug: if debug:
print >> debug_out, "config:" print("config:", file=debug_out)
print >> debug_out, "psyco=", have_psyco print("psyco=", have_psyco, file=debug_out)
for k,v in conf.items(): for k,v in list(conf.items()):
print >> debug_out, "%s=%s" % (k,v) print("%s=%s" % (k,v), file=debug_out)
for a in args: for a in args:
if a.endswith('.meta'): if a.endswith('.meta'):
@ -657,9 +659,9 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
m = klass(f, conf) m = klass(f, conf)
if output: if output:
print m.dirdeps() print(m.dirdeps())
print m.src_dirdeps('\nsrc:') print(m.src_dirdeps('\nsrc:'))
dpdeps = getv(conf, 'DPDEPS') dpdeps = getv(conf, 'DPDEPS')
if dpdeps: if dpdeps:
@ -672,6 +674,6 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None):
main(sys.argv) main(sys.argv)
except: except:
# yes, this goes to stdout # yes, this goes to stdout
print "ERROR: ", sys.exc_info()[1] print("ERROR: ", sys.exc_info()[1])
raise 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 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/ */
#ifndef MAKE_NATIVE #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 #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else #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
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -1216,9 +1216,8 @@ ParseDoDependency(char *line)
*/ */
int length; int length;
void *freeIt; void *freeIt;
char *result;
result = Var_Parse(cp, VAR_CMD, TRUE, &length, &freeIt); (void)Var_Parse(cp, VAR_CMD, TRUE, &length, &freeIt);
if (freeIt) if (freeIt)
free(freeIt); free(freeIt);
cp += length-1; 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 * 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" #include "make.h"
#ifndef MAKE_NATIVE #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 #else
#ifndef lint #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
#endif #endif