MFC bmake changes to stable/10 (r255285,r255916,r258113,r258114,r261212,r266760,r268437)

Discussed with: sjg

r255285:

  If MAKE_JOB_ERROR_TOKEN is set to false, do not put an error token ("E")
  into the job queue.
  This avoids closing down an entire build on failure of one branch.
  Probably has no use outside the context of universe/tinderbox.

  Reviewed by:	obrien

r255916:

  Fix Fx syntax.

  PR: 182269
  Approved by: re@

r258113:

  Avoid SEGV when passed NULL for list

r258114:

  Don't SEGV when Hash_Table is uninitialized

r261212:

  Merge bmake-20140101 from vendor

r266760:

  Portmgr no longer need the UL hack.

  Reviewed by: obrien

r268437:

  Update to bmake-20140620
  Main change is detection of malformed variable references.

  Reviewed by:	obrien
This commit is contained in:
ngie 2014-12-27 16:43:22 +00:00
parent 47ae056841
commit 8add61763b
44 changed files with 733 additions and 312 deletions

View File

@ -1,3 +1,62 @@
2014-06-20 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20140620
Merge with NetBSD make, pick up
o var.c return varNoError rather than var_Error for ::= modidiers.
2014-05-22 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20140522
Merge with NetBSD make, pick up
o var.c detect some parse errors.
2014-04-05 Simon J. Gerraty <sjg@bad.crufty.net>
* Fix spelling errors - patch from Pedro Giffuni
2014-02-14 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20140214
Merge with NetBSD make, pick up
o .INCLUDEFROM*
o use Var_Value to get MAKEOBJDIR[PREFIX]
o reduced realloc'ign in brk_string.
* configure.in: add a check for compiler supporting __func__
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
@ -30,7 +89,7 @@
* Makefile (MAKE_VERSION): 20130716
Merge with NetBSD make, pick up
o number of gmake compatability tweaks
o number of gmake compatibility tweaks
-w for gmake style entering/leaving messages
if .MAKE.LEVEL > 0 indicate it in progname "make[1]" etc.
handle MAKEFLAGS containing only letters.

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.20 2013/09/04 15:42:03 sjg Exp $
# $Id: Makefile,v 1.27 2014/06/20 14:51:54 sjg Exp $
# Base version on src date
MAKE_VERSION= 20130904
MAKE_VERSION= 20140620
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}
@ -117,7 +117,7 @@ MANTARGET?= man
# turn this on by default - ignored if we are root
WITH_INSTALL_AS_USER=
# supress with -DWITHOUT_*
# suppress with -DWITHOUT_*
OPTIONS_DEFAULT_YES+= \
AUTOCONF_MK \
INSTALL_MK \

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}

View File

@ -18,7 +18,7 @@ interesting changes, so that bmake tracks it very closely.
Building:
The prefered way to bootstrap bmake is:
The preferred way to bootstrap bmake is:
./bmake/boot-strap

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.229 2014/01/19 10:23:29 apb Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
.Dd August 11, 2013
.Dd February 14, 2014
.Dt MAKE 1
.Os
.Sh NAME
@ -706,6 +706,10 @@ was executed.
Refer to the description of
.Ql Ev PWD
for more details.
.It Va .INCLUDEDFROMDIR
The directory of the file this Makefile was included from.
.It Va .INCLUDEDFROMFILE
The filename of the file this Makefile was included from.
.It Ev MAKE
The name that
.Nm
@ -745,7 +749,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 +1070,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 +1220,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
@ -1239,6 +1250,15 @@ and
are orthogonal; the former specifies whether multiple words are
potentially affected, the latter whether multiple substitutions can
potentially occur within each affected word.
.Pp
As for the
.Cm \&:S
modifier, the
.Ar pattern
and
.Ar replacement
are subjected to variable expansion before being parsed as
regular expressions.
.It Cm \&:T
Replaces each word in the variable with its last component.
.It Cm \&:u
@ -1751,7 +1771,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

@ -450,6 +450,13 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
_._C_U_R_D_I_R A path to the directory where bbmmaakkee was executed. Refer
to the description of `PWD' for more details.
_._I_N_C_L_U_D_E_D_F_R_O_M_D_I_R
The directory of the file this Makefile was included
from.
_._I_N_C_L_U_D_E_D_F_R_O_M_F_I_L_E
The filename of the file this Makefile was included from.
MAKE The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]). For
compatibility bbmmaakkee also sets _._M_A_K_E with the same value.
The preferred variable to use is the environment variable
@ -690,7 +697,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 +790,21 @@ 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.
As for the ::SS modifier, the _p_a_t_t_e_r_n and _r_e_p_l_a_c_e_m_e_n_t are subjected to
variable expansion before being parsed as regular expressions.
::TT Replaces each word in the variable with its last component.
@ -1107,7 +1123,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 +1394,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 February 14, 2014 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.45 2014/04/05 22:56:54 sjg Exp $
#
# @(#) Copyright (c) 2001 Simon J. Gerraty
#
@ -197,7 +197,7 @@ get_optarg() {
here=`'pwd'`
if [ $here = $Mydir ]; then
# avoid polution
# avoid pollution
OBJROOT=../
fi
@ -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"`
@ -455,7 +453,7 @@ op_all() {
echo "Use --install-destdir=/somewhere to set DESTDIR during install"
echo "Use --install-host-target to use INSTALL_BIN=$HOST_TARGET/bin"
echo "Use -DWITH_PROG_VERSION to install as bmake-$MAKE_VERSION"
echo "Use -DWITHOUT_PROG_LINK to supress bmake -> bmake-$MAKE_VERSION symlink"
echo "Use -DWITHOUT_PROG_LINK to suppress bmake -> bmake-$MAKE_VERSION symlink"
echo "Use -DWITHOUT_INSTALL_MK to skip installing files to $prefix/share/mk"
fi
}

View File

