Import bmake-20200606

Relevant items from ChangeLog:

	o dir.c: cached_stats - don't confuse stat and lstat results.
	o var.c: add :Or for reverse sort.
This commit is contained in:
Simon J. Gerraty 2020-06-09 02:07:26 +00:00
parent b897d72a5a
commit abd272d7ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/bmake/dist/; revision=361954
svn path=/vendor/NetBSD/bmake/20200606/; revision=361955; tag=vendor/NetBSD/bmake/20200606
16 changed files with 390 additions and 113 deletions

View File

@ -1,3 +1,25 @@
2020-06-06 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200606
Merge with NetBSD make, pick up
o make.1: cleanup
* Makefile: fix depends for main.o which broke MAKE_VERSION
2020-06-05 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200605
Merge with NetBSD make, pick up
o dir.c: cached_stats - don't confuse stat and lstat results.
o var.c: add :Or for reverse sort.
2020-05-24 Simon J Gerraty <sjg@beast.crufty.net>
* configure.in: add AC_PROG_CC_C99 for mipspro compiler
also if --with-filemon= specifies path to filemon.h
set use_filemon=dev
* dirname.c: remove include of namespace.h
2020-05-17 Simon J Gerraty <sjg@beast.crufty.net>
* VERSION (_MAKE_VERSION): 20200517

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.104 2020/02/06 01:33:54 sjg Exp $
# $Id: Makefile,v 1.107 2020/06/07 21:18:46 sjg Exp $
PROG= bmake
@ -82,7 +82,7 @@ COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\""
# should be set by now
USE_FILEMON ?= no
.if ${USE_FILEMON:tl} != "no"
.PATH: ${.CURDIR}/filemon
.PATH: ${srcdir}/filemon
SRCS+= filemon_${USE_FILEMON}.c
COPTS.meta.c+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu}
COPTS.job.c+= ${COPTS.meta.c}
@ -158,7 +158,7 @@ MAN1= ${MAN}
.if (${PROG} != "make")
CLEANFILES+= my.history
.if make(${MAN}) || !exists(${srcdir}/${MAN})
my.history: ${MAKEFILE}
my.history:
@(echo ".Nm"; \
echo "is derived from NetBSD"; \
echo ".Xr make 1 ."; \
@ -207,7 +207,7 @@ ${OBJS}: config.h
# start-delete2 for bsd.after-import.mk
# make sure that MAKE_VERSION gets updated.
main.o: ${SRCS} ${.CURDIR}/VERSION
main.o: ${srcdir}/VERSION
.if ${MK_AUTOCONF_MK} == "yes"
CONFIGURE_DEPS += ${.CURDIR}/VERSION

View File

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

54
bmake.1
View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $
.\" $NetBSD: make.1,v 1.282 2020/06/06 20:28:42 wiz 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 May 26, 2018
.Dd June 5, 2020
.Dt BMAKE 1
.Os
.Sh NAME
@ -272,7 +272,7 @@ that do not depend on the target whose creation caused the error.
.It Fl m Ar directory
Specify a directory in which to search for sys.mk and makefiles included
via the
.Ao Ar file Ac Ns -style
.Li \&< Ns Ar file Ns Li \&> Ns -style
include statement.
The
.Fl m
@ -280,7 +280,7 @@ option can be used multiple times to form a search path.
This path will override the default system include path: /usr/share/mk.
Furthermore the system include path will be appended to the search path used
for
.Qo Ar file Qc Ns -style
.Li \*q Ns Ar file Ns Li \*q Ns -style
include statements (see the
.Fl I
option).
@ -1196,10 +1196,8 @@ but selects all words which do not match
.Ar pattern .
.It Cm \&:O
Order every word in variable alphabetically.
To sort words in
reverse order use the
.Ql Cm \&:O:[-1..1]
combination of modifiers.
.It Cm \&:Or
Order every word in variable in reverse alphabetical order.
.It Cm \&:Ox
Randomize words in variable.
The results will be different each time you are referring to the
@ -1234,7 +1232,7 @@ Quotes every shell meta-character in the variable, and also doubles
characters so that it can be passed
safely through recursive invocations of
.Nm .
This is equivalent to:
This is equivalent to:
.Sq \&:S/\e\&$/&&/g:Q .
.It Cm \&:R
Replaces each word in the variable with everything but its suffix.
@ -1429,6 +1427,29 @@ is the substring of
.Ar old_string
to be replaced in
.Ar new_string .
If only
.Ar old_string
contains the pattern matching character
.Ar % ,
and
.Ar old_string
matches, then the result is the
.Ar new_string .
If only the
.Ar new_string
contains the pattern matching character
.Ar % ,
then it is not treated specially and it is printed as a literal
.Ar %
on match.
If there is more than one pattern matching character
.Ar ( % )
in either the
.Ar new_string
or
.Ar old_string ,
only the first instance is treated specially (as the pattern character);
all subsequent instances are treated as regular characters
.Pp
Variable expansion occurs in the normal fashion inside both
.Ar old_string
@ -1591,6 +1612,11 @@ then the words are output in reverse order.
For example,
.Ql Cm \&:[-1..1]
selects all the words from last to first.
If the list is already ordered, then this effectively reverses
the list, but it is more efficient to use
.Ql Cm \&:Or
instead of
.Ql Cm \&:O:[-1..1] .
.\" :[*]
.It Cm \&*
Causes subsequent modifiers to treat the value as a single word
@ -1623,9 +1649,9 @@ dot
.Pq Ql \&.
character.
Files are included with either
.Cm \&.include Aq Ar file
.Cm \&.include \&< Ns Ar file Ns Cm \&>
or
.Cm \&.include Pf \*q Ar file Ns \*q .
.Cm \&.include \&\*q Ns Ar file Ns Cm \&\*q .
Variables between the angle brackets or double quotes are expanded
to form the file name.
If angle brackets are used, the included makefile is expected to be in
@ -2409,9 +2435,9 @@ file).
.Sh BUGS
The
make
syntax is difficult to parse without actually acting of the data.
For instance finding the end of a variable use should involve scanning each
the modifiers using the correct terminator for each field.
syntax is difficult to parse without actually acting on the data.
For instance, finding the end of a variable's use should involve scanning
each of the modifiers, using the correct terminator for each field.
In many places
make
just counts {} and () in order to find the end of a variable expansion.

View File

@ -779,8 +779,9 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
This is identical to `:M', but selects all words which do not match
pattern.
:O Order every word in variable alphabetically. To sort words in
reverse order use the `:O:[-1..1]' combination of modifiers.
:O Order every word in variable alphabetically.
:Or Order every word in variable in reverse alphabetical order.
:Ox Randomize words in variable. The results will be different each
time you are referring to the modified variable; use the assignment
@ -803,7 +804,11 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
due uno quattro tre
:Q Quotes every shell meta-character in the variable, so that it can be
passed safely through recursive invocations of bmake.
passed safely to the shell.
:q Quotes every shell meta-character in the variable, and also doubles
`$' characters so that it can be passed safely through recursive
invocations of bmake. This is equivalent to: `:S/\$/&&/g:Q'.
:R Replaces each word in the variable with everything but its suffix.
@ -903,7 +908,15 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
contain the pattern matching character % then it is assumed that
they are anchored at the end of each word, so only suffixes or
entire words may be replaced. Otherwise % is the substring of
old_string to be replaced in new_string.
old_string to be replaced in new_string. If only old_string con-
tains the pattern matching character %, and old_string matches, then
the result is the new_string. If only the new_string contains the
pattern matching character %, then it is not treated specially and
it is printed as a literal % on match. If there is more than one
pattern matching character (%) in either the new_string or
old_string, only the first instance is treated specially (as the
pattern character); all subsequent instances are treated as regular
characters
Variable expansion occurs in the normal fashion inside both
old_string and new_string with the single exception that a backslash
@ -1003,7 +1016,9 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
`:[2..-1]' selects all words from the second word to the last
word. If start is greater than end, then the words are out-
put in reverse order. For example, `:[-1..1]' selects all
the words from last to first.
the words from last to first. If the list is already
ordered, then this effectively reverses the list, but it is
more efficient to use `:Or' instead of `:O:[-1..1]'.
* Causes subsequent modifiers to treat the value as a single
word (possibly containing embedded white space). Analogous
@ -1021,7 +1036,7 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
Makefile inclusion, conditional structures and for loops reminiscent of
the C programming language are provided in bmake. All such structures
are identified by a line beginning with a single dot (`.') character.
Files are included with either .include <file> or .include "file". Vari-
Files are included with either .include <file> or .include "file". Vari-
ables between the angle brackets or double quotes are expanded to form
the file name. If angle brackets are used, the included makefile is
expected to be in the system makefile directory. If double quotes are
@ -1184,7 +1199,7 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
the ``make'' or ``defined'' expression is applied to it, depending on the
form of the conditional. If the form is `.ifdef', `.ifndef', or `.if'
the ``defined'' expression is applied. Similarly, if the form is
`.ifmake' or `.ifnmake, the' ``make'' expression is applied.
`.ifmake' or `.ifnmake', the ``make'' expression is applied.
If the conditional evaluates to true the parsing of the makefile contin-
ues as before. If it evaluates to false, the following lines are
@ -1533,12 +1548,12 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1)
creates an ``FRC'' file).
BUGS
The make syntax is difficult to parse without actually acting of the
data. For instance finding the end of a variable use should involve
scanning each the modifiers using the correct terminator for each field.
In many places make just counts {} and () in order to find the end of a
variable expansion.
The make syntax is difficult to parse without actually acting on the
data. For instance, finding the end of a variable's use should involve
scanning each of the modifiers, using the correct terminator for each
field. In many places make just counts {} and () in order to find the
end of a variable expansion.
There is no way of escaping a space character in a filename.
FreeBSD 11.1 June 22, 2017 FreeBSD 11.1
FreeBSD 11.3 June 5, 2020 FreeBSD 11.3

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 79 KiB

221
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bmake 20200418.
# Generated by GNU Autoconf 2.69 for bmake 20200524.
#
# Report bugs to <sjg@NetBSD.org>.
#
@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bmake'
PACKAGE_TARNAME='bmake'
PACKAGE_VERSION='20200418'
PACKAGE_STRING='bmake 20200418'
PACKAGE_VERSION='20200524'
PACKAGE_STRING='bmake 20200524'
PACKAGE_BUGREPORT='sjg@NetBSD.org'
PACKAGE_URL=''
@ -1254,7 +1254,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 20200418 to adapt to many kinds of systems.
\`configure' configures bmake 20200524 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1315,7 +1315,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bmake 20200418:";;
short | recursive ) echo "Configuration of bmake 20200524:";;
esac
cat <<\_ACEOF
@ -1421,7 +1421,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bmake configure 20200418
bmake configure 20200524
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2001,7 +2001,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 20200418, which was
It was created by bmake $as_me 20200524, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2409,6 +2409,10 @@ if test "${with_filemon+set}" = set; then :
*/filemon*) filemon_h="${withval}/filemon.h";;
*) as_fn_error $? "bad value ${withval} given for filemon" "$LINENO" 5 ;;
esac
case "$use_filemon,$filemon_h" in
,*.h) use_filemon=dev;;
esac
else
case "$OS" in
@ -4228,47 +4232,182 @@ 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
if test $ac_cv_c_compiler_gnu = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
$as_echo_n "checking whether $CC needs -traditional... " >&6; }
if ${ac_cv_prog_gcc_traditional+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
if ${ac_cv_prog_cc_c99+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_pattern="Autoconf.*'x'"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
ac_cv_prog_cc_c99=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sgtty.h>
Autoconf TIOCGETP
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <wchar.h>
#include <stdio.h>
// Check varargs macros. These examples are taken from C99 6.10.3.5.
#define debug(...) fprintf (stderr, __VA_ARGS__)
#define showlist(...) puts (#__VA_ARGS__)
#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
static void
test_varargs_macros (void)
{
int x = 1234;
int y = 5678;
debug ("Flag");
debug ("X = %d\n", x);
showlist (The first, second, and third items.);
report (x>y, "x is %d but y is %d", x, y);
}
// Check long long types.
#define BIG64 18446744073709551615ull
#define BIG32 4294967295ul
#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
#if !BIG_OK
your preprocessor is broken;
#endif
#if BIG_OK
#else
your preprocessor is broken;
#endif
static long long int bignum = -9223372036854775807LL;
static unsigned long long int ubignum = BIG64;
struct incomplete_array
{
int datasize;
double data[];
};
struct named_init {
int number;
const wchar_t *name;
double average;
};
typedef const char *ccp;
static inline int
test_restrict (ccp restrict text)
{
// See if C++-style comments work.
// Iterate through items via the restricted pointer.
// Also check for declarations in for loops.
for (unsigned int i = 0; *(text+i) != '\0'; ++i)
continue;
return 0;
}
// Check varargs and va_copy.
static void
test_varargs (const char *format, ...)
{
va_list args;
va_start (args, format);
va_list args_copy;
va_copy (args_copy, args);
const char *str;
int number;
float fnumber;
while (*format)
{
switch (*format++)
{
case 's': // string
str = va_arg (args_copy, const char *);
break;
case 'd': // int
number = va_arg (args_copy, int);
break;
case 'f': // float
fnumber = va_arg (args_copy, double);
break;
default:
break;
}
}
va_end (args_copy);
va_end (args);
}
int
main ()
{
// Check bool.
_Bool success = false;
// Check restrict.
if (test_restrict ("String literal") == 0)
success = true;
char *restrict newvar = "Another string";
// Check varargs.
test_varargs ("s, d' f .", "string", 65, 34.234);
test_varargs_macros ();
// Check flexible array members.
struct incomplete_array *ia =
malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
ia->datasize = 10;
for (int i = 0; i < ia->datasize; ++i)
ia->data[i] = i * 1.234;
// Check named initializers.
struct named_init ni = {
.number = 34,
.name = L"Test wide string",
.average = 543.34343,
};
ni.number = 58;
int dynamic_array[ni.number];
dynamic_array[ni.number - 1] = 543;
// work around unused variable warnings
return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
|| dynamic_array[ni.number - 1] != 543);
;
return 0;
}
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "$ac_pattern" >/dev/null 2>&1; then :
ac_cv_prog_gcc_traditional=yes
else
ac_cv_prog_gcc_traditional=no
for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
do
CC="$ac_save_CC $ac_arg"
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c99=$ac_arg
fi
rm -f conftest*
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c99" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c99" in
x)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
xno)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c99"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c99" != xno; then :
if test $ac_cv_prog_gcc_traditional = no; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <termio.h>
Autoconf TCGETA
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "$ac_pattern" >/dev/null 2>&1; then :
ac_cv_prog_gcc_traditional=yes
fi
rm -f conftest*
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5
$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
if test $ac_cv_prog_gcc_traditional = yes; then
CC="$CC -traditional"
fi
fi
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@ -6639,7 +6778,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 20200418, which was
This file was extended by bmake $as_me 20200524, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6701,7 +6840,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bmake config.status 20200418
bmake config.status 20200524
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -1,11 +1,11 @@
dnl
dnl RCSid:
dnl $Id: configure.in,v 1.63 2020/04/19 05:17:57 sjg Exp $
dnl $Id: configure.in,v 1.65 2020/05/25 01:11:40 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ(2.50)
AC_INIT([bmake], [20200418], [sjg@NetBSD.org])
AC_INIT([bmake], [20200524], [sjg@NetBSD.org])
AC_CONFIG_HEADERS(config.h)
dnl make srcdir absolute
@ -60,7 +60,11 @@ AC_ARG_WITH(filemon,
*/filemon.h) filemon_h="${withval}";;
*/filemon*) filemon_h="${withval}/filemon.h";;
*) AC_MSG_ERROR(bad value ${withval} given for filemon) ;;
esac],
esac
case "$use_filemon,$filemon_h" in
,*.h) use_filemon=dev;;
esac
],
[
case "$OS" in
NetBSD) filemon_h=no use_filemon=ktrace;;
@ -100,7 +104,8 @@ dnl see _EXTENSIONS_ we use it.
AC_USE_SYSTEM_EXTENSIONS
dnl Checks for programs.
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
AC_PROG_CC_C99
dnl AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
dnl Executable suffix - normally empty; .exe on os2.
AC_SUBST(ac_exe_suffix)dnl

31
dir.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $ */
/* $NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 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: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $";
static char rcsid[] = "$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
__RCSID("$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $");
__RCSID("$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -263,7 +263,8 @@ static char *DirLookupAbs(Path *, const char *, const char *);
* mtime and mode are all we care about.
*/
struct cache_st {
time_t mtime;
time_t lmtime; /* lstat */
time_t mtime; /* stat */
mode_t mode;
};
@ -287,13 +288,15 @@ cached_stats(Hash_Table *htp, const char *pathname, struct stat *st, int flags)
cst = entry->clientPtr;
memset(st, 0, sizeof(*st));
st->st_mtime = cst->mtime;
st->st_mode = cst->mode;
if (DEBUG(DIR)) {
fprintf(debug_file, "Using cached time %s for %s\n",
Targ_FmtTime(st->st_mtime), pathname);
st->st_mtime = (flags & CST_LSTAT) ? cst->lmtime : cst->mtime;
if (st->st_mtime) {
if (DEBUG(DIR)) {
fprintf(debug_file, "Using cached time %s for %s\n",
Targ_FmtTime(st->st_mtime), pathname);
}
return 0;
}
return 0;
}
rc = (flags & CST_LSTAT) ? lstat(pathname, st) : stat(pathname, st);
@ -305,10 +308,16 @@ cached_stats(Hash_Table *htp, const char *pathname, struct stat *st, int flags)
if (!entry)
entry = Hash_CreateEntry(htp, pathname, NULL);
if (!entry->clientPtr)
if (!entry->clientPtr) {
entry->clientPtr = bmake_malloc(sizeof(*cst));
memset(entry->clientPtr, 0, sizeof(*cst));
}
cst = entry->clientPtr;
cst->mtime = st->st_mtime;
if ((flags & CST_LSTAT)) {
cst->lmtime = st->st_mtime;
} else {
cst->mtime = st->st_mtime;
}
cst->mode = st->st_mode;
if (DEBUG(DIR)) {
fprintf(debug_file, " Caching %s for %s\n",

View File

@ -39,7 +39,6 @@
__RCSID("$NetBSD: dirname.c,v 1.14 2018/09/27 00:45:34 kre Exp $");
#endif /* !LIBC_SCCS && !lint */
#include "namespace.h"
#include <sys/param.h>
#ifdef HAVE_LIBGEN_H
#include <libgen.h>

17
make.1
View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.280 2020/04/27 20:03:08 christos Exp $
.\" $NetBSD: make.1,v 1.282 2020/06/06 20:28:42 wiz 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 April 27, 2020
.Dd June 5, 2020
.Dt MAKE 1
.Os
.Sh NAME
@ -1196,10 +1196,8 @@ but selects all words which do not match
.Ar pattern .
.It Cm \&:O
Order every word in variable alphabetically.
To sort words in
reverse order use the
.Ql Cm \&:O:[-1..1]
combination of modifiers.
.It Cm \&:Or
Order every word in variable in reverse alphabetical order.
.It Cm \&:Ox
Randomize words in variable.
The results will be different each time you are referring to the
@ -1433,7 +1431,7 @@ If only
.Ar old_string
contains the pattern matching character
.Ar % ,
and
and
.Ar old_string
matches, then the result is the
.Ar new_string .
@ -1614,6 +1612,11 @@ then the words are output in reverse order.
For example,
.Ql Cm \&:[-1..1]
selects all the words from last to first.
If the list is already ordered, then this effectively reverses
the list, but it is more efficient to use
.Ql Cm \&:Or
instead of
.Ql Cm \&:O:[-1..1] .
.\" :[*]
.It Cm \&*
Causes subsequent modifiers to treat the value as a single word

View File

@ -1,3 +1,20 @@
2020-06-06 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20200606
* dirdeps-targets.mk: allow for filtering of .TARGETS
* meta2deps.py: fix bug in processing 'L'ink and 'M'ove
entries - and we don't care about 'W'rite entries.
Also ignore absolute paths that do not exist.
2020-05-25 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20200525
* init.mk: expand and simplify handling of qualified vars
like CPPFLAGS.${.TARGET:T}
2020-05-15 Simon J Gerraty <sjg@beast.crufty.net>
* install-mk (MK_VERSION): 20200515

View File

@ -1,7 +1,7 @@
# RCSid:
# $Id: dirdeps-targets.mk,v 1.9 2019/10/06 20:07:50 sjg Exp $
# $Id: dirdeps-targets.mk,v 1.10 2020/06/06 22:41:02 sjg Exp $
#
# @(#) Copyright (c) 2019 Simon J. Gerraty
# @(#) Copyright (c) 2019-2020 Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
@ -37,8 +37,11 @@ DIRDEPS_TARGETS_DIRS ?= targets targets/pseudo
# they need to be stripped when looking for target dirs
DIRDEPS_TARGETS_PREFIX_LIST ?= pkg- build-
# some .TARGETS need filtering
DIRDEPS_TARGETS_FILTER += Nall
# matching target dirs if any
tdirs := ${.TARGETS:Nall:${DIRDEPS_TARGETS_PREFIX_LIST:@p@S,^$p,,@:ts:}:@t@${DIRDEPS_TARGETS_DIRS:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@}
tdirs := ${.TARGETS:${DIRDEPS_TARGETS_FILTER:ts:}:${DIRDEPS_TARGETS_PREFIX_LIST:@p@S,^$p,,@:ts:}:@t@${DIRDEPS_TARGETS_DIRS:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@}
.if !empty(DEBUG_DIRDEPS_TARGETS)
.info tdirs=${tdirs}

View File

@ -1,4 +1,4 @@
# $Id: init.mk,v 1.16 2019/09/28 16:54:02 sjg Exp $
# $Id: init.mk,v 1.17 2020/05/25 20:15:07 sjg Exp $
#
# @(#) Copyright (c) 2002, Simon J. Gerraty
#
@ -36,8 +36,27 @@ CXX_SUFFIXES?= .cc .cpp .cxx .C
.include <warnings.mk>
.endif
.for x in COPTS CPPFLAGS CPUFLAGS LDFLAGS
$x += ${$x.${COMPILER_TYPE}:U} ${$x.${.IMPSRC:T}:U}
# these are applied in order, least specific to most
VAR_QUALIFIER_LIST += \
${TARGET_SPEC_VARS:UMACHINE:@v@${$v}@} \
${COMPILER_TYPE} \
${.TARGET:T:R} \
${.TARGET:T} \
${.IMPSRC:T} \
${VAR_QUALIFIER_XTRA_LIST}
QUALIFIED_VAR_LIST += \
CFLAGS \
COPTS \
CPPFLAGS \
CPUFLAGS \
LDFLAGS \
# a final :U avoids errors if someone uses :=
.for V in ${QUALIFIED_VAR_LIST:O:u:@q@$q $q_LAST@}
.for Q in ${VAR_QUALIFIER_LIST:u}
$V += ${$V.$Q:U} ${$V.$Q.${COMPILER_TYPE}:U}
.endfor
.endfor
CC_PG?= -pg

View File

@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>
# RCSid:
# $Id: install-mk,v 1.170 2020/05/15 21:40:24 sjg Exp $
# $Id: install-mk,v 1.172 2020/06/06 22:41:15 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@ -70,7 +70,7 @@
# sjg@crufty.net
#
MK_VERSION=20200515
MK_VERSION=20200606
OWNER=
GROUP=
MODE=444

View File

@ -37,7 +37,7 @@ We only pay attention to a subset of the information in the
"""
RCSid:
$Id: meta2deps.py,v 1.28 2020/05/16 23:21:48 sjg Exp $
$Id: meta2deps.py,v 1.30 2020/06/08 23:05:00 sjg Exp $
Copyright (c) 2011-2019, Simon J. Gerraty
Copyright (c) 2011-2017, Juniper Networks, Inc.
@ -81,7 +81,11 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
if path.endswith('/.'):
path = path[0:-2]
if len(path) > 0 and path[0] == '/':
return path
if os.path.exists(path):
return path
if debug > 2:
print("skipping non-existent:", path, file=debug_out)
return None
if path == '.':
return cwd
if path.startswith('./'):
@ -139,6 +143,8 @@ def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
rpath = resolve(path, cwd, last_dir, debug, debug_out)
if rpath:
path = rpath
elif len(path) > 0 and path[0] == '/':
return None
if (path.find('/') < 0 or
path.find('./') > 0 or
path.endswith('/..')):
@ -475,6 +481,10 @@ class MetaFile:
continue
elif w[0] == 'C':
cwd = abspath(w[2], cwd, None, self.debug, self.debug_out)
if not cwd:
cwd = w[2]
if self.debug > 1:
print("missing cwd=", cwd, file=self.debug_out)
if cwd.endswith('/.'):
cwd = cwd[0:-2]
self.last_dir = pid_last_dir[pid] = cwd
@ -491,8 +501,8 @@ class MetaFile:
if w[0] in 'ML':
# these are special, tread src as read and
# target as write
self.parse_path(w[1].strip("'"), cwd, 'R', w)
self.parse_path(w[2].strip("'"), cwd, 'W', w)
self.parse_path(w[2].strip("'"), cwd, 'R', w)
self.parse_path(w[3].strip("'"), cwd, 'W', w)
continue
elif w[0] in 'ERWS':
path = w[2]
@ -563,7 +573,7 @@ class MetaFile:
print("ldir=", self.last_dir, file=self.debug_out)
return
if op in 'ERW':
if op in 'ER':
# finally, we get down to it
if dir == self.cwd or dir == self.curdir:
return

18
var.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.223 2020/04/25 18:20:57 christos Exp $ */
/* $NetBSD: var.c,v 1.224 2020/06/05 19:20:46 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.223 2020/04/25 18:20:57 christos Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.224 2020/06/05 19:20:46 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.223 2020/04/25 18:20:57 christos Exp $");
__RCSID("$NetBSD: var.c,v 1.224 2020/06/05 19:20:46 sjg Exp $");
#endif
#endif /* not lint */
#endif
@ -2027,6 +2027,13 @@ VarWordCompare(const void *a, const void *b)
return r;
}
static int
VarWordCompareReverse(const void *a, const void *b)
{
int r = strcmp(*(const char * const *)b, *(const char * const *)a);
return r;
}
/*-
*-----------------------------------------------------------------------
* VarOrder --
@ -2058,6 +2065,9 @@ VarOrder(const char *str, const char otype)
if (ac > 0)
switch (otype) {
case 'r': /* reverse sort alphabetically */
qsort(av, ac, sizeof(char *), VarWordCompareReverse);
break;
case 's': /* sort alphabetically */
qsort(av, ac, sizeof(char *), VarWordCompare);
break;
@ -3562,7 +3572,7 @@ ApplyModifiers(char *nstr, const char *tstr,
if (tstr[1] == endc || tstr[1] == ':') {
otype = 's';
termc = *cp;
} else if ( (tstr[1] == 'x') &&
} else if ( (tstr[1] == 'r' || tstr[1] == 'x') &&
(tstr[2] == endc || tstr[2] == ':') ) {
otype = tstr[1];
cp = tstr + 2;