Import bmake-20151201

This commit is contained in:
Simon J. Gerraty 2015-12-07 22:51:25 +00:00
parent ce40971ce2
commit 7c6c27a0ba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/bmake/dist/; revision=291970
svn path=/vendor/NetBSD/bmake/20151201/; revision=291971; tag=vendor/NetBSD/bmake/20151201
27 changed files with 361 additions and 119 deletions

View File

@ -1,3 +1,35 @@
2015-12-01 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20151201
Merge with NetBSD make, pick up
o cond.c: CondCvtArg: avoid access beyond end of empty buffer.
o meta.c: meta_oodate: use lstat(2) for checking link target
in case it is a symlink.
o var.c: avoid calling brk_string and Var_Export1 with empty
strings.
2015-11-26 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20151126
Merge with NetBSD make, pick up
o parse.c: ParseTrackInput don't access beyond
end of old value.
2015-10-22 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20151022
* Add support for BSD/OS which lacks inttypes.h
and really needs sys/param.h for sys/sysctl.h
also 'type' is not a shell builtin.
* var.c: eliminate uint32_t and need for inttypes.h
* main.c: PrintOnError flush stdout before run .ERROR
* parse.c: cope with _SC_PAGESIZE not being defined.
2015-10-20 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20151020

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.44 2015/10/20 21:41:40 sjg Exp $
# $Id: Makefile,v 1.48 2015/12/02 00:36:42 sjg Exp $
# Base version on src date
MAKE_VERSION= 20151020
MAKE_VERSION= 20151201
PROG= bmake

View File

@ -111,7 +111,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: boot-strap,v 1.45 2014/04/05 22:56:54 sjg Exp $
# $Id: boot-strap,v 1.48 2015/10/25 05:20:48 sjg Exp $
#
# @(#) Copyright (c) 2001 Simon J. Gerraty
#
@ -395,8 +395,15 @@ Bmake() {
)
}
# there is actually a shell where type is not a builtin
# if type is missing, which(1) had better exists!
if (type cat) > /dev/null 2>&1; then
which() {
type "$@" | sed 's,[()],,g;s,^[^/][^/]*,,;q'
}
fi
# make sure test below uses the same diff that configure did
TOOL_DIFF=`type diff | sed 's,[()],,g;s,^[^/][^/]*,,;q'`
TOOL_DIFF=`which diff`
export TOOL_DIFF
op_configure() {

10
cond.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: cond.c,v 1.69 2015/10/11 04:51:24 sjg Exp $ */
/* $NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 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: cond.c,v 1.69 2015/10/11 04:51:24 sjg Exp $";
static char rcsid[] = "$NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
#else
__RCSID("$NetBSD: cond.c,v 1.69 2015/10/11 04:51:24 sjg Exp $");
__RCSID("$NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -490,6 +490,10 @@ CondCvtArg(char *str, double *value)
double d_val;
errno = 0;
if (!*str) {
*value = (double)0;
return TRUE;
}
l_val = strtoul(str, &eptr, str[1] == 'x' ? 16 : 10);
ech = *eptr;
if (ech == 0 && errno != ERANGE) {

View File

@ -59,6 +59,12 @@
/* Define to 1 if you have the `killpg' function. */
#undef HAVE_KILLPG
/* Define to 1 if you have the <libgen.h> header file. */
#undef HAVE_LIBGEN_H
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@ -158,6 +164,9 @@
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
@ -304,6 +313,11 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT32_T
/* C99 function name */
#undef __func__
@ -319,5 +333,9 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t
/* Define as `fork' if `vfork' does not work. */
#undef vfork

116
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for bmake 20140214.
# Generated by GNU Autoconf 2.64 for bmake 20151022.
#
# Report bugs to <sjg@NetBSD.org>.
#
@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bmake'
PACKAGE_TARNAME='bmake'
PACKAGE_VERSION='20140214'
PACKAGE_STRING='bmake 20140214'
PACKAGE_VERSION='20151022'
PACKAGE_STRING='bmake 20151022'
PACKAGE_BUGREPORT='sjg@NetBSD.org'
PACKAGE_URL=''
@ -1221,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 20140214 to adapt to many kinds of systems.
\`configure' configures bmake 20151022 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1282,7 +1282,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bmake 20140214:";;
short | recursive ) echo "Configuration of bmake 20151022:";;
esac
cat <<\_ACEOF
@ -1387,7 +1387,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bmake configure 20140214
bmake configure 20151022
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
@ -1742,6 +1742,58 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_type
# ac_fn_c_find_uintX_t LINENO BITS VAR
# ------------------------------------
# Finds an unsigned integer type with width BITS, setting cache variable VAR
# accordingly.
ac_fn_c_find_uintX_t ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
$as_echo_n "checking for uint$2_t... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
'unsigned long long int' 'unsigned short int' 'unsigned char'; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(($ac_type) -1 >> ($2 - 1) == 1)];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
case $ac_type in #(
uint$2_t) :
eval "$3=yes" ;; #(
*) :
eval "$3=\$ac_type" ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
eval as_val=\$$3
if test "x$as_val" = x""no; then :
else
break
fi
done
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_find_uintX_t
# ac_fn_c_check_decl LINENO SYMBOL VAR
# ------------------------------------
# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
@ -1908,7 +1960,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 20140214, which was
It was created by bmake $as_me 20151022, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
@ -4569,10 +4621,41 @@ fi
fi
for ac_header in sys/param.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_param_h" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_PARAM_H 1
_ACEOF
fi
done
for ac_header in sys/sysctl.h
do :
ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# endif
"
if test "x$ac_cv_header_sys_sysctl_h" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_SYSCTL_H 1
_ACEOF
fi
done
for ac_header in \
ar.h \
err.h \
fcntl.h \
libgen.h \
limits.h \
paths.h \
poll.h \
ranlib.h \
@ -4580,7 +4663,6 @@ for ac_header in \
sys/mman.h \
sys/select.h \
sys/socket.h \
sys/sysctl.h \
sys/time.h \
sys/uio.h \
unistd.h \
@ -5006,6 +5088,20 @@ _ACEOF
fi
ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
case $ac_cv_c_uint32_t in #(
no|yes) ;; #(
*)
$as_echo "#define _UINT32_T 1" >>confdefs.h
cat >>confdefs.h <<_ACEOF
#define uint32_t $ac_cv_c_uint32_t
_ACEOF
;;
esac
ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "#include <signal.h>
/* NetBSD declares sys_siglist in unistd.h. */
#ifdef HAVE_UNISTD_H
@ -6406,7 +6502,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 20140214, which was
This file was extended by bmake $as_me 20151022, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6466,7 +6562,7 @@ Report bugs to <sjg@NetBSD.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
bmake config.status 20140214
bmake config.status 20151022
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,11 @@
dnl
dnl RCSid:
dnl $Id: configure.in,v 1.54 2015/10/10 04:17:10 sjg Exp $
dnl $Id: configure.in,v 1.56 2015/10/25 05:20:48 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ(2.50)
AC_INIT([bmake], [20151009], [sjg@NetBSD.org])
AC_INIT([bmake], [20151022], [sjg@NetBSD.org])
AC_CONFIG_HEADERS(config.h)
dnl make srcdir absolute
@ -101,10 +101,19 @@ AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
dnl Keep this list sorted
AC_CHECK_HEADERS(sys/param.h)
dnl On BSDi at least we really need sys/param.h for sys/sysctl.h
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
[#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# endif
])
AC_CHECK_HEADERS( \
ar.h \
err.h \
fcntl.h \
libgen.h \
limits.h \
paths.h \
poll.h \
@ -113,7 +122,6 @@ AC_CHECK_HEADERS( \
sys/mman.h \
sys/select.h \
sys/socket.h \
sys/sysctl.h \
sys/time.h \
sys/uio.h \
unistd.h \
@ -143,6 +151,7 @@ AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_DECL_SYS_SIGLIST
AC_HEADER_TIME
AC_STRUCT_TM

8
main.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.234 2015/10/11 04:51:24 sjg Exp $ */
/* $NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.234 2015/10/11 04:51:24 sjg Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: main.c,v 1.234 2015/10/11 04:51:24 sjg Exp $");
__RCSID("$NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -1902,6 +1902,8 @@ PrintOnError(GNode *gn, const char *s)
printf("%s", cp);
free(cp);
}
fflush(stdout);
/*
* Finally, see if there is a .ERROR target, and run it if so.
*/

9
meta.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.40 2015/10/11 04:51:24 sjg Exp $ */
/* $NetBSD: meta.c,v 1.41 2015/11/30 23:37:56 sjg Exp $ */
/*
* Implement 'meta' mode.
@ -38,7 +38,11 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#ifdef HAVE_LIBGEN_H
#include <libgen.h>
#elif !defined(HAVE_DIRNAME)
char * dirname(char *);
#endif
#include <errno.h>
#if !defined(HAVE_CONFIG_H) || defined(HAVE_ERR_H)
#include <err.h>
@ -1183,7 +1187,8 @@ meta_oodate(GNode *gn, Boolean oodate)
if ((strstr("tmp", p)))
break;
if (stat(p, &fs) < 0) {
if ((link_src != NULL && lstat(p, &fs) < 0) ||
(link_src == NULL && stat(p, &fs) < 0)) {
Lst_AtEnd(missingFiles, bmake_strdup(p));
}
break;

View File

@ -1,3 +1,29 @@
2015-11-14 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20151111
* meta.sys.mk: include sys.dependfile.mk
* sys.mk (OPTIONS_DEFAULT_NO): use options.mk
to set MK_AUTO_OBJ and MK_DIRDEPS_BUILD
include local.sys.env.mk early
include local.sys.mk later
* own.mk (OPTIONS_DEFAULT_NO): AUTO_OBJ etc moved to sys.mk
2015-11-13 Simon J. Gerraty <sjg@bad.crufty.net>
* meta.sys.mk (META_COOKIE_TOUCH):
add ${META_COOKIE_TOUCH} to the end of scripts to touch cookie
* meta.stage.mk: stage_libs should ignore SYMLINKS.
2015-10-23 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20151022
* sys.mk: BSD/OS does not have 'type' as a shell builtin.
2015-10-20 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20151020
@ -460,7 +486,7 @@
needed.
* gendirdeps.mk: only produce unqualified deps if no
.MAKE.DEPENDFILE_PREFERENCE ends in .${MACHINE}
* meta.subdir.mk: apply SUBDIREPS_FILTER
* meta.subdir.mk: apply SUBDIRDEPS_FILTER
2012-04-20 Simon J. Gerraty <sjg@bad.crufty.net>

View File

@ -1,5 +1,5 @@
# RCSid:
# $Id: host-target.mk,v 1.9 2015/09/10 18:42:57 sjg Exp $
# $Id: host-target.mk,v 1.11 2015/10/25 00:07:20 sjg Exp $
# Host platform information; may be overridden
.if !defined(_HOST_OSNAME)
@ -21,7 +21,7 @@ _HOST_ARCH := ${_HOST_MACHINE}
.else
_HOST_ARCH != uname -p 2> /dev/null || uname -m
# uname -p may produce garbage on linux
.if ${_HOST_ARCH:[\#]} > 1
.if ${_HOST_ARCH:[\#]} > 1 || ${_HOST_ARCH:Nunknown} == ""
_HOST_ARCH := ${_HOST_MACHINE}
.endif
.endif
@ -33,10 +33,10 @@ HOST_MACHINE := ${_HOST_MACHINE}
.endif
HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//}
HOST_OSTYPE := ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
HOST_OSTYPE := ${_HOST_OSNAME:S,/,,g}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
HOST_OS := ${_HOST_OSNAME}
host_os := ${_HOST_OSNAME:tl}
HOST_TARGET := ${host_os}${HOST_OSMAJOR}-${_HOST_ARCH}
HOST_TARGET := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH}
# tr is insanely non-portable, accommodate the lowest common denominator
TR ?= tr

View File

@ -1,4 +1,4 @@
# $Id: init.mk,v 1.9 2013/07/18 05:46:24 sjg Exp $
# $Id: init.mk,v 1.10 2015/12/07 04:28:31 sjg Exp $
#
# @(#) Copyright (c) 2002, Simon J. Gerraty
#
@ -47,4 +47,8 @@ PROFFLAGS?= -DGPROF -DPROF
_SKIP_BUILD = not building at level 0
.endif
.if !empty(_SKIP_BUILD)
all: .PHONY
.warning ${_SKIP_BUILD}
.endif
.endif

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.115 2015/10/20 22:04:53 sjg Exp $
# $Id: install-mk,v 1.117 2015/11/14 18:09:57 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20151020
MK_VERSION=20151111
OWNER=
GROUP=
MODE=444

View File

@ -1,4 +1,4 @@
# $Id: lib.mk,v 1.51 2014/05/23 01:30:36 sjg Exp $
# $Id: lib.mk,v 1.52 2015/11/14 18:09:57 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -254,7 +254,7 @@ DLLIB ?= -ldl
# is a waste of time, this tells meta.autodep.mk to just pick one
# (typically .So)
# yes, 42 is a random number.
.if ${MK_META_MODE} == "yes" && ${SRCS:Uno:[\#]} > 42
.if ${MK_DIRDEPS_BUILD} == "yes" && ${SRCS:Uno:[\#]} > 42
OPTIMIZE_OBJECT_META_FILES ?= yes
.endif

View File

@ -1,4 +1,4 @@
# $Id: meta.autodep.mk,v 1.37 2015/06/16 06:29:17 sjg Exp $
# $Id: meta.autodep.mk,v 1.39 2015/12/07 04:35:32 sjg Exp $
#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@ -50,6 +50,9 @@ UPDATE_DEPENDFILE = NO
.endif
_CURDIR ?= ${.CURDIR}
_OBJDIR ?= ${.OBJDIR}
_OBJTOP ?= ${OBJTOP}
_OBJROOT ?= ${OBJROOT:U${_OBJTOP}}
_DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T}
.if ${.MAKE.LEVEL} == 0
@ -190,7 +193,7 @@ gendirdeps: ${_DEPENDFILE}
# anything which matches ${_OBJROOT}* but not ${_OBJTOP}*
# needs to be qualified in DIRDEPS
# The pseudo machine "host" is used for HOST_TARGET
DIRDEPS = \
DIRDEPS += \
${DPADD:M${_OBJTOP}*:H:C,${_OBJTOP}[^/]*/,,:N.:O:u} \
${DPADD:M${_OBJROOT}*:N${_OBJTOP}*:H:S,${_OBJROOT},,:C,^([^/]+)/(.*),\2.\1,:S,${HOST_TARGET}$,host,:N.*:O:u}

View File

@ -1,4 +1,4 @@
# $Id: meta.stage.mk,v 1.40 2015/10/04 17:36:54 sjg Exp $
# $Id: meta.stage.mk,v 1.41 2015/11/13 17:34:04 sjg Exp $
#
# @(#) Copyright (c) 2011, Simon J. Gerraty
#
@ -155,7 +155,7 @@ stage_libs: .dirdep
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} \
${SHLIB_LINKS:@t@${STAGE_LIBS:T:M$t.*} $t@}
.elif !empty(SHLIB_LINK) && !empty(SHLIB_NAME)
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${SHLIB_NAME} ${SHLIB_LINK} ${SYMLINKS:T}
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${SHLIB_NAME} ${SHLIB_LINK}
.endif
.endif
@touch $@

View File

@ -1,4 +1,4 @@
# $Id: meta.subdir.mk,v 1.10 2012/07/03 05:26:46 sjg Exp $
# $Id: meta.subdir.mk,v 1.11 2015/11/24 22:26:51 sjg Exp $
#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@ -62,7 +62,7 @@ _subdeps != cd ${.CURDIR} && \
DIRDEPS =
.else
# clean up if needed
DIRDEPS := ${DIRDEPS:S,^./,,:S,/./,/,g:${SUBDIREPS_FILTER:Uu}}
DIRDEPS := ${DIRDEPS:S,^./,,:S,/./,/,g:${SUBDIRDEPS_FILTER:Uu}}
.endif
# we just dealt with it, if we leave it defined,
# dirdeps.mk will compute some interesting combinations.

View File

@ -1,4 +1,4 @@
# $Id: meta.sys.mk,v 1.22 2015/06/16 06:31:05 sjg Exp $
# $Id: meta.sys.mk,v 1.26 2015/11/14 21:16:13 sjg Exp $
#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@ -51,17 +51,6 @@ META_MODE += silent=yes
.endif
.endif
# make defaults .MAKE.DEPENDFILE to .depend
# that won't work for us.
.if ${.MAKE.DEPENDFILE} == ".depend"
.undef .MAKE.DEPENDFILE
.endif
# if you don't cross build for multiple MACHINEs concurrently, then
# .MAKE.DEPENDFILE = Makefile.depend
# probably makes sense - you can set that in local.sys.mk
.MAKE.DEPENDFILE ?= Makefile.depend.${MACHINE}
# we use the pseudo machine "host" for the build host.
# this should be taken care of before we get here
.if ${OBJTOP:Ua} == ${HOST_OBJTOP:Ub}
@ -109,10 +98,27 @@ _metaError: .NOMETA .NOTMAIN
.endif
META_COOKIE_TOUCH=
# some targets need to be .PHONY in non-meta mode
META_NOPHONY= .PHONY
# Are we, after all, in meta mode?
.if ${.MAKE.MODE:Mmeta*} != ""
MKDEP_MK = meta.autodep.mk
.if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == ""
# this does all the smarts of setting .MAKE.DEPENDFILE
.-include <sys.dependfile.mk>
# check if we got anything sane
.if ${.MAKE.DEPENDFILE} == ".depend"
.undef .MAKE.DEPENDFILE
.endif
.MAKE.DEPENDFILE ?= Makefile.depend
.endif
# we can afford to use cookies to prevent some targets
# re-running needlessly
META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}}
META_NOPHONY=
.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no"
.if ${.MAKEFLAGS:Uno:M-k} != ""
# make this more obvious

View File

@ -1,4 +1,4 @@
# $Id: own.mk,v 1.29 2015/09/08 06:15:31 sjg Exp $
# $Id: own.mk,v 1.30 2015/11/14 18:09:57 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -89,12 +89,10 @@ OPTIONS_DEFAULT_NO+= DPADD_MK
# process options
OPTIONS_DEFAULT_NO+= \
AUTO_OBJ \
INSTALL_AS_USER \
GPROF \
LIBTOOL \
LINT \
META_MODE \
OPTIONS_DEFAULT_YES+= \
ARCHIVE \

View File

@ -1,4 +1,4 @@
# $Id: sys.mk,v 1.36 2014/05/11 00:30:19 sjg Exp $
# $Id: sys.mk,v 1.41 2015/11/14 20:20:34 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
@ -75,8 +75,12 @@ M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,}
M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
# type should be a builtin in any sh since about 1980,
# but sadly there are exceptions!
.if ${.MAKE.OS:Unknown:NBSD/OS} == ""
_type_sh = which
.endif
# AUTOCONF := ${autoconf:L:${M_whence}}
M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g
M_type = @x@(${_type_sh:Utype} $$x) 2> /dev/null; echo;@:sh:[0]:N* found*:[@]:C,[()],,g
M_whence = ${M_type}:M/*:[1]
# convert a path to a valid shell variable
@ -102,6 +106,9 @@ _TARGETS := ${.TARGETS}
# we need HOST_TARGET etc below.
.include <host-target.mk>
# early customizations
.-include <local.sys.env.mk>
# find the OS specifics
.if defined(SYS_OS_MK)
.include <${SYS_OS_MK}>
@ -126,11 +133,30 @@ SYS_OS_MK := ${_sys_mk}
.export SYS_OS_MK
.endif
# allow customization without editing.
.-include <local.sys.mk>
# some options we need to know early
OPTIONS_DEFAULT_NO += \
DIRDEPS_BUILD \
DIRDEPS_CACHE \
META_MODE
OPTIONS_DEFAULT_DEPENDENT += \
AUTO_OBJ/DIRDEPS_BUILD \
STAGING/DIRDEPS_BUILD \
.-include "options.mk"
.if ${MK_DIRDEPS_BUILD:Uno} == "yes"
MK_META_MODE = yes
.-include <meta.sys.mk>
.elif ${MK_META_MODE:Uno} == "yes"
.MAKE.MODE = meta verbose
.endif
# make sure we have a harmless value
.MAKE.MODE ?= normal
# if you want objdirs make them automatic
.if ${MKOBJDIRS:Uno} == "auto"
# and do it early before we compute .PATH
.if ${MK_AUTO_OBJ:Uno} == "yes" || ${MKOBJDIRS:Uno} == "auto"
.include <auto.obj.mk>
.endif
@ -178,17 +204,8 @@ Mkdirs= Mkdirs() { \
.cc.cpp-out:
@${COMPILE.cc:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$'
# we don't include own.mk but user can expect -DWITH_META_MODE to work
.if defined(WITHOUT_META_MODE)
USE_META= no
.elif defined(WITH_META_MODE)
USE_META= yes
.endif
.if ${USE_META:Uno} == "yes"
.-include <meta.sys.mk>
.endif
# make sure we have a harmless value
.MAKE.MODE ?= normal
# late customizations
.-include <local.sys.mk>
# if .CURDIR is matched by any entry in DEBUG_MAKE_DIRS we
# will apply DEBUG_MAKE_FLAGS, now.

6
os.sh
View File

@ -17,7 +17,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: os.sh,v 1.47 2015/09/10 05:53:10 sjg Exp $
# $Id: os.sh,v 1.49 2015/10/25 00:05:40 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -44,7 +44,7 @@ MACHINE_ARCH=`uname -p 2>/dev/null || echo $MACHINE`
# there is at least one case of `uname -p` outputting
# a bunch of usless drivel
case "$MACHINE_ARCH" in
*[!A-Za-z0-9_-]*) MACHINE_ARCH="$MACHINE";;
unknown|*[!A-Za-z0-9_-]*) MACHINE_ARCH="$MACHINE";;
esac
# we need this here, and it is not always available...
@ -213,7 +213,7 @@ LN=${LN:-ln}
TR=${TR:-tr}
# Some people like have /share/$HOST_TARGET/bin etc.
HOST_TARGET=`echo ${OS}${OSMAJOR}-$HOST_ARCH | toLower`
HOST_TARGET=`echo ${OS}${OSMAJOR}-$HOST_ARCH | tr -d / | toLower`
export HOST_TARGET
case `echo -n .` in -n*) N=; C="\c";; *) N=-n; C=;; esac

14
parse.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.205 2015/10/11 04:51:24 sjg Exp $ */
/* $NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.205 2015/10/11 04:51:24 sjg Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: parse.c,v 1.205 2015/10/11 04:51:24 sjg Exp $");
__RCSID("$NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -508,7 +508,11 @@ loadfile(const char *path, int fd)
#ifdef HAVE_MMAP
if (load_getsize(fd, &lf->len) == SUCCESS) {
/* found a size, try mmap */
#ifdef _SC_PAGESIZE
pagesize = sysconf(_SC_PAGESIZE);
#else
pagesize = 0;
#endif
if (pagesize <= 0) {
pagesize = 0x1000;
}
@ -2390,15 +2394,19 @@ static void
ParseTrackInput(const char *name)
{
char *old;
char *ep;
char *fp = NULL;
size_t name_len = strlen(name);
old = Var_Value(MAKE_MAKEFILES, VAR_GLOBAL, &fp);
if (old) {
ep = old + strlen(old) - name_len;
/* does it contain name? */
for (; old != NULL; old = strchr(old, ' ')) {
if (*old == ' ')
old++;
if (old >= ep)
break; /* cannot contain name */
if (memcmp(old, name, name_len) == 0
&& (old[name_len] == 0 || old[name_len] == ' '))
goto cleanup;

View File

@ -1,4 +1,4 @@
# $Id: Makefile.in,v 1.47 2015/05/05 21:58:06 sjg Exp $
# $Id: Makefile.in,v 1.48 2015/12/07 04:06:29 sjg Exp $
#
# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $
#
@ -128,7 +128,7 @@ SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
test: ${OUTFILES} .PHONY
@failed= ; \
for test in ${TESTNAMES}; do \
${TOOL_DIFF} -u ${UNIT_TESTS}/$${test}.exp $${test}.out \
${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
|| failed="$${failed}$${failed:+ }$${test}" ; \
done ; \
if [ -n "$${failed}" ]; then \

View File

@ -1,4 +1,4 @@
# $Id: cond2.mk,v 1.1.1.1 2015/05/05 21:53:13 sjg Exp $
# $Id: cond2.mk,v 1.1.1.2 2015/12/02 00:34:27 sjg Exp $
TEST_UNAME_S= NetBSD
@ -21,5 +21,9 @@ Y!= echo TEST_NOT_SET is empty or not defined >&2; echo
Y= oops
.endif
.if defined(.NDEF) && ${.NDEF} > 0
Z= yes
.endif
all:
@echo $@

View File

@ -1,9 +1,9 @@
At first, I am
happy
and now: sad
.ERROR: Looks like 'sad' is upset.
*** Error code 1
Stop.
make: stopped in unit-tests
.ERROR: Looks like 'sad' is upset.
exit status 1

View File

@ -12,9 +12,9 @@ all: mod-ts
# Use print or printf iff they are builtin.
# XXX note that this causes problems, when make decides
# there is no need to use a shell, so avoid where possible.
.if ${type print 2> /dev/null || echo:L:sh:Mbuiltin} != ""
.if ${(type print) 2> /dev/null || echo:L:sh:Mbuiltin} != ""
PRINT= print -r --
.elif ${type printf 2> /dev/null || echo:L:sh:Mbuiltin} != ""
.elif ${(type printf) 2> /dev/null || echo:L:sh:Mbuiltin} != ""
PRINT= printf '%s\n'
.else
PRINT= echo

73
var.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.199 2015/10/20 21:30:57 sjg Exp $ */
/* $NetBSD: var.c,v 1.200 2015/12/01 07:26:08 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.199 2015/10/20 21:30:57 sjg Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.200 2015/12/01 07:26:08 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.199 2015/10/20 21:30:57 sjg Exp $");
__RCSID("$NetBSD: var.c,v 1.200 2015/12/01 07:26:08 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -129,7 +129,6 @@ __RCSID("$NetBSD: var.c,v 1.199 2015/10/20 21:30:57 sjg Exp $");
#include <regex.h>
#endif
#include <ctype.h>
#include <inttypes.h>
#include <stdlib.h>
#include <limits.h>
#include <time.h>
@ -702,13 +701,15 @@ Var_ExportVars(void)
int i;
val = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE);
av = brk_string(val, &ac, FALSE, &as);
for (i = 0; i < ac; i++) {
Var_Export1(av[i], 0);
if (*val) {
av = brk_string(val, &ac, FALSE, &as);
for (i = 0; i < ac; i++) {
Var_Export1(av[i], 0);
}
free(as);
free(av);
}
free(val);
free(as);
free(av);
}
}
@ -740,35 +741,37 @@ Var_Export(char *str, int isExport)
track = VAR_EXPORT_PARENT;
}
val = Var_Subst(NULL, str, VAR_GLOBAL, FALSE, TRUE);
av = brk_string(val, &ac, FALSE, &as);
for (i = 0; i < ac; i++) {
name = av[i];
if (!name[1]) {
/*
* A single char.
* If it is one of the vars that should only appear in
* local context, skip it, else we can get Var_Subst
* into a loop.
*/
switch (name[0]) {
case '@':
case '%':
case '*':
case '!':
continue;
}
}
if (Var_Export1(name, track)) {
if (VAR_EXPORTED_ALL != var_exportedVars)
var_exportedVars = VAR_EXPORTED_YES;
if (isExport && track) {
Var_Append(MAKE_EXPORTED, name, VAR_GLOBAL);
if (*val) {
av = brk_string(val, &ac, FALSE, &as);
for (i = 0; i < ac; i++) {
name = av[i];
if (!name[1]) {
/*
* A single char.
* If it is one of the vars that should only appear in
* local context, skip it, else we can get Var_Subst
* into a loop.
*/
switch (name[0]) {
case '@':
case '%':
case '*':
case '!':
continue;
}
}
if (Var_Export1(name, track)) {
if (VAR_EXPORTED_ALL != var_exportedVars)
var_exportedVars = VAR_EXPORTED_YES;
if (isExport && track) {
Var_Append(MAKE_EXPORTED, name, VAR_GLOBAL);
}
}
}
free(as);
free(av);
}
free(val);
free(as);
free(av);
}
@ -2305,7 +2308,7 @@ VarHash(char *str)
Buffer buf;
size_t len, len2;
unsigned char *ustr = (unsigned char *)str;
uint32_t h, k, c1, c2;
unsigned int h, k, c1, c2;
h = 0x971e137bU;
c1 = 0x95543787U;