@ -1,4 +1,4 @@
# $Id: bsd.after-import.mk,v 1.11 2012/12/29 19:32:25 sjg Exp $
# $Id: bsd.after-import.mk,v 1.12 2014/02/14 23:45:49 sjg Exp $
# This makefile is for use when integrating bmake into a BSD build
# system. Use this makefile after importing bmake.
@ -41,15 +41,13 @@ SRCTOP := ${srctop}
HOST_OS!= uname
.endif
# .../share/mk will find ${SRCTOP}/share/mk
# if we are within ${SRCTOP}
DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk
BOOTSTRAP_ARGS = \
--with-default-sys-path='${DEFAULT_SYS_PATH}' \
--prefix /usr \
--share /usr/share
.if !empty(DEFAULT_SYS_PATH)
BOOTSTRAP_ARGS += --with-default-sys-path='${DEFAULT_SYS_PATH}'
.endif
# run boot-strap with minimal influence
bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE}

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;
}
/*

View File

@ -144,6 +144,9 @@
`HAVE_STRUCT_STAT_ST_RDEV' instead. */
#undef HAVE_ST_RDEV
/* Define to 1 if you have the `sysctl' function. */
#undef HAVE_SYSCTL
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
@ -164,6 +167,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
@ -298,6 +304,9 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* C99 function name */
#undef __func__
/* Define to empty if `const' does not conform to ANSI C. */
#undef const

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 20140214.
#
# 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='20140214'
PACKAGE_STRING='bmake 20140214'
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 20140214 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 20140214:";;
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 20140214
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 20140214, 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 \
@ -5697,6 +5708,32 @@ $as_echo "#define HAVE_ST_RDEV 1" >>confdefs.h
fi
echo "checking if compiler supports __func__" >&6
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
const char *func = __func__;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
else
$as_echo "#define __func__ __FUNCTION__" >>confdefs.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
echo $ECHO_N "checking if diff -u works... $ECHO_C" >&6
if diff -u /dev/null /dev/null > /dev/null 2>&1; then
diff_u=-u
@ -6367,7 +6404,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 20140214, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6427,7 +6464,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 20140214
configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -1,11 +1,12 @@
dnl
dnl RCSid:
dnl $Id: configure.in,v 1.49 2013/07/06 18:25:19 sjg Exp $
dnl $Id: configure.in,v 1.52 2014/02/15 22:27:59 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_INIT([bmake], [20130706], [sjg@NetBSD.org])
AC_CONFIG_HEADER(config.h)
AC_PREREQ(2.50)
AC_INIT([bmake], [20140214], [sjg@NetBSD.org])
AC_CONFIG_HEADERS(config.h)
dnl make srcdir absolute
case "$srcdir" in
@ -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 \
@ -189,6 +203,11 @@ dnl
AC_HEADER_STAT
AC_STRUCT_ST_RDEV
dnl
echo "checking if compiler supports __func__" >&6
AC_LANG(C)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[const char *func = __func__;]])],,
AC_DEFINE(__func__, __FUNCTION__, C99 function name))
dnl
dnl we want this for unit-tests/Makefile
echo $ECHO_N "checking if diff -u works... $ECHO_C" >&6
if diff -u /dev/null /dev/null > /dev/null 2>&1; then

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;

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.226 2014/02/07 17:23:35 pooka 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.226 2014/02/07 17:23:35 pooka 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.226 2014/02/07 17:23:35 pooka 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
}
@ -1080,11 +1102,12 @@ main(int argc, char **argv)
*/
#ifndef NO_PWD_OVERRIDE
if (!ignorePWD) {
char *pwd;
char *pwd, *ptmp1 = NULL, *ptmp2 = NULL;
if ((pwd = getenv("PWD")) != NULL &&
getenv("MAKEOBJDIRPREFIX") == NULL) {
const char *makeobjdir = getenv("MAKEOBJDIR");
Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &ptmp1) == NULL) {
const char *makeobjdir = Var_Value("MAKEOBJDIR",
VAR_CMD, &ptmp2);
if (makeobjdir == NULL || !strchr(makeobjdir, '$')) {
if (stat(pwd, &sb) == 0 &&
@ -1093,6 +1116,8 @@ main(int argc, char **argv)
(void)strncpy(curdir, pwd, MAXPATHLEN);
}
}
free(ptmp1);
free(ptmp2);
}
#endif
Var_Set(".CURDIR", curdir, VAR_GLOBAL, 0);
@ -1109,11 +1134,13 @@ main(int argc, char **argv)
Dir_Init(curdir);
(void)Main_SetObjdir(curdir);
if ((path = getenv("MAKEOBJDIRPREFIX")) != NULL) {
if ((path = Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &p1)) != NULL) {
(void)snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir);
(void)Main_SetObjdir(mdpath);
} else if ((path = getenv("MAKEOBJDIR")) != NULL) {
free(p1);
} else if ((path = Var_Value("MAKEOBJDIR", VAR_CMD, &p1)) != NULL) {
(void)Main_SetObjdir(path);
free(p1);
} else {
(void)snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine);
if (!Main_SetObjdir(mdpath) && !Main_SetObjdir(_PATH_OBJDIR)) {

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`

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.230 2014/02/15 18:55:30 sjg 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 February 14, 2014
.Dt MAKE 1
.Os
.Sh NAME
@ -706,6 +706,10 @@ was executed.
Refer to the description of
.Ql Ev PWD
for more details.
.It Va .INCLUDEDFROMDIR
The directory of the file this Makefile was included from.
.It Va .INCLUDEDFROMFILE
The filename of the file this Makefile was included from.
.It Ev MAKE
The name that
.Nm
@ -756,7 +760,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
@ -1077,6 +1081,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 ,
@ -1220,7 +1231,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
@ -1250,6 +1261,15 @@ and
are orthogonal; the former specifies whether multiple words are
potentially affected, the latter whether multiple substitutions can
potentially occur within each affected word.
.Pp
As for the
.Cm \&:S
modifier, the
.Ar pattern
and
.Ar replacement
are subjected to variable expansion before being parsed as
regular expressions.
.It Cm \&:T
Replaces each word in the variable with its last component.
.It Cm \&:u
@ -1762,7 +1782,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

@ -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_ */

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,79 @@
2014-05-22 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20140522
* lib.mk: use CC to link shlib for linux too
patch from Brendan MacDonell
2014-05-05 Simon J. Gerraty <sjg@bad.crufty.net>
* meta.autodep.mk: add _reldir_{finish,failed} for gathering stats
if WITH_META_STATS is defined.
2014-05-02 Simon J. Gerraty <sjg@bad.crufty.net>
* dirdeps.mk: accept -DWITHOUT_DIRDEPS (same a as -DNO_DIRDEPS)
to supress dirdeps outside of .CURDIR.
2014-04-05 Simon J. Gerraty <sjg@bad.crufty.net>
* Fix spelling errors - patch from Pedro Giffuni
2014-03-14 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20140314
* dirdeps.mk (beforedirdeps): a handy hook
* dirdeps.mk (DIRDEP_MAKE): allow the actual command we run
to visit leaf dirs to be intercepted (eg. for distributed
build).
* dirdeps.mk (__depdirs): ensure // don't sneak in
* gendirdeps.mk (DIRDEPS): ensure // don't sneak in
2014-02-21 Simon J. Gerraty <sjg@bad.crufty.net>
* rst2htm.mk (RST2PDF): add support for rst2pdf
2014-02-14 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): bump version
* dirdeps.mk (_last_dependfile): use .INCLUDEDFROMFILE if
available.
2014-02-10 Simon J. Gerraty <sjg@bad.crufty.net>
* options.mk: avoid :U so this isn't bmake dependent
2014-02-09 Simon J. Gerraty <sjg@bad.crufty.net>
* options.mk: cleanup and simplify semanitcs
NO_* dominates all, if both WITH_* and WITHOUT_*
are defined then result is DOMINATE_* which defaults to "no".
Ie. WITHOUT_ normally wins.
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
@ -471,7 +547,7 @@
* dep.mk: auto.dep.mk does not do 'make depend' so ignore it if
asked to do that.
fix/simplify the tests for when to run mkdep.
* auto.dep.mk: add some explaination of how/what we do.
* auto.dep.mk: add some explanation of how/what we do.
* autodep.mk: skip the .OPTIONAL frobbing of .depend
bmake's FROM_DEPEND flag makes it redundant.
@ -621,7 +697,7 @@
2006-12-30 Simon J. Gerraty <sjg@void.crufty.net>
* install-mk (MK_VERSION): bump version
* added libs.mk - analagous to progs.mk
* added libs.mk - analogous to progs.mk
make both of them always inlcude {lib,prog}.mk
2006-12-28 Simon J. Gerraty <sjg@void.crufty.net>

View File

@ -1,6 +1,6 @@
#
# RCSid:
# $Id: autodep.mk,v 1.32 2010/04/19 17:37:56 sjg Exp $
# $Id: autodep.mk,v 1.33 2014/04/05 22:56:54 sjg Exp $
#
# @(#) Copyright (c) 1999-2010, Simon J. Gerraty
#
@ -16,7 +16,7 @@
# This module provides automagic dependency generation along the
# lines suggested in the GNU make.info
# The depend target is mainly for backwards compatability,
# The depend target is mainly for backwards compatibility,
# dependencies are normally updated as part of compilation.
# set MKDEP=autodep and dep.mk will include us

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.35 2014/05/03 06:27:56 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -44,7 +44,7 @@
# All unqualified entries end up being qualified with .${TARGET_SPEC}
# and partially qualified (if TARGET_SPEC_VARS has multiple
# entries) are also expanded to a full .<target_spec>.
# The _DIRDEPS_USE target uses the suffix to set TARGET_SPEC
# The _DIRDEP_USE target uses the suffix to set TARGET_SPEC
# correctly when visiting each entry.
#
# The fully qualified directory entries are used to construct a
@ -71,7 +71,7 @@
#
# TARGET_SPEC_VARS
# The default value is just MACHINE, and for most environments
# this is sufficient. The _DIRDEPS_USE target actually sets
# this is sufficient. The _DIRDEP_USE target actually sets
# both MACHINE and TARGET_SPEC to the suffix of the current
# target so that in the general case TARGET_SPEC can be ignored.
#
@ -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
@ -196,7 +196,11 @@ N_notmachine := ${.MAKE.DEPENDFILE_PREFERENCE:E:N*${MACHINE}*:${M_ListToSkip}}
# if we were included recursively _DEP_TARGET_SPEC should be valid.
.if empty(_DEP_TARGET_SPEC)
# we may or may not have included a dependfile yet
.if defined(.INCLUDEDFROMFILE)
_last_dependfile := ${.INCLUDEDFROMFILE:M${.MAKE.DEPENDFILE_PREFIX}*}
.else
_last_dependfile := ${.MAKE.MAKEFILES:M*/${.MAKE.DEPENDFILE_PREFIX}*:[-1]}
.endif
.if !empty(_debug_reldir)
.info ${DEP_RELDIR}.${DEP_TARGET_SPEC}: _last_dependfile='${_last_dependfile}'
.endif
@ -239,7 +243,8 @@ DEP_MACHINE := ${_DEP_TARGET_SPEC}
# we can use this as a clue to do initialization and other one time things.
.if !target(_DIRDEP_USE)
# make sure this target exists
dirdeps:
dirdeps: beforedirdeps .WAIT
beforedirdeps:
# We normally expect to be included by Makefile.depend.*
# which sets the DEP_* macros below.
@ -269,12 +274,15 @@ DEP_SKIP_DIR = ${SKIP_DIR} \
NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}}
.if defined(NO_DIRDEPS) || defined(NODIRDEPS)
.if defined(NO_DIRDEPS) || defined(NODIRDEPS) || defined(WITHOUT_DIRDEPS)
# confine ourselves to the original dir
DIRDEPS_FILTER += M${_DEP_RELDIR}*
.endif
# we supress SUBDIR when visiting the leaves
# this is what we run below
DIRDEP_MAKE?= ${.MAKE}
# we suppress SUBDIR when visiting the leaves
# we assume sys.mk will set MACHINE_ARCH
# you can add extras to DIRDEP_USE_ENV
# if there is no makefile in the target directory, we skip it.
@ -285,7 +293,7 @@ _DIRDEP_USE: .USE .MAKE
MACHINE_ARCH= NO_SUBDIR=1 ${DIRDEP_USE_ENV} \
TARGET_SPEC=${.TARGET:E} \
MACHINE=${.TARGET:E} \
${.MAKE} -C ${.TARGET:R} || exit 1; \
${DIRDEP_MAKE} -C ${.TARGET:R} || exit 1; \
break; \
done
@ -359,7 +367,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
@ -396,7 +405,7 @@ DEP_DIRDEPS_FILTER = U
.endif
# this is what we start with
__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:O:u:@d@${SRCTOP}/$d@}
__depdirs := ${DIRDEPS:${NSkipDir}:${DEP_DIRDEPS_FILTER:ts:}:C,//+,/,g:O:u:@d@${SRCTOP}/$d@}
# some entries may be qualified with .<machine>
# the :M*/*/*.* just tries to limit the dirs we check to likely ones.
@ -464,6 +473,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 +483,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

@ -1,4 +1,4 @@
# $Id: dpadd.mk,v 1.18 2011/11/10 05:13:37 sjg Exp $
# $Id: dpadd.mk,v 1.19 2014/04/05 22:56:54 sjg Exp $
#
# @(#) Copyright (c) 2004, Simon J. Gerraty
#
@ -68,7 +68,7 @@ DPLIBS+= ${LIBDMALLOC}
.endif
.endif
# Order -L's to seach ours first.
# Order -L's to search ours first.
# Avoids picking up old versions already installed.
__dpadd_libdirs := ${__dpadd_libs:R:H:S/^/-L/g:O:u:N-L}
LDADD += ${__dpadd_libdirs:M-L${OBJTOP}/*}
@ -99,9 +99,9 @@ SRC_LIBS+= ${_OBJDIR}/lib${LIB}.a
# This little bit of magic, assumes that SRC_libfoo will be
# set if it cannot be correctly derrived from ${LIBFOO}
# Note that SRC_libfoo and INCLUDES_libfoo should be named for the
# actual libary name not the variable name that might refer to it.
# actual library name not the variable name that might refer to it.
# 99% of the time the two are the same, but the DPADD logic
# only has the libary name available, so stick to that.
# only has the library name available, so stick to that.
#
SRC_LIBS?=

View File

@ -1,4 +1,4 @@
# $Id: gendirdeps.mk,v 1.23 2013/09/04 17:49:20 sjg Exp $
# $Id: gendirdeps.mk,v 1.25 2014/03/14 21:28:37 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -229,7 +229,7 @@ DIRDEPS = \
${qualdir_list:N${RELDIR}.*:N${RELDIR}/*}
# We only consider things below $RELDIR/ if they have a makefile.
# This is the same test that _DIRDEPS_USE applies.
# This is the same test that _DIRDEP_USE applies.
# We have do a double test with dirdep_list as it _may_ contain
# qualified dirs - if we got anything from a stage dir.
# qualdir_list we know are all qualified.
@ -240,7 +240,7 @@ DIRDEPS += \
${dirdep_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/$d/$m):?$d:${exists(${SRCTOP}/${d:R}/$m):?$d:}}@}@} \
${qualdir_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/${d:R}/$m):?$d:}@}@}
DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:O:u}
DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:C,//+,/,g:O:u}
.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
.info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS}
@ -261,7 +261,7 @@ src_dirdep_list = \
SRC_DIRDEPS = \
${src_dirdep_list:N${RELDIR}:N${RELDIR}/*:C,(/h)/.*,,}
SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:O:u}
SRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:C,//+,/,g:O:u}
# if you want to capture SRC_DIRDEPS in .MAKE.DEPENDFILE put
# SRC_DIRDEPS_FILE = ${_DEPENDFILE}

View File

@ -1,5 +1,5 @@
# RCSid:
# $Id: host-target.mk,v 1.6 2011/03/02 05:05:21 sjg Exp $
# $Id: host-target.mk,v 1.7 2014/05/16 17:54:52 sjg Exp $
# Host platform information; may be overridden
.if !defined(_HOST_OSNAME)
@ -18,6 +18,10 @@ _HOST_ARCH != uname -m
.endif
.export _HOST_ARCH
.endif
.if !defined(HOST_MACHINE)
HOST_MACHINE != uname -m
.export HOST_MACHINE
.endif
HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//}
HOST_OSTYPE := ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}

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.100 2014/05/23 01:30:36 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20130801
MK_VERSION=20140522
OWNER=
GROUP=
MODE=444

View File

@ -1,4 +1,4 @@
# $Id: lib.mk,v 1.49 2013/07/18 05:46:24 sjg Exp $
# $Id: lib.mk,v 1.51 2014/05/23 01:30:36 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -55,7 +55,7 @@ CFLAGS+= ${COPTS}
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# via -soname. Usually ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
@ -123,7 +123,7 @@ SHLIB_LDSTARTFILE?= /usr/lib/crtbeginS.o
SHLIB_LDENDFILE?= /usr/lib/crtendS.o
.endif
# for compatability with the following
# for compatibility with the following
CC_PIC?= ${CPICFLAGS}
LD_shared=${SHLIB_SHFLAGS}
@ -175,9 +175,10 @@ AR_cq= -cqs
.elif ${TARGET_OSNAME} == "FreeBSD"
LD_solib= lib${LIB}_pic.a
.elif ${TARGET_OSNAME} == "Linux"
SHLIB_LD = ${CC}
# this is ambiguous of course
LD_shared=-shared -h lib${LIB}.so.${SHLIB_MAJOR}
LD_solib= --whole-archive lib${LIB}_pic.a
LD_shared=-shared -Wl,"-h lib${LIB}.so.${SHLIB_MAJOR}"
LD_solib= -Wl,--whole-archive lib${LIB}_pic.a -Wl,--no-whole-archive
# Linux uses GNU ld, which is a multi-pass linker
# so we don't need to use lorder or tsort
LD_objs = ${OBJS}
@ -259,7 +260,7 @@ OPTIMIZE_OBJECT_META_FILES ?= yes
.if ${MK_LIBTOOL} == "yes"
# because libtool is so facist about naming the object files,
# because libtool is so fascist about naming the object files,
# we cannot (yet) build profiled libs
MK_PROFILE=no
_LIBS=lib${LIB}.a
@ -413,7 +414,7 @@ SHLIB_AGE?=0
.s.o .S.o .c.o:
${LIBTOOL} --mode=compile ${CC} ${LT_STATIC} ${CFLAGS} ${CPPFLAGS} ${IMPFLAGS} -c ${.IMPSRC}
# can't really do profiled libs with libtool - its too facist about
# can't really do profiled libs with libtool - its too fascist about
# naming the output...
lib${LIB}.a:: ${OBJS}
@rm -f ${.TARGET}

View File

@ -1,4 +1,4 @@
# $Id: meta.autodep.mk,v 1.32 2012/11/13 00:44:26 sjg Exp $
# $Id: meta.autodep.mk,v 1.35 2014/05/09 00:05:46 sjg Exp $
#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@ -120,7 +120,7 @@ FORCE_DPADD += ${_nonlibs:@x@${DPADD:M*/$x}@}
# some makefiles and/or targets contain
# circular dependencies if you dig too deep
# (as meta mode is apt to do)
# so we provide a means of supressing them.
# so we provide a means of suppressing them.
# the input to the loop below is target: dependency
# with just one dependency per line.
# Also some targets are not really local, or use random names.
@ -137,7 +137,7 @@ SUPPRESS_DEPEND += \
# the double $$ defers initial evaluation
# if necessary, we fake .po dependencies, just so the result
# in Makefile.depend* is stable
# The current objdir may be refered to in various ways
# The current objdir may be referred to in various ways
OBJDIR_REFS += ${.OBJDIR} ${.OBJDIR:tA} ${_OBJDIR} ${RELOBJTOP}/${RELDIR}
_depend = .depend
# it would be nice to be able to get .SUFFIXES as ${.SUFFIXES}
@ -176,7 +176,9 @@ _depend =
.info ${_DEPENDFILE:S,${SRCTOP}/,,} _depend=${_depend}
.endif
.if ${UPDATE_DEPENDFILE} == "yes"
gendirdeps: ${_DEPENDFILE}
.endif
.if !target(${_DEPENDFILE})
.if ${_bootstrap_dirdeps} == "yes"
@ -259,4 +261,28 @@ ${_DEPENDFILE}: .PRECIOUS
.endif
CLEANFILES += *.meta filemon.* *.db
# these make it easy to gather some stats
now_utc = ${%s:L:gmtime}
start_utc := ${now_utc}
meta_stats= meta=${empty(.MAKE.META.FILES):?0:${.MAKE.META.FILES:[#]}} \
created=${empty(.MAKE.META.CREATED):?0:${.MAKE.META.CREATED:[#]}}
#.END: _reldir_finish
.if target(gendirdeps)
_reldir_finish: gendirdeps
.endif
_reldir_finish: .NOMETA
@echo "${TIME_STAMP} Finished ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}"
#.ERROR: _reldir_failed
_reldir_failed: .NOMETA
@echo "${TIME_STAMP} Failed ${RELDIR}.${TARGET_SPEC} seconds=$$(( ${now_utc} - ${start_utc} )) ${meta_stats}"
.if defined(WITH_META_STATS) && ${.MAKE.LEVEL} > 0
.END: _reldir_finish
.ERROR: _reldir_failed
.endif
.endif

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 @@ We only pay attention to a subset of the information in the
"""
RCSid:
$Id: meta2deps.py,v 1.15 2013/07/29 20:41:23 sjg Exp $
$Id: meta2deps.py,v 1.17 2014/04/05 22:56:54 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
@ -164,7 +166,7 @@ class MetaFile:
Sometimes MACHINE isn't enough.
HOST_TARGET
when we build for the psuedo machine 'host'
when we build for the pseudo machine 'host'
the object tree uses HOST_TARGET rather than MACHINE.
OBJROOTS a list of the common prefix for all obj dirs it might
@ -236,21 +238,21 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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"""
"""the logical tree may be split across 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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
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 @@ class MetaFile:
# 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 @@ if __name__ == '__main__':
main(sys.argv)
except:
# yes, this goes to stdout
print "ERROR: ", sys.exc_info()[1]
print("ERROR: ", sys.exc_info()[1])
raise

View File

@ -77,7 +77,7 @@
# RCSid:
# $Id: meta2deps.sh,v 1.6 2013/05/11 05:16:26 sjg Exp $
# $Id: meta2deps.sh,v 1.7 2014/04/05 22:56:54 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -348,7 +348,7 @@ meta2deps() {
[ -s $f ] || continue
case $f in
*qual) # a list of .dirdep files
# we can prefix everthing with $OBJTOP to
# we can prefix everything with $OBJTOP to
# tell gendirdeps.mk that these are
# DIRDEP entries, since they are already
# qualified with .<machine> as needed.

View File

@ -1,4 +1,4 @@
# $Id: options.mk,v 1.7 2013/04/17 20:32:38 sjg Exp $
# $Id: options.mk,v 1.10 2014/02/11 18:34:48 sjg Exp $
#
# @(#) Copyright (c) 2012, Simon J. Gerraty
#
@ -30,15 +30,27 @@ OPTIONS_DEFAULT_VALUES += \
${OPTIONS_DEFAULT_YES:O:u:S,$,/yes,}
OPTION_PREFIX ?= MK_
# NO_* takes precedence
# If both WITH_* and WITHOUT_* are defined, WITHOUT_ wins unless
# DOMINANT_* is set to "yes"
# Otherwise WITH_* and WITHOUT_* override the default.
.for o in ${OPTIONS_DEFAULT_VALUES:M*/*}
.if ${o:T:tl} == "no"
.if defined(WITH_${o:H}) && !defined(NO_${o:H}) && !defined(NO${o:H})
.if defined(NO_${o:H}) || defined(NO${o:H})
# we cannot do it
${OPTION_PREFIX}${o:H} ?= no
.elif defined(WITH_${o:H}) && defined(WITHOUT_${o:H})
# normally WITHOUT_ wins
DOMINANT_${o:H} ?= no
${OPTION_PREFIX}${o:H} ?= ${DOMINANT_${o:H}}
.elif ${o:T:tl} == "no"
.if defined(WITH_${o:H})
${OPTION_PREFIX}${o:H} ?= yes
.else
${OPTION_PREFIX}${o:H} ?= no
.endif
.else
.if defined(WITHOUT_${o:H}) || defined(NO_${o:H}) || defined(NO${o:H})
.if defined(WITHOUT_${o:H})
${OPTION_PREFIX}${o:H} ?= no
.else
${OPTION_PREFIX}${o:H} ?= yes
@ -47,11 +59,19 @@ ${OPTION_PREFIX}${o:H} ?= yes
.endfor
# OPTIONS_DEFAULT_DEPENDENT += FOO_UTILS/FOO
# if neither WITH[OUT]_FOO_UTILS is set, use value of ${OPTION_PREFIX}FOO
# If neither WITH[OUT]_FOO_UTILS is set, (see rules above)
# use the value of ${OPTION_PREFIX}FOO
.for o in ${OPTIONS_DEFAULT_DEPENDENT:M*/*:O:u}
.if defined(WITH_${o:H}) && !defined(NO_${o:H}) && !defined(NO${o:H})
.if defined(NO_${o:H}) || defined(NO${o:H})
# we cannot do it
${OPTION_PREFIX}${o:H} ?= no
.elif defined(WITH_${o:H}) && defined(WITHOUT_${o:H})
# normally WITHOUT_ wins
DOMINANT_${o:H} ?= no
${OPTION_PREFIX}${o:H} ?= ${DOMINANT_${o:H}}
.elif defined(WITH_${o:H})
${OPTION_PREFIX}${o:H} ?= yes
.elif defined(WITHOUT_${o:H}) || defined(NO_${o:H}) || defined(NO${o:H})
.elif defined(WITHOUT_${o:H})
${OPTION_PREFIX}${o:H} ?= no
.else
${OPTION_PREFIX}${o:H} ?= ${${OPTION_PREFIX}${o:T}}

View File

@ -1,4 +1,4 @@
# $Id: rst2htm.mk,v 1.8 2011/04/03 21:39:25 sjg Exp $
# $Id: rst2htm.mk,v 1.9 2014/02/22 01:52:41 sjg Exp $
#
# @(#) Copyright (c) 2009, Simon J. Gerraty
#
@ -22,6 +22,7 @@ TXTSRCS != 'ls' -1t ${.CURDIR}/*.txt ${.CURDIR}/*.rst 2>/dev/null; echo
RSTSRCS ?= ${TXTSRCS}
HTMFILES ?= ${RSTSRCS:R:T:O:u:%=%.htm}
RST2HTML ?= rst2html.py
RST2PDF ?= rst2pdf
RST2S5 ?= rst2s5.py
# the following will run RST2S5 if the target name contains the word 'slides'
# otherwise it uses RST2HTML
@ -33,11 +34,15 @@ CLEANFILES += ${HTMFILES}
html: ${HTMFILES}
.SUFFIXES: ${RST_SUFFIXES} .htm
.SUFFIXES: ${RST_SUFFIXES} .htm .pdf
${RST_SUFFIXES:@s@$s.htm@}:
${RST2HTM} ${.IMPSRC} ${.TARGET}
${RST_SUFFIXES:@s@$s.pdf@}:
${RST2PDF} ${.IMPSRC} ${.TARGET}
.for s in ${RSTSRCS:O:u}
${s:R:T}.htm: $s
${s:R:T}.pdf: $s
.endfor

View File

@ -1,4 +1,4 @@
# $Id: sys.mk,v 1.35 2012/11/12 06:27:51 sjg Exp $
# $Id: sys.mk,v 1.36 2014/05/11 00:30:19 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
@ -77,7 +77,7 @@ M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
# type should be a builtin in any sh since about 1980,
# AUTOCONF := ${autoconf:L:${M_whence}}
M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g
M_whence = ${M_type}:M/*
M_whence = ${M_type}:M/*:[1]
# convert a path to a valid shell variable
M_P2V = tu:C,[./-],_,g

View File

@ -1,4 +1,4 @@
# $Id: SunOS.mk,v 1.5 2010/01/11 23:02:05 sjg Exp $
# $Id: SunOS.mk,v 1.6 2014/04/05 22:56:54 sjg Exp $
.if ${.PARSEFILE} == "sys.mk"
.include <host-target.mk>
@ -12,7 +12,7 @@ ROOT_GROUP= root
SHLIB_FULLVERSION = ${SHLIB_MAJOR}
# supress the dependency
# suppress the dependency
LIBCRT0= /dev/null
.ifndef CC

View File

@ -3,7 +3,7 @@
#
# DESCRIPTION:
# Include this macro file after all others in a makefile and
# follow it with any target specfic flag settings.
# follow it with any target specific flag settings.
# For each such variable v in TARGET_FLAG_VARS we set:
#.nf
#
@ -37,7 +37,7 @@
# RCSid:
# $Id: target-flags.mk,v 1.8 2002/05/08 06:01:00 sjg Exp $
# $Id: target-flags.mk,v 1.9 2014/04/05 22:56:54 sjg Exp $
#
# @(#) Copyright (c) 1998-2002, Simon J. Gerraty
#

View File

@ -1,5 +1,5 @@
# RCSid:
# $Id: warnings.mk,v 1.7 2009/12/11 17:06:03 sjg Exp $
# $Id: warnings.mk,v 1.8 2014/04/02 19:20:23 sjg Exp $
#
# @(#) Copyright (c) 2002, Simon J. Gerraty
#
@ -42,24 +42,30 @@ HIGH_WARNINGS?= ${MEDIUM_WARNINGS} \
-Wswitch \
-Wwrite-strings
EXTRA_WARNINGS?= ${HIGH_WARNINGS} -Wextra
# The two step default makes it easier to test build with different defaults.
DEFAULT_WARNINGS_SET?= MIN
WARNINGS_SET?= ${DEFAULT_WARNINGS_SET}
# If you add sets, besure to list them (you don't have to touch this list).
ALL_WARNINGS_SETS+= MIN LOW MEDIUM HIGH
ALL_WARNINGS_SETS+= MIN LOW MEDIUM HIGH EXTRA
.if empty(${WARNINGS_SET}_WARNINGS)
.if ${MAKE_VERSION:U0:[1]:C/.*-//} >= 20050530
.if !empty(WARNINGS_SET)
.for ws in ${WARNINGS_SET}
.if empty(${ws}_WARNINGS)
.if ${MAKE_VERSION:[1]:C/.*-//} >= 20050530
.BEGIN: _empty_warnings
_empty_warnings: .PHONY
.else
.BEGIN:
.endif
@echo "ERROR: Invalid: WARNINGS_SET=${WARNINGS_SET}"
@echo "ERROR: Invalid: WARNINGS_SET=${ws}"
@echo "ERROR: Try one of: ${ALL_WARNINGS_SETS:O:u}"; exit 1
.endif
.endfor
.endif
# Without -O or if we've set -O0 somewhere - to make debugging more effective,
# we need to turn off -Wuninitialized as otherwise we get a warning that
@ -69,40 +75,6 @@ _w_cflags:= ${CFLAGS} ${CPPFLAGS}
W_uninitialized=
.endif
.if ${MAKE_VERSION:U0:[1]:C/.*-//} <= 20040118
# This version uses .for loops to avoid a double free bug in old bmake's
# but the .for loops are sensitive to when this file is read.
# first, make a list of all the warning flags - doesn't matter if
# its redundant - we'll sort -u
_all_sets= ${WARNINGS_SET_${MACHINE_ARCH}} ${WARNINGS_SET} ${ALL_WARNINGS_SETS}
_all_warnings= ${WARNINGS} ${_all_sets:O:u:@s@${$s_WARNINGS}@}
# we want to set W_* for each warning so they are easy to turn off.
# :O:u does a sort -u
# using :C allows us to handle -f* -w* etc as well as -W*
.for w in ${_all_warnings:O:u}
${w:C/-(.)/\1_/} ?= $w
.endfor
# Allow for per-target warnings
# Warning: the WARNINGS+= line below,
# may make your brain hurt - trust me; it works --sjg
# the idea is that you can set WARNINGS_SET[_${MACHINE_ARCH}]=HIGH
# and use one of
# W_format_mips_foo.o=
# W_format_foo.o=
# to turn off -Wformat for foo.o (on mips only in the first case), or
# W_format_foo.o=-Wformat=2
# for stricter checking.
#
# NOTE: that we force the target extension to be .o
#
.for w in ${WARNINGS_SET_${MACHINE_ARCH}:U${WARNINGS_SET}:@s@${$s_WARNINGS}@:O:u}
WARNINGS+= ${${w:C/-(.)/\1_/}_${MACHINE_ARCH}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_/}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_/}_${MACHINE_ARCH}:U${${w:C/-(.)/\1_/}}}}}
.endfor
.else
# .for loops have the [dis]advantage of being evaluated when read,
# so adding to WARNINGS_SET[_${MACHINE_ARCH}] after this file is
@ -123,9 +95,19 @@ WARNINGS+= ${${w:C/-(.)/\1_/}_${MACHINE_ARCH}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_
#
# NOTE: that we force the target extension to be .o
#
WARNINGS+= ${WARNINGS_SET_${MACHINE_ARCH}:U${WARNINGS_SET}:@s@${$s_WARNINGS}@:O:u:@w@${${w:C/-(.)/\1_/}::?=$w} ${${w:C/-(.)/\1_/}_${MACHINE_ARCH}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_/}_${.TARGET:T:R}.o:U${${w:C/-(.)/\1_/}_${MACHINE_ARCH}:U${${w:C/-(.)/\1_/}}}}}@}
.endif
# define this once, we use it a couple of times below (hence the doubled $$).
M_warnings_list = @s@$${$$s_WARNINGS}@:O:u:@w@$${$${w:C/-(.)/\1_/}::?=$$w} $${$${w:C/-(.)/\1_/}_${MACHINE_ARCH}_${.TARGET:T:R}.o:U$${$${w:C/-(.)/\1_/}_${.TARGET:T:R}.o:U$${$${w:C/-(.)/\1_/}_${MACHINE_ARCH}:U$${$${w:C/-(.)/\1_/}}}}}@
# first a list of warnings from the chosen set
_warnings = ${WARNINGS_SET_${MACHINE_ARCH}:U${WARNINGS_SET}:${M_warnings_list}}
# now a list of all -Wno-* overrides not just those defined by WARNINGS_SET
# since things like -Wall imply lots of others.
# this should be a super-set of the -Wno-* in _warnings, but
# just in case...
_no_warnings = ${_warnings:M-Wno-*} ${ALL_WARNINGS_SETS:${M_warnings_list}:M-Wno-*}
# -Wno-* must follow any others
WARNINGS += ${_warnings:N-Wno-*} ${_no_warnings:O:u}
.ifndef NO_CFLAGS_WARNINGS
# Just ${WARNINGS} should do, but this is more flexible?
@ -137,9 +119,10 @@ NO_CXX_WARNINGS+= \
missing-declarations \
missing-prototypes \
nested-externs \
shadow \
strict-prototypes
.for s in ${SRCS:M*.cc}
.for s in ${SRCS:M*.c*:N*.c:N*h}
.for w in ${NO_CXX_WARNINGS}
W_$w_${s:T:R}.o=
.endfor

View File

@ -17,7 +17,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: os.sh,v 1.44 2010/06/29 15:37:21 sjg Exp $
# $Id: os.sh,v 1.46 2014/05/19 16:38:09 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -128,11 +128,13 @@ SunOS)
K=-k
MAILER=/usr/bin/Mail
LOCAL_FS=local
case "$-" in
*i*) ;;
: $-,$ENV
case "$-,$ENV" in
*i*,*) ;;
*,|*ENVFILE*) ;;
*) ENV=;;
esac
# NetBSD at least has good backward compatability
# NetBSD at least has good backward compatibility
# so NetBSD/i386 is good enough
case $OS in
NetBSD) SHARE_ARCH=$OS/${MACHINE_ARCH:-$MACHINE};;

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.194 2014/02/15 00:17:17 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.194 2014/02/15 00:17:17 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.194 2014/02/15 00:17:17 christos Exp $");
#endif
#endif /* not lint */
#endif
@ -364,6 +364,7 @@ static int ParseAddCmd(void *, void *);
static void ParseHasCommands(void *);
static void ParseDoInclude(char *);
static void ParseSetParseFile(const char *);
static void ParseSetIncludedFile(void);
#ifdef SYSVINCLUDE
static void ParseTraditionalInclude(char *);
#endif
@ -855,7 +856,8 @@ ParseLinkSrc(void *pgnp, void *cgnp)
(void)Lst_AtEnd(cgn->parents, pgn);
pgn->unmade += 1;
if (DEBUG(PARSE)) {
fprintf(debug_file, "# ParseLinkSrc: added child %s - %s\n", pgn->name, cgn->name);
fprintf(debug_file, "# %s: added child %s - %s\n", __func__,
pgn->name, cgn->name);
Targ_PrintNode(pgn, 0);
Targ_PrintNode(cgn, 0);
}
@ -1030,8 +1032,8 @@ ParseDoSrc(int tOp, const char *src)
(void)Lst_AtEnd(predecessor->order_succ, gn);
(void)Lst_AtEnd(gn->order_pred, predecessor);
if (DEBUG(PARSE)) {
fprintf(debug_file, "# ParseDoSrc: added Order dependency %s - %s\n",
predecessor->name, gn->name);
fprintf(debug_file, "# %s: added Order dependency %s - %s\n",
__func__, predecessor->name, gn->name);
Targ_PrintNode(predecessor, 0);
Targ_PrintNode(gn, 0);
}
@ -1216,9 +1218,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;
@ -2175,6 +2176,7 @@ Parse_include_file(char *file, Boolean isSystem, int silent)
/* load it */
lf = loadfile(fullname, fd);
ParseSetIncludedFile();
/* Start reading from this file next */
Parse_SetInput(fullname, 0, -1, loadedfile_nextbuf, lf);
curFile->lf = lf;
@ -2232,6 +2234,41 @@ ParseDoInclude(char *line)
}
/*-
*---------------------------------------------------------------------
* ParseSetIncludedFile --
* Set the .INCLUDEDFROMFILE variable to the contents of .PARSEFILE
* and the .INCLUDEDFROMDIR variable to the contents of .PARSEDIR
*
* Results:
* None
*
* Side Effects:
* The .INCLUDEDFROMFILE variable is overwritten by the contents
* of .PARSEFILE and the .INCLUDEDFROMDIR variable is overwriten
* by the contents of .PARSEDIR
*---------------------------------------------------------------------
*/
static void
ParseSetIncludedFile(void)
{
char *pf, *fp = NULL;
char *pd, *dp = NULL;
pf = Var_Value(".PARSEFILE", VAR_GLOBAL, &fp);
Var_Set(".INCLUDEDFROMFILE", pf, VAR_GLOBAL, 0);
pd = Var_Value(".PARSEDIR", VAR_GLOBAL, &dp);
Var_Set(".INCLUDEDFROMDIR", pd, VAR_GLOBAL, 0);
if (DEBUG(PARSE))
fprintf(debug_file, "%s: ${.INCLUDEDFROMDIR} = `%s' "
"${.INCLUDEDFROMFILE} = `%s'\n", __func__, pd, pf);
if (fp)
free(fp);
if (dp)
free(dp);
}
/*-
*---------------------------------------------------------------------
* ParseSetParseFile --
@ -2267,8 +2304,8 @@ ParseSetParseFile(const char *filename)
Var_Set(".PARSEFILE", pf = slash + 1, VAR_GLOBAL, 0);
}
if (DEBUG(PARSE))
fprintf(debug_file, "ParseSetParseFile: ${.PARSEDIR} = `%s' "
"${.PARSEFILE} = `%s'\n", pd, pf);
fprintf(debug_file, "%s: ${.PARSEDIR} = `%s' ${.PARSEFILE} = `%s'\n",
__func__, pd, pf);
free(dirname);
}
@ -2330,8 +2367,8 @@ Parse_SetInput(const char *name, int line, int fd,
ParseTrackInput(name);
if (DEBUG(PARSE))
fprintf(debug_file, "Parse_SetInput: file %s, line %d, fd %d, nextbuf %p, arg %p\n",
name, line, fd, nextbuf, arg);
fprintf(debug_file, "%s: file %s, line %d, fd %d, nextbuf %p, arg %p\n",
__func__, name, line, fd, nextbuf, arg);
if (fd == -1 && nextbuf == NULL)
/* sanity */
@ -2403,7 +2440,7 @@ ParseTraditionalInclude(char *line)
char *all_files;
if (DEBUG(PARSE)) {
fprintf(debug_file, "ParseTraditionalInclude: %s\n", file);
fprintf(debug_file, "%s: %s\n", __func__, file);
}
/*
@ -2462,7 +2499,7 @@ ParseGmakeExport(char *line)
char *value;
if (DEBUG(PARSE)) {
fprintf(debug_file, "ParseGmakeExport: %s\n", variable);
fprintf(debug_file, "%s: %s\n", __func__, variable);
}
/*
@ -2542,6 +2579,8 @@ ParseEOF(void)
/* We've run out of input */
Var_Delete(".PARSEDIR", VAR_GLOBAL);
Var_Delete(".PARSEFILE", VAR_GLOBAL);
Var_Delete(".INCLUDEDFROMDIR", VAR_GLOBAL);
Var_Delete(".INCLUDEDFROMFILE", VAR_GLOBAL);
return DONE;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $ */
/* $NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $";
static char rcsid[] = "$NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
__RCSID("$NetBSD: str.c,v 1.34 2012/03/03 23:16:47 dholland Exp $");
__RCSID("$NetBSD: str.c,v 1.35 2014/02/12 01:35:56 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -145,7 +145,7 @@ brk_string(const char *str, int *store_argc, Boolean expand, char **buffer)
const char *p;
int len;
int argmax = 50, curlen = 0;
char **argv = bmake_malloc((argmax + 1) * sizeof(char *));
char **argv;
/* skip leading space chars. */
for (; *str == ' ' || *str == '\t'; ++str)
@ -155,6 +155,12 @@ brk_string(const char *str, int *store_argc, Boolean expand, char **buffer)
if ((len = strlen(str) + 1) > curlen)
*buffer = bmake_malloc(curlen = len);
/*
* initial argmax based on len
*/
argmax = MAX((len / 5), 50);
argv = bmake_malloc((argmax + 1) * sizeof(char *));
/*
* copy the string; at the same time, parse backslashes,
* quotes and build the argument list.

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

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $ */
/* $NetBSD: var.c,v 1.186 2014/06/20 06:13:45 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.186 2014/06/20 06:13:45 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $");
__RCSID("$NetBSD: var.c,v 1.186 2014/06/20 06:13:45 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -140,17 +140,6 @@ __RCSID("$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $");
#include "job.h"
extern int makelevel;
/*
* XXX transition hack for FreeBSD ports.
* bsd.port.mk can set .MAKE.FreeBSD_UL=yes
* to cause us to treat :[LU] as aliases for :t[lu]
* To be reverted when ports converts to :t[lu] (when 8.3 is EOL)
*/
#define MAKE_FREEBSD_UL ".MAKE.FreeBSD_UL"
#ifdef MAKE_FREEBSD_UL
static int FreeBSD_UL = FALSE;
#endif
/*
* This lets us tell if we have replaced the original environ
* (which we cannot free).
@ -990,12 +979,6 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
Var_Append(MAKEOVERRIDES, name, VAR_GLOBAL);
}
#ifdef MAKE_FREEBSD_UL
if (strcmp(MAKE_FREEBSD_UL, name) == 0) {
FreeBSD_UL = getBoolean(MAKE_FREEBSD_UL, FALSE);
}
#endif
out:
@ -2654,7 +2637,7 @@ ApplyModifiers(char *nstr, const char *tstr,
break;
}
free(UNCONST(pattern.rhs));
newStr = var_Error;
newStr = varNoError;
break;
}
goto default_case; /* "::<unrecognised>" */
@ -2689,24 +2672,8 @@ ApplyModifiers(char *nstr, const char *tstr,
free(loop.str);
break;
}
case 'U':
#ifdef MAKE_FREEBSD_UL
if (FreeBSD_UL) {
int nc = tstr[1];
/* we have to be careful, since :U is used internally */
if (nc == ':' || nc == endc) {
char *dp = bmake_strdup(nstr);
for (newStr = dp; *dp; dp++)
*dp = toupper((unsigned char)*dp);
cp = tstr + 1;
termc = *cp;
break; /* yes inside the conditional */
}
/* FALLTHROUGH */
}
#endif
case 'D':
case 'U':
{
Buffer buf; /* Buffer for patterns */
int wantit; /* want data in buffer */
@ -2766,17 +2733,6 @@ ApplyModifiers(char *nstr, const char *tstr,
break;
}
case 'L':
#ifdef MAKE_FREEBSD_UL
if (FreeBSD_UL) {
char *dp = bmake_strdup(nstr);
for (newStr = dp; *dp; dp++)
*dp = tolower((unsigned char)*dp);
cp = tstr + 1;
termc = *cp;
break;
}
/* FALLTHROUGH */
#endif
{
if ((v->flags & VAR_JUNK) != 0)
v->flags |= VAR_KEEP;
@ -3705,6 +3661,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean errnum, int *lengthPtr,
}
} else {
Buffer buf; /* Holds the variable name */
int depth = 1;
endc = startc == PROPEN ? PRCLOSE : BRCLOSE;
Buf_Init(&buf, 0);
@ -3712,10 +3669,21 @@ Var_Parse(const char *str, GNode *ctxt, Boolean errnum, int *lengthPtr,
/*
* Skip to the end character or a colon, whichever comes first.
*/
for (tstr = str + 2;
*tstr != '\0' && *tstr != endc && *tstr != ':';
tstr++)
for (tstr = str + 2; *tstr != '\0'; tstr++)
{
/*
* Track depth so we can spot parse errors.
*/
if (*tstr == startc) {
depth++;
}
if (*tstr == endc) {
if (--depth == 0)
break;
}
if (depth == 1 && *tstr == ':') {
break;
}
/*
* A variable inside a variable, expand
*/
@ -3735,7 +3703,7 @@ Var_Parse(const char *str, GNode *ctxt, Boolean errnum, int *lengthPtr,
}
if (*tstr == ':') {
haveModifier = TRUE;
} else if (*tstr != '\0') {
} else if (*tstr == endc) {
haveModifier = FALSE;
} else {
/*
@ -4085,7 +4053,7 @@ Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr)
*/
if (oldVars) {
str += length;
} else if (undefErr) {
} else if (undefErr || val == var_Error) {
/*
* If variable is undefined, complain and skip the
* variable. The complaint will stop us from doing anything

View File

@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
CLEANDIRS+= FreeBSD
CLEANFILES+= bootstrap
# $Id: Makefile,v 1.20 2013/09/04 15:42:03 sjg Exp $
# $Id: Makefile,v 1.27 2014/06/20 14:51:54 sjg Exp $
# Base version on src date
MAKE_VERSION= 20130904
MAKE_VERSION= 20140620
PROG?= ${.CURDIR:T}
@ -84,7 +84,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

@ -19,3 +19,7 @@ LIBOBJS= ${LIBOBJDIR}stresep$U.o
LDADD=
USE_META= yes
FILEMON_H= /usr/include/dev/filemon/filemon.h
BMAKE_PATH_MAX?= 1024
# used if MAXPATHLEN not defined
CPPFLAGS+= -DBMAKE_PATH_MAX=${BMAKE_PATH_MAX}

View File

@ -146,6 +146,9 @@
`HAVE_STRUCT_STAT_ST_RDEV' instead. */
#define HAVE_ST_RDEV 1
/* Define to 1 if you have the `sysctl' function. */
#define HAVE_SYSCTL 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
@ -166,6 +169,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
@ -230,7 +236,7 @@
#define PACKAGE_NAME "bmake"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "bmake 20130706"
#define PACKAGE_STRING "bmake 20140214"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "bmake"
@ -239,7 +245,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "20130706"
#define PACKAGE_VERSION "20140214"
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
@ -300,6 +306,9 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* C99 function name */
/* #undef __func__ */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */