MFC bmake-20180222

PR:		226678
Submitted by:	sjg
This commit is contained in:
Simon J. Gerraty 2018-03-20 15:57:52 +00:00
parent 66d99b21a9
commit 2e01909b58
47 changed files with 1016 additions and 680 deletions

View File

@ -1,3 +1,77 @@
2018-02-22 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20180222
Merge with NetBSD make, pick up
o parse.c: avoid calling sysconf for every call to loadfile
2018-02-18 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20180218
Merge with NetBSD make, pick up
o var.c: Var_Set handle NULL value anytime.
2018-02-12 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20180212
Merge with NetBSD make, pick up
o parse.c: do not treat .info as warning with -W
2017-12-07 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20171207
Merge with NetBSD make, pick up
o var.c: Var_Append use Var_Set if var not previously set
so that VAR_CMD is handled correctly.
Add a suitable unit-test.
2017-11-26 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION (_MAKE_VERSION): 20171126
* aclocal.m4: use AC_LINK_IFELSE for AC_C___ATTRIBUTE__
since AC_TRY_COMPILE puts input inside main()
which upsets modern compilers.
2017-11-18 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20171118
Merge with NetBSD make, pick up
o var.c: do not append to variable set on command line
add unit-test to catch this.
2017-10-28 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20171028
Merge with NetBSD make, pick up
o main.c: ignore empty MAKEOBJDIR
* Makefile.config.in:
make @prefix@ @machine*@ and @default_sys_path@ defaults.
2017-10-05 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION: 20171005
* unit-tests/dotwait.mk: redirect stderr through pipe for more
consistent result on some platforms.
2017-08-13 Simon J. Gerraty <sjg@bad.crufty.net>
* machine.sh: entry for AIX
2017-08-12 Simon J. Gerraty <sjg@bad.crufty.net>
* VERSION (_MAKE_VERSION): Move the setting of _MAKE_VERSION
to a file that can be included by configure as well as make.
This allows configure to set set _MAKE_VERSION in make-bootstrap.sh
2017-08-10 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170810
Merge with NetBSD make, pick up
o meta.c: if target is in subdir we only need subdir name in
meta_name.
2017-07-20 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (_MAKE_VERSION): 20170720

View File

@ -5,6 +5,7 @@ Makefile.config.in
PSD.doc/Makefile
PSD.doc/tutorial.ms
README
VERSION
aclocal.m4
arch.c
bmake.1

View File

@ -1,7 +1,4 @@
# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $
# Base version on src date
_MAKE_VERSION= 20170720
# $Id: Makefile,v 1.99 2017/08/13 20:12:53 sjg Exp $
PROG= bmake
@ -58,6 +55,8 @@ SRCS+= \
lstReplace.c \
lstSucc.c
.-include "VERSION"
# this file gets generated by configure
.-include "Makefile.config"
@ -192,11 +191,13 @@ MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man}
${OBJS}: config.h
.endif
# make sure that MAKE_VERSION gets updated.
main.o: ${SRCS} ${MAKEFILE}
# start-delete2 for bsd.after-import.mk
# make sure that MAKE_VERSION gets updated.
main.o: ${SRCS} ${.CURDIR}/VERSION
.if ${MK_AUTOCONF_MK} == "yes"
CONFIGURE_DEPS += ${.CURDIR}/VERSION
.include <autoconf.mk>
.endif
SHARE_MK?=${SHAREDIR}/mk

View File

@ -1,11 +1,13 @@
# things set by configure
prefix= @prefix@
_MAKE_VERSION=@_MAKE_VERSION@
prefix?= @prefix@
srcdir= @srcdir@
CC?= @CC@
MACHINE= @machine@
MACHINE_ARCH= @machine_arch@
DEFAULT_SYS_PATH= @default_sys_path@
MACHINE?= @machine@
MACHINE_ARCH?= @machine_arch@
DEFAULT_SYS_PATH?= @default_sys_path@
CPPFLAGS+= @CPPFLAGS@
CFLAGS+= ${CPPFLAGS} @DEFS@
@ -13,8 +15,7 @@ LDFLAGS= @LDFLAGS@
LIBOBJS= @LIBOBJS@
LDADD= @LIBS@
USE_META= @use_meta@
FILEMON_H= @filemon_h@
FILEMON_H?= @filemon_h@
BMAKE_PATH_MAX?= @bmake_path_max@
# used if MAXPATHLEN not defined
CPPFLAGS+= -DBMAKE_PATH_MAX=${BMAKE_PATH_MAX}

2
contrib/bmake/VERSION Normal file
View File

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

View File

@ -1,5 +1,5 @@
dnl RCSid:
dnl $Id: aclocal.m4,v 1.5 2003/03/06 21:21:30 sjg Exp $
dnl $Id: aclocal.m4,v 1.6 2017/11/26 22:39:20 sjg Exp $
dnl
dnl
@ -55,10 +55,9 @@ dnl
AC_DEFUN(AC_C___ATTRIBUTE__, [
AC_MSG_CHECKING(for __attribute__)
AC_CACHE_VAL(ac_cv___attribute__, [
AC_TRY_COMPILE([
AC_LINK_IFELSE([
#include <stdlib.h>
],
[
static void foo(void) __attribute__ ((noreturn));
static void
@ -66,6 +65,12 @@ foo(void)
{
exit(1);
}
int
main(int argc, char **argv)
{
foo();
}
],
ac_cv___attribute__=yes,
ac_cv___attribute__=no)])

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -1,4 +1,4 @@
# $Id: bsd.after-import.mk,v 1.12 2014/02/14 23:45:49 sjg Exp $
# $Id: bsd.after-import.mk,v 1.13 2017/08/13 00:56:10 sjg Exp $
# This makefile is for use when integrating bmake into a BSD build
# system. Use this makefile after importing bmake.
@ -56,6 +56,7 @@ bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE}
# Makefiles need a little more tweaking than say config.h
MAKEFILE_SED = sed -e '/^MACHINE/d' \
-e '/include.*VERSION/d' \
-e '/^PROG/ { s,=,?=,;s,bmake,$${.CURDIR:T},; }' \
-e 's,^.-include,.sinclude,' \
-e '/^\..*include *</ { s,<,<bsd.,;/autoconf/d; }' \

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 20160606.
# Generated by GNU Autoconf 2.64 for bmake 20171126.
#
# Report bugs to <sjg@NetBSD.org>.
#
@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bmake'
PACKAGE_TARNAME='bmake'
PACKAGE_VERSION='20160606'
PACKAGE_STRING='bmake 20160606'
PACKAGE_VERSION='20171126'
PACKAGE_STRING='bmake 20171126'
PACKAGE_BUGREPORT='sjg@NetBSD.org'
PACKAGE_URL=''
@ -591,6 +591,7 @@ ac_includes_default="\
#endif"
ac_subst_vars='LTLIBOBJS
_MAKE_VERSION
filemon_h
use_meta
diff_u
@ -1221,7 +1222,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 20160606 to adapt to many kinds of systems.
\`configure' configures bmake 20171126 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1282,7 +1283,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bmake 20160606:";;
short | recursive ) echo "Configuration of bmake 20171126:";;
esac
cat <<\_ACEOF
@ -1387,7 +1388,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bmake configure 20160606
bmake configure 20171126
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
@ -1960,7 +1961,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 20160606, which was
It was created by bmake $as_me 20171126, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
@ -2315,6 +2316,8 @@ case "$srcdir" in
*) srcdir=`cd $srcdir && pwd`;;
esac
. $srcdir/VERSION
# Check whether --with-defshell was given.
if test "${with_defshell+set}" = set; then :
@ -4719,10 +4722,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#include <stdlib.h>
int
main ()
{
static void foo(void) __attribute__ ((noreturn));
static void
@ -4731,16 +4730,20 @@ foo(void)
exit(1);
}
;
return 0;
int
main(int argc, char **argv)
{
foo();
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
if ac_fn_c_try_link "$LINENO"; then :
ac_cv___attribute__=yes
else
ac_cv___attribute__=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
if test "$ac_cv___attribute__" = "yes"; then
@ -6005,6 +6008,7 @@ fi
ac_config_files="$ac_config_files makefile Makefile.config make-bootstrap.sh unit-tests/Makefile"
cat >confcache <<\_ACEOF
@ -6513,7 +6517,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 20160606, which was
This file was extended by bmake $as_me 20171126, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6573,7 +6577,7 @@ Report bugs to <sjg@NetBSD.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
bmake config.status 20160606
bmake config.status 20171126
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.57 2016/06/07 00:49:44 sjg Exp $
dnl $Id: configure.in,v 1.59 2017/11/26 22:39:20 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ(2.50)
AC_INIT([bmake], [20160606], [sjg@NetBSD.org])
AC_INIT([bmake], [20171126], [sjg@NetBSD.org])
AC_CONFIG_HEADERS(config.h)
dnl make srcdir absolute
@ -14,6 +14,9 @@ case "$srcdir" in
*) srcdir=`cd $srcdir && pwd`;;
esac
dnl get _MAKE_VERSION
. $srcdir/VERSION
dnl
AC_ARG_WITH(defshell,
[ --with-defshell=SHELL use SHELL by default - must be sh compatible, use sh or ksh to pick the internal definitions],
@ -386,6 +389,7 @@ AC_SUBST(GCC)
AC_SUBST(diff_u)
AC_SUBST(use_meta)
AC_SUBST(filemon_h)
AC_SUBST(_MAKE_VERSION)
AC_OUTPUT(makefile Makefile.config make-bootstrap.sh unit-tests/Makefile)
cat <<EOF

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $ */
/* $NetBSD: job.c,v 1.192 2018/02/08 09:05:21 dholland Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $";
static char rcsid[] = "$NetBSD: job.c,v 1.192 2018/02/08 09:05:21 dholland Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $");
__RCSID("$NetBSD: job.c,v 1.192 2018/02/08 09:05:21 dholland Exp $");
#endif
#endif /* not lint */
#endif
@ -102,7 +102,7 @@ __RCSID("$NetBSD: job.c,v 1.191 2017/07/20 19:29:54 sjg Exp $");
* a time given by the SEL_* constants, below,
* or until output is ready.
*
* Job_Init Called to intialize this module. in addition,
* Job_Init Called to initialize this module. in addition,
* any commands attached to the .BEGIN target
* are executed before this function returns.
* Hence, the makefile must have been parsed

View File

@ -2,7 +2,7 @@
# derrived from /etc/rc_d/os.sh
# RCSid:
# $Id: machine.sh,v 1.17 2015/05/05 00:10:54 sjg Exp $
# $Id: machine.sh,v 1.18 2017/08/13 19:11:28 sjg Exp $
#
# @(#) Copyright (c) 1994-2002 Simon J. Gerraty
#
@ -44,6 +44,12 @@ Which() {
}
case $OS in
AIX) # from http://gnats.netbsd.org/29386
OSMAJOR=`uname -v`
OSMINOR=`uname -r`
MACHINE=$OS$OSMAJOR.$OSMINOR
MACHINE_ARCH=`bootinfo -T`
;;
OpenBSD)
MACHINE=$OS$OSMAJOR.$machine
arch=`Which arch /usr/bin:/usr/ucb:$PATH`

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $ */
/* $NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 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.272 2017/06/19 19:58:24 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -792,7 +792,8 @@ Main_SetVarObjdir(const char *var, const char *suffix)
{
char *p, *path, *xpath;
if ((path = Var_Value(var, VAR_CMD, &p)) == NULL)
if ((path = Var_Value(var, VAR_CMD, &p)) == NULL ||
*path == '\0')
return FALSE;
/* expand variable substitutions */

View File

@ -13,7 +13,7 @@ esac
CC="@CC@"
CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@"
MAKE_VERSION=`sed -n '/^_MAKE_VERSION=/s,.*=[^0-9]*,,p' $srcdir/Makefile`
MAKE_VERSION=@_MAKE_VERSION@
MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \
-D@force_machine@MACHINE=\"@machine@\" -DMACHINE_ARCH=\"@machine_arch@\" \

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.103 2017/07/20 19:29:54 sjg Exp $ */
/* $NetBSD: make.h,v 1.104 2018/02/12 21:38:09 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -346,6 +346,7 @@ typedef struct GNode {
* once the makefile has been parsed. PARSE_WARNING means it can. Passed
* as the first argument to Parse_Error.
*/
#define PARSE_INFO 3
#define PARSE_WARNING 2
#define PARSE_FATAL 1

View File

@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.68 2017/07/09 04:54:00 sjg Exp $ */
/* $NetBSD: meta.c,v 1.70 2018/02/13 19:37:30 sjg Exp $ */
/*
* Implement 'meta' mode.
@ -250,6 +250,8 @@ meta_name(char *mname, size_t mnamelen,
char *rp;
char *cp;
char *tp;
char *dtp;
size_t ldname;
/*
* Weed out relative paths from the target file name.
@ -286,10 +288,15 @@ meta_name(char *mname, size_t mnamelen,
}
/* on some systems dirname may modify its arg */
tp = bmake_strdup(tname);
if (strcmp(dname, dirname(tp)) == 0)
dtp = dirname(tp);
if (strcmp(dname, dtp) == 0)
snprintf(mname, mnamelen, "%s.meta", tname);
else {
snprintf(mname, mnamelen, "%s/%s.meta", dname, tname);
ldname = strlen(dname);
if (strncmp(dname, dtp, ldname) == 0 && dtp[ldname] == '/')
snprintf(mname, mnamelen, "%s/%s.meta", dname, &tname[ldname+1]);
else
snprintf(mname, mnamelen, "%s/%s.meta", dname, tname);
/*
* Replace path separators in the file name after the
@ -783,7 +790,9 @@ meta_cmd_finish(void *pbmp)
{
int error = 0;
BuildMon *pbm = pbmp;
#ifdef USE_FILEMON
int x;
#endif
if (!pbm)
pbm = &Mybm;

View File

@ -1,3 +1,39 @@
2018-01-18 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20180118
* ldorder.mk: let make compute correct link order
2017-12-12 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20171212
* gendirdeps.mk: guard against bogus entries in GENDIRDEPS_FILTER
2017-11-14 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20171111
* lib.mk: ensure META_NOECHO is set
2017-10-25 Simon J. Gerraty <sjg@bad.crufty.net>
* Allow for host32 on rare occasions.
2017-10-18 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20171018
* whats.mk: include what_thing in what_uuid to avoid problem
when building multiple apps in the same directory.
2017-08-12 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170812
* autoconf.mk: Use CONFIGURE_DEPS so Makefile can
add dependencies for config.recheck and config.gen
2017-06-30 Simon J. Gerraty <sjg@bad.crufty.net>
* install-mk (MK_VERSION): 20170630

View File

@ -17,6 +17,7 @@ inc.mk
init.mk
install-mk
java.mk
ldorder.mk
lib.mk
libnames.mk
libs.mk

View File

@ -1,4 +1,4 @@
# $Id: auto.obj.mk,v 1.14 2017/04/18 23:53:18 sjg Exp $
# $Id: auto.obj.mk,v 1.15 2017/11/04 21:05:04 sjg Exp $
#
# @(#) Copyright (c) 2004, Simon J. Gerraty
#
@ -60,11 +60,17 @@ __objdir_made != echo ${__objdir}/; umask ${OBJDIR_UMASK:U002}; \
.endif
# This causes make to use the specified directory as .OBJDIR
.OBJDIR: ${__objdir}
.if ${.OBJDIR:tA} != ${__objdir:tA} && ${__objdir_made:Uno:M${__objdir}/*} != ""
.if ${.OBJDIR:tA} != ${__objdir:tA}
# we did not get what we want - do we care?
.if ${__objdir_made:Uno:M${__objdir}/*} != ""
# watch out for __objdir being relative path
.if !(${__objdir:M/*} == "" && ${.OBJDIR:tA} == ${${.CURDIR}/${__objdir}:L:tA})
.error could not use ${__objdir}: .OBJDIR=${.OBJDIR}
.endif
.endif
# apparently we can live with it
# make sure we know what we have
.OBJDIR: ${.CURDIR}
.endif
.endif
.endif

View File

@ -1,4 +1,4 @@
# $Id: autoconf.mk,v 1.8 2012/11/19 05:37:48 sjg Exp $
# $Id: autoconf.mk,v 1.9 2017/08/13 20:03:13 sjg Exp $
#
# @(#) Copyright (c) 1996-2009, Simon J. Gerraty
#
@ -15,8 +15,10 @@
.NOPATH: config.h config.status
CONFIGURE_DEPS += ${.CURDIR}/config.h.in ${.CURDIR}/configure
.if !target(config.h)
config.h: ${.CURDIR}/config.h.in config.status
config.h: ${CONFIGURE_DEPS} config.status
./config.status
.endif
@ -28,11 +30,11 @@ config.status: config.recheck
config.status: config.gen
.endif
config.recheck: config.h.in ${.CURDIR}/configure
config.recheck: ${CONFIGURE_DEPS}
./config.status --recheck
@touch $@
config.gen: config.h.in ${.CURDIR}/configure
config.gen: ${CONFIGURE_DEPS}
CC="${CC} ${CCMODE}" ${.CURDIR}/configure --no-create ${CONFIGURE_ARGS}
@touch $@ config.recheck

View File

@ -1,4 +1,4 @@
# $Id: dirdeps.mk,v 1.89 2017/05/17 17:41:47 sjg Exp $
# $Id: dirdeps.mk,v 1.90 2017/10/25 23:44:20 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -536,10 +536,14 @@ _machines := ${DEP_MACHINE}
# this is the machine list we actually use below
_machines := ${_only_machines}
.if defined(HOSTPROG) || ${DEP_MACHINE} == "host"
.if defined(HOSTPROG) || ${DEP_MACHINE:Nhost*} == ""
# we need to build this guy's dependencies for host as well.
.if ${DEP_MACHINE:Nhost*} == ""
_machines += ${DEP_MACHINE}
.else
_machines += host
.endif
.endif
_machines := ${_machines:O:u}
.endif

View File

@ -1,4 +1,4 @@
# $Id: dpadd.mk,v 1.23 2017/02/13 16:46:01 sjg Exp $
# $Id: dpadd.mk,v 1.26 2018/02/12 21:54:26 sjg Exp $
#
# @(#) Copyright (c) 2004, Simon J. Gerraty
#
@ -60,6 +60,7 @@ LDADD += ${LDADD_${__lib:T:R}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
# DPADD can contain things other than libs
__dpadd_libs := ${DPADD:M*/lib*}
.if defined(PROG) && ${MK_PROG_LDORDER_MK:Uno} != "no"
# some libs have dependencies...
# DPLIBS_* allows bsd.libnames.mk to flag libs which must be included
# in DPADD for a given library.
@ -73,6 +74,7 @@ __ldadd_all_xtras+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
DPADD+= ${__lib}
.endif
.endfor
.endif
# Last of all... for libc and libgcc
DPADD+= ${DPADD_LAST}
@ -125,9 +127,11 @@ SRC_LIBS+= ${_OBJDIR}/lib${LIB}.a
#
SRC_LIBS?=
__dpadd_libs += ${SRC_LIBS}
DPMAGIC_LIBS += ${__dpadd_libs} \
${__dpadd_libs:@d@${DPMAGIC_LIBS_${d:T:R}}@}
# magic_libs includes those we want to link with
# as well as those we might look at
__dpadd_magic_libs += ${__dpadd_libs} ${SRC_LIBS}
DPMAGIC_LIBS += ${__dpadd_magic_libs} \
${__dpadd_magic_libs:@d@${DPMAGIC_LIBS_${d:T:R}}@}
# we skip this for staged libs
.for __lib in ${DPMAGIC_LIBS:O:u:N${STAGE_OBJTOP:Unot}*/lib/*}
@ -189,13 +193,13 @@ LDADD := ${LDADD:S,^${__ldadd}$,${__ldadd}_p,g}
#
# We take care of duplicate suppression later.
# don't apply :T:R too early
__dpadd_incs += ${__dpadd_libs:u:@x@${INCLUDES_${x:T:R}}@}
__dpadd_incs += ${__dpadd_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_${x:T:R}}@}
__dpadd_incs += ${__dpadd_magic_libs:u:@x@${INCLUDES_${x:T:R}}@}
__dpadd_incs += ${__dpadd_magic_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_${x:T:R}}@}
__dpadd_last_incs += ${__dpadd_libs:u:@x@${INCLUDES_LAST_${x:T:R}}@}
__dpadd_last_incs += ${__dpadd_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_LAST_${x:T:R}}@}
__dpadd_last_incs += ${__dpadd_magic_libs:u:@x@${INCLUDES_LAST_${x:T:R}}@}
__dpadd_last_incs += ${__dpadd_magic_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_LAST_${x:T:R}}@}
.if defined(HOSTPROG) || ${MACHINE} == "host"
.if defined(HOSTPROG) || ${MACHINE:Nhost*} == ""
# we want any -I/usr/* last
__dpadd_last_incs := \
${__dpadd_last_incs:N-I/usr/*} \

View File

@ -1,4 +1,4 @@
# $Id: final.mk,v 1.8 2017/05/07 20:30:08 sjg Exp $
# $Id: final.mk,v 1.9 2018/01/24 22:57:11 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -6,14 +6,14 @@ __${.PARSEFILE}__:
# provide a hook for folk who want to do scary stuff
.-include <${.CURDIR:H}/Makefile-final.inc>
.-include <local.final.mk>
.if ${MK_STAGING} == "yes"
.include <meta.stage.mk>
.elif !empty(STAGE)
.-include <stage.mk>
.endif
.-include <local.final.mk>
.if empty(_SKIP_BUILD)
install: realinstall
.endif

View File

@ -1,4 +1,4 @@
# $Id: gendirdeps.mk,v 1.33 2016/10/11 22:37:28 sjg Exp $
# $Id: gendirdeps.mk,v 1.37 2018/01/31 19:06:46 sjg Exp $
# Copyright (c) 2010-2013, Juniper Networks, Inc.
# All rights reserved.
@ -194,7 +194,7 @@ dpadd_dir_list += ${f:H:tA}
.endfor
.if !empty(ddep_list)
ddeps != cat ${ddep_list:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \
sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,;s,\.${MACHINE}$$,,'
sed 's,//*$$,,;s,\.${HOST_TARGET:Uhost}$$,.host,;s,\.${HOST_TARGET32:Uhost32}$$,.host32,;s,\.${MACHINE}$$,,'
.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
.info ${RELDIR}: raw_dir_list='${dir_list}'
@ -255,7 +255,9 @@ 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:}:C,//+,/,g:O:u}
# what modifiers do we allow in GENDIRDEPS_FILTER
GENDIRDEPS_FILTER_MASK += @CMNS
DIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:M[${GENDIRDEPS_FILTER_MASK:O:u:ts}]*:ts:}:C,//+,/,g:O:u}
.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != ""
.info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS}

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.148 2017/06/30 23:46:15 sjg Exp $
# $Id: install-mk,v 1.153 2018/01/24 22:57:11 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20170630
MK_VERSION=20180118
OWNER=
GROUP=
MODE=444

127
contrib/bmake/mk/ldorder.mk Normal file
View File

@ -0,0 +1,127 @@
# $Id: ldorder.mk,v 1.18 2018/02/11 18:27:59 sjg Exp $
#
# @(#) Copyright (c) 2015, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@crufty.net
#
# Try to compute optimal link order.
# When using only shared libs link order does not much matter,
# but archive libs are a different matter.
# We can construct a graph of .ldorder-lib${LIB*} dependencies
# and associate each with _LDORDER_USE to output the relevant
# ld flags.
# Due to the nature of make, the result will be in the reverse order
# that we want to feed to ld.
# So we need to reverse it before use.
.if !target(_LDORDER_USE)
# does caller want to use ldorder?
# yes for prog, normally no for lib
_ldorder_use := ${.ALLTARGETS:Mldorder}
.-include <local.ldorder.mk>
# convert /path/to/libfoo.a into _{LIBFOO}
LDORDER_INC_FILTER += S,+,PLUS,g S,.so$$,,g
LDORDER_LIBS_FILTER += O:u
LDORDER_INC ?= ldorder.inc
REFERENCE_FILE ?= :
_LDORDER_USE: .ldorder-rm .USE .NOTMAIN
@echo depends: ${.ALLSRC:M.ldorder-lib*} > /dev/null
@echo ${LDADD_${.TARGET:T:S,.ldorder-,,}:U${.TARGET:T:S/.ldorder-lib/-l/}} >> .ldorder
@${META_COOKIE_TOUCH}
# we need to truncate our working file
.ldorder-rm: .NOTMAIN
@rm -f .ldorder ldorder-*
@${.ALLSRC:O:u:@f@${REFERENCE_FILE} < $f;@}
@${META_COOKIE_TOUCH}
# make sure this exists
.ldorder: .NOTMAIN
# and finally we need to reverse the order of content
ldorder: .ldorder .NOTMAIN
@{ test ! -s .ldorder || cat -n .ldorder | sort -rn | \
sed '/ldorder-/d;s,^[[:space:]0-9]*,,'; } > ${.TARGET}
# Initially we hook contents of DPLIBS and DPADD into our graph
LDORDER_LIBS ?= ${DPLIBS} ${DPADD:M*/lib*} ${__dpadd_libs}
# we need to remember this
_LDORDER_LIBS := ${LDORDER_LIBS:${LDORDER_LIBS_FILTER:ts:}}
.if empty(_LDORDER_LIBS)
# don't use stale ldorder
LDADD_LDORDER =
.else
# this is how you use it
LDADD_LDORDER ?= `cat ldorder`
.endif
# for debug below
_ldorder = ${RELDIR}.${TARGET_SPEC}
.endif # !target(_LDORDER_USE)
.if !empty(LDORDER_LIBS) && !empty(_ldorder_use)
# canonicalize - these are just tokens anyway
LDORDER_LIBS := ${LDORDER_LIBS:${LDORDER_LIBS_FILTER:ts:}:R:C/\.so.*//}
_ldorders := ${LDORDER_LIBS:T:Mlib*:S,^,.ldorder-,}
.for t in ${_ldorders}
.if !target($t)
$t: _LDORDER_USE
.endif
.endfor
# and this makes it all happen
.ldorder: ${_ldorders}
# this is how we get the dependencies
.if ${.INCLUDEDFROMFILE:M*.${LDORDER_INC}} != ""
_ldorder := .ldorder-${.INCLUDEDFROMFILE:S/.${LDORDER_INC}//}
${_ldorder}: ${_ldorders}
.ldorder-rm: ${.INCLUDEDFROMDIR}/${.INCLUDEDFROMFILE}
.endif
# set DEBUG_LDORDER to pattern[s] that match the dirs of interest
.if ${DEBUG_LDORDER:Uno:@x@${RELDIR:M$x}@} != ""
.info ${_ldorder}: ${_ldorders}
.endif
# now try to find more ...
# each *.${LDORDER_INC} should set LDORDER_LIBS to what it needs
# it can also add to CFLAGS etc.
.for __inc in ${LDORDER_LIBS:S,$,.${LDORDER_INC},}
.if !target(__${__inc}__)
__${__inc}__:
# make sure this is reset
LDORDER_LIBS =
.-include <${__inc}>
.endif
.endfor
.endif # !empty(LDORDER_LIBS)
.ifdef LIB
# you can make this depend on files (must match *ldorder*)
# to add extra content - like CFLAGS
libLDORDER_INC = lib${LIB}.${LDORDER_INC}
.if !commands(${libLDORDER_INC})
${libLDORDER_INC}:
@(cat /dev/null ${.ALLSRC:M*ldorder*}; \
echo 'LDORDER_LIBS= ${_LDORDER_LIBS:T:R:${LDORDER_INC_FILTER:ts:}:tu:C,.*,_{&},}'; \
echo; echo '.include <ldorder.mk>' ) | sed 's,_{,$${,g' > ${.TARGET}
.endif
.endif

View File

@ -1,4 +1,4 @@
# $Id: lib.mk,v 1.62 2017/06/11 03:24:04 sjg Exp $
# $Id: lib.mk,v 1.68 2018/01/26 20:08:16 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -37,6 +37,8 @@ PICO?= .pico
CFLAGS+= ${COPTS}
META_NOECHO?= echo
# Originally derrived from NetBSD-1.6
# Set PICFLAGS to cc flags for producing position-independent code,
@ -370,6 +372,11 @@ _LIBS+=llib-l${LIB}.ln
.if empty(LIB)
_LIBS=
.elif ${MK_LDORDER_MK} != "no"
# Record any libs that we need to be linked with
_LIBS+= ${libLDORDER_INC}
.include <ldorder.mk>
.endif
.if !defined(_SKIP_BUILD)
@ -507,20 +514,24 @@ libinstall:
[ -d ${DESTDIR}/${LIBDIR} ] || \
${INSTALL} -d ${LIB_INSTALL_OWN} -m 775 ${DESTDIR}${LIBDIR}
.if ${MK_ARCHIVE} != "no"
${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 600 lib${LIB}.a \
${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 644 lib${LIB}.a \
${DESTDIR}${LIBDIR}
${RANLIB} ${DESTDIR}${LIBDIR}/lib${LIB}.a
chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if ${MK_PROFILE} != "no"
${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 600 \
${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 644 \
lib${LIB}_p.a ${DESTDIR}${LIBDIR}
${RANLIB} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if ${MK_LDORDER_MK} != "no"
${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 644 \
lib${LIB}.ldorder.inc ${DESTDIR}${LIBDIR}
.endif
.if ${MK_PIC} != "no"
.if ${MK_PICLIB} != "no"
${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 600 \
${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 644 \
lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
${RANLIB} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a

View File

@ -1,4 +1,4 @@
# $Id: meta.autodep.mk,v 1.45 2016/06/03 17:22:32 sjg Exp $
# $Id: meta.autodep.mk,v 1.46 2017/10/25 23:44:20 sjg Exp $
#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@ -261,7 +261,7 @@ META_FILES = ${.MAKE.META.FILES:T:N.depend*:N*o.meta:O:u} \
_makesyspath:= ${_PARSEDIR}
${_DEPENDFILE}: ${_depend} ${.PARSEDIR}/gendirdeps.mk ${META2DEPS} $${.MAKE.META.CREATED}
@echo Checking $@: ${.OODATE:T:[1..8]}
@(cd . && \
@(cd . && ${GENDIRDEPS_ENV} \
SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS:O:u}' \
DPADD='${FORCE_DPADD:O:u}' ${_gendirdeps_mutex} \
MAKESYSPATH=${_makesyspath} \

View File

@ -1,4 +1,4 @@
# $Id: meta.stage.mk,v 1.54 2017/07/06 23:20:33 sjg Exp $
# $Id: meta.stage.mk,v 1.55 2017/10/27 01:17:09 sjg Exp $
#
# @(#) Copyright (c) 2011-2017, Simon J. Gerraty
#
@ -20,9 +20,9 @@
.if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} != ""
# this is generally safer anyway
_dirdep = ${RELDIR}.${MACHINE}
_dirdep ?= ${RELDIR}.${MACHINE}
.else
_dirdep = ${RELDIR}
_dirdep ?= ${RELDIR}
.endif
CLEANFILES+= .dirdep

View File

@ -1,4 +1,4 @@
# $Id: own.mk,v 1.36 2017/07/08 21:58:46 sjg Exp $
# $Id: own.mk,v 1.39 2018/01/26 20:08:16 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -91,6 +91,7 @@ OPTIONS_DEFAULT_NO+= DPADD_MK
OPTIONS_DEFAULT_NO+= \
INSTALL_AS_USER \
GPROF \
LDORDER_MK \
LIBTOOL \
LINT \
@ -113,6 +114,7 @@ OPTIONS_DEFAULT_YES+= \
OPTIONS_DEFAULT_DEPENDENT+= \
CATPAGES/MAN \
PROG_LDORDER_MK/LDORDER_MK \
OBJDIRS/OBJ \
PICINSTALL/LINKLIB \
PICLIB/PIC \

View File

@ -1,4 +1,4 @@
# $Id: prog.mk,v 1.32 2017/05/06 17:30:09 sjg Exp $
# $Id: prog.mk,v 1.35 2018/01/26 20:04:07 sjg Exp $
.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@ -109,15 +109,21 @@ _SUPCXX= -lstdc++ -lm
_CCLINK?= ${CC}
.if ${MK_PROG_LDORDER_MK} != "no"
${PROG}: ldorder
.include <ldorder.mk>
.endif
.if defined(DESTDIR) && exists(${LIBCRT0}) && ${LIBCRT0} != "/dev/null"
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} -L${DESTDIR}/usr/lib ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND}
${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib ${_PROGLDOPTS} -L${DESTDIR}/usr/lib ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD_LDORDER} ${LDADD} -L${DESTDIR}/usr/lib ${_SUPCXX} -lgcc -lc -lgcc ${LIBCRTEND}
.else
${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD_LDORDER} ${LDADD}
.endif # defined(DESTDIR)
.endif # defined(OBJS) && !empty(OBJS)

View File

@ -1,4 +1,4 @@
# $Id: sys.clean-env.mk,v 1.21 2016/02/18 21:16:40 sjg Exp $
# $Id: sys.clean-env.mk,v 1.22 2017/10/25 23:44:20 sjg Exp $
#
# @(#) Copyright (c) 2009, Simon J. Gerraty
#
@ -97,7 +97,7 @@ _objroot := ${OBJROOT:U${SB_OBJROOT:U${SB}/${SB_OBJPREFIX}}}
.if ${MAKE_VERSION} < 20160218
_objtop := ${OBJTOP:U${_objroot}${MACHINE}}
# Take care of ${MACHINE}
.if ${MACHINE} == "host" || ${OBJTOP} == ${HOST_OBJTOP:Uno}
.if ${MACHINE:Nhost*} == "" || ${OBJTOP} == ${HOST_OBJTOP:Uno}
OBJTOP = ${_objtop:S,${HOST_TARGET}$,\${MACHINE},}
.else
OBJTOP = ${_objtop:S,${MACHINE}$,\${MACHINE},}

View File

@ -1,4 +1,4 @@
# $Id: sys.mk,v 1.45 2017/02/05 01:26:13 sjg Exp $
# $Id: sys.mk,v 1.46 2017/11/15 22:59:23 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
@ -84,7 +84,7 @@ OPTIONS_DEFAULT_DEPENDENT += \
MK_META_MODE = yes
.-include <meta.sys.mk>
.elif ${MK_META_MODE:Uno} == "yes"
.MAKE.MODE = meta verbose
.MAKE.MODE = meta verbose ${META_MODE}
.endif
# make sure we have a harmless value
.MAKE.MODE ?= normal

View File

@ -1,4 +1,4 @@
# $Id: sys.vars.mk,v 1.2 2017/01/31 07:44:45 sjg Exp $
# $Id: sys.vars.mk,v 1.3 2018/02/06 00:51:53 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
@ -45,7 +45,7 @@ M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,}
# turn a list into a set of :N modifiers
# NskipFoo = ${Foo:${M_ListToSkip}}
M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,
M_ListToSkip= O:u:S,^,N,:ts:
# type should be a builtin in any sh since about 1980,
# but sadly there are exceptions!

View File

@ -1,4 +1,4 @@
# $Id: whats.mk,v 1.1 2014/08/30 22:40:47 sjg Exp $
# $Id: whats.mk,v 1.3 2017/10/19 06:09:14 sjg Exp $
#
# @(#) Copyright (c) 2014, Simon J. Gerraty
#
@ -36,7 +36,8 @@ what_build_thing?= ${KMOD}.ko
.if !empty(what_thing)
# a unique name that won't conflict with anything
what_uuid = what_${.CURDIR:T:hash}
what_uuid = what_${what_thing}_${.CURDIR:T:hash}
what_var = what_${.CURDIR:T:hash}
.if !empty(what_build_thing)
${what_build_thing}: ${what_build_exts:@e@${what_uuid}.$e@}
@ -57,7 +58,7 @@ _what1:= @(\#)${what_thing:tu} built ${%Y%m%d:L:localtime} by ${USER}
_what2:= @(\#)${what_location}
${what_uuid}.c:
echo '${_what_t} ${what_uuid}1[] = "${_what1}";' > $@ ${.OODATE:MNO_META_CMP}
echo '${_what_t} ${what_uuid}2[] = "${_what2}";' >> $@
echo '${_what_t} ${what_var}1[] = "${_what1}";' > $@ ${.OODATE:MNO_META_CMP}
echo '${_what_t} ${what_var}2[] = "${_what2}";' >> $@
.endif
.endif

View File

@ -17,7 +17,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: os.sh,v 1.53 2017/01/11 20:01:09 sjg Exp $
# $Id: os.sh,v 1.55 2017/12/11 20:31:41 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -138,6 +138,7 @@ SunOS)
# so NetBSD/i386 is good enough
case $OS in
NetBSD)
LOCALBASE=/usr/pkg
HOST_ARCH=$MACHINE
SHARE_ARCH=$OS/$HOST_ARCH
;;
@ -196,6 +197,7 @@ Haiku)
esac
;;
esac
LOCALBASE=${LOCALBASE:-/usr/local}
HOSTNAME=${HOSTNAME:-`( hostname ) 2>/dev/null`}
HOSTNAME=${HOSTNAME:-`( uname -n ) 2>/dev/null`}
@ -237,6 +239,7 @@ Echo() {
export HOSTNAME HOST
export OS MACHINE MACHINE_ARCH OSREL OSMAJOR LOCAL_FS TMP_DIRS MAILER N C K PS_AXC
export LN SHARE_ARCH TR
export LOCALBASE
case /$0 in
*/os.sh)
@ -246,5 +249,7 @@ case /$0 in
echo "$v='$vv'"
done
;;
*/host_target32) echo $HOST_TARGET32;;
*/host_target) echo $HOST_TARGET;;
esac

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $ */
/* $NetBSD: parse.c,v 1.227 2018/02/22 01:59:28 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.227 2018/02/22 01:59:28 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.225 2017/04/17 13:29:07 maya Exp $");
__RCSID("$NetBSD: parse.c,v 1.227 2018/02/22 01:59:28 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -490,7 +490,7 @@ loadfile(const char *path, int fd)
{
struct loadedfile *lf;
#ifdef HAVE_MMAP
long pagesize;
static long pagesize = 0;
#endif
ssize_t result;
size_t bufpos;
@ -515,9 +515,8 @@ loadfile(const char *path, int fd)
if (load_getsize(fd, &lf->len) == SUCCESS) {
/* found a size, try mmap */
#ifdef _SC_PAGESIZE
pagesize = sysconf(_SC_PAGESIZE);
#else
pagesize = 0;
if (pagesize == 0)
pagesize = sysconf(_SC_PAGESIZE);
#endif
if (pagesize <= 0) {
pagesize = 0x1000;
@ -720,6 +719,8 @@ ParseVErrorInternal(FILE *f, const char *cfname, size_t clineno, int type,
(void)vfprintf(f, fmt, ap);
(void)fprintf(f, "\n");
(void)fflush(f);
if (type == PARSE_INFO)
return;
if (type == PARSE_FATAL || parseWarnFatal)
fatals += 1;
if (parseWarnFatal && !fatal_warning_error_printed) {
@ -812,7 +813,7 @@ ParseMessage(char *line)
switch(*line) {
case 'i':
mtype = 0;
mtype = PARSE_INFO;
break;
case 'w':
mtype = PARSE_WARNING;

View File

@ -1,4 +1,4 @@
/* $NetBSD: stresep.c,v 1.2 2007/12/06 22:07:07 seb Exp $ */
/* $NetBSD: stresep.c,v 1.4 2017/08/23 10:27:41 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -59,6 +59,7 @@ stresep(char **stringp, const char *delim, int esc)
char *s;
const char *spanp;
int c, sc;
size_t l;
char *tok;
if (stringp == NULL || delim == NULL)
@ -66,23 +67,26 @@ stresep(char **stringp, const char *delim, int esc)
if ((s = *stringp) == NULL)
return NULL;
l = strlen(s) + 1;
for (tok = s;;) {
c = *s++;
l--;
while (esc != '\0' && c == esc) {
(void)strcpy(s - 1, s);
memmove(s - 1, s, l);
c = *s++;
l--;
}
spanp = delim;
do {
if ((sc = *spanp++) == c) {
if (c == 0)
if (c == '\0')
s = NULL;
else
s[-1] = 0;
s[-1] = '\0';
*stringp = s;
return tok;
}
} while (sc != 0);
} while (sc != '\0');
}
}
#endif

View File

@ -22,9 +22,9 @@ shared.2.1
shared.2.1
shared.2.99
shared.2.99
cycle.1.99
cycle.1.99
make: Graph cycles through `cycle.2.99'
make: Graph cycles through `cycle.2.98'
make: Graph cycles through `cycle.2.97'
cycle.1.99
cycle.1.99
exit status 0

View File

@ -1,4 +1,4 @@
# $NetBSD: dotwait.mk,v 1.1 2014/08/21 13:44:51 apb Exp $
# $NetBSD: dotwait.mk,v 1.2 2017/10/08 20:44:19 sjg Exp $
THISMAKEFILE:= ${.PARSEDIR}/${.PARSEFILE}
@ -11,7 +11,7 @@ PAUSE= sleep 1
# Ignore "--- target ---" lines printed by parallel make.
all:
.for t in ${TESTS}
@${.MAKE} -f ${THISMAKEFILE} -j4 $t | grep -v "^--- "
@${.MAKE} -f ${THISMAKEFILE} -j4 $t 2>&1 | grep -v "^--- "
.endfor
#

View File

@ -1,5 +1,7 @@
default FU=<v>fu</v> FOO=<v>foo</v> VAR=<v></v>
two FU=<v>bar</v> FOO=<v>goo</v> VAR=<v></v>
immutable FU='bar'
immutable FOO='goo'
three FU=<v>bar</v> FOO=<v>goo</v> VAR=<v></v>
four FU=<v>bar</v> FOO=<v>goo</v> VAR=<v>Internal</v>
five FU=<v>bar</v> FOO=<v>goo</v> VAR=<v>Internal</v>

View File

@ -1,4 +1,4 @@
# $Id: varcmd.mk,v 1.1.1.1 2014/08/30 18:57:18 sjg Exp $
# $Id: varcmd.mk,v 1.1.1.3 2017/12/08 03:37:54 sjg Exp $
#
# Test behaviour of recursive make and vars set on command line.
@ -15,7 +15,7 @@ show:
@echo "${TAG} FU=<v>${FU}</v> FOO=<v>${FOO}</v> VAR=<v>${VAR}</v>"
one: show
@${.MAKE} -f ${MAKEFILE} FU=bar FOO=goo two
@${.MAKE} -f ${MAKEFILE} FU=bar FOO+=goo two
two: show
@${.MAKE} -f ${MAKEFILE} three
@ -24,6 +24,17 @@ three: show
@${.MAKE} -f ${MAKEFILE} four
.ifmake two
# this should not work
FU+= oops
FOO+= oops
_FU:= ${FU}
_FOO:= ${FOO}
two: immutable
immutable:
@echo "$@ FU='${_FU}'"
@echo "$@ FOO='${_FOO}'"
.endif
.ifmake four
VAR=Internal
.MAKEOVERRIDES+= VAR

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.215 2017/04/16 21:39:49 riastradh Exp $ */
/* $NetBSD: var.c,v 1.218 2018/02/18 00:52:42 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.215 2017/04/16 21:39:49 riastradh Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.218 2018/02/18 00:52:42 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.215 2017/04/16 21:39:49 riastradh Exp $");
__RCSID("$NetBSD: var.c,v 1.218 2018/02/18 00:52:42 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -970,7 +970,8 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
VarAdd(name, val, ctxt);
} else {
Buf_Empty(&v->val);
Buf_AddBytes(&v->val, strlen(val), val);
if (val)
Buf_AddBytes(&v->val, strlen(val), val);
if (DEBUG(VAR)) {
fprintf(debug_file, "%s:%s = %s\n", ctxt->name, name, val);
@ -997,7 +998,7 @@ Var_Set(const char *name, const char *val, GNode *ctxt, int flags)
* Makefile settings.
*/
if (varNoExportEnv != TRUE)
setenv(name, val, 1);
setenv(name, val ? val : "", 1);
Var_Append(MAKEOVERRIDES, name, VAR_GLOBAL);
}
@ -1060,11 +1061,11 @@ Var_Append(const char *name, const char *val, GNode *ctxt)
name = expanded_name;
}
v = VarFind(name, ctxt, (ctxt == VAR_GLOBAL) ? FIND_ENV : 0);
v = VarFind(name, ctxt, (ctxt == VAR_GLOBAL) ? (FIND_CMD|FIND_ENV) : 0);
if (v == NULL) {
VarAdd(name, val, ctxt);
} else {
Var_Set(name, val, ctxt, 0);
} else if (ctxt == VAR_CMD || !(v->flags & VAR_FROM_CMD)) {
Buf_AddByte(&v->val, ' ');
Buf_AddBytes(&v->val, strlen(val), val);

View File

@ -14,10 +14,7 @@ CFLAGS+= -I${.CURDIR}
CLEANDIRS+= FreeBSD
CLEANFILES+= bootstrap
# $Id: Makefile,v 1.95 2017/07/20 19:36:13 sjg Exp $
# Base version on src date
_MAKE_VERSION= 20170720
# $Id: Makefile,v 1.99 2017/08/13 20:12:53 sjg Exp $
PROG?= ${.CURDIR:T}
@ -74,6 +71,7 @@ SRCS+= \
lstReplace.c \
lstSucc.c
# this file gets generated by configure
.sinclude "Makefile.config"
@ -160,9 +158,6 @@ MANDIR= ${MANDIR.bmake:U${SHAREDIR}/man}
${OBJS}: config.h
.endif
# make sure that MAKE_VERSION gets updated.
main.o: ${SRCS} ${MAKEFILE}
# A simple unit-test driver to help catch regressions
accept test:

View File

@ -7,10 +7,12 @@ SRCTOP?= ${.CURDIR:H:H}
# things set by configure
prefix= /usr
_MAKE_VERSION=20180222
prefix?= /usr
srcdir= ${SRCTOP}/contrib/bmake
CC?= gcc
DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk
CC?= cc
DEFAULT_SYS_PATH?= .../share/mk:/usr/share/mk
CPPFLAGS+=
CFLAGS+= ${CPPFLAGS} -DHAVE_CONFIG_H
@ -18,8 +20,7 @@ LDFLAGS=
LIBOBJS= ${LIBOBJDIR}stresep$U.o
LDADD=
USE_META= yes
FILEMON_H= /usr/include/dev/filemon/filemon.h
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

@ -30,3 +30,7 @@ CFLAGS+= -DNO_PWD_OVERRIDE
DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk
.export DEFAULT_SYS_PATH
.endif
.if ${MACHINE} != "host"
FILEMON_H ?= ${SRCTOP}/sys/dev/filemon/filemon.h
.endif

View File

@ -236,7 +236,7 @@
#define HAVE_WORKING_VFORK 1
/* define if your compiler has __attribute__ */
/* #undef HAVE___ATTRIBUTE__ */
#define HAVE___ATTRIBUTE__ 1
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "sjg@NetBSD.org"
@ -245,7 +245,7 @@
#define PACKAGE_NAME "bmake"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "bmake 20160606"
#define PACKAGE_STRING "bmake 20171126"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "bmake"
@ -254,7 +254,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "20160606"
#define PACKAGE_VERSION "20171126"
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void