From owner-svn-src-all@freebsd.org Mon Jul 20 00:17:10 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B823436E278; Mon, 20 Jul 2020 00:17:10 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B92NQ4j7cz4F7L; Mon, 20 Jul 2020 00:17:10 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 843702419C; Mon, 20 Jul 2020 00:17:10 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06K0HAHE089952; Mon, 20 Jul 2020 00:17:10 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06K0H8OH089941; Mon, 20 Jul 2020 00:17:08 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202007200017.06K0H8OH089941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 20 Jul 2020 00:17:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363352 - in stable/12: contrib/bmake contrib/bmake/filemon contrib/bmake/lst.lib contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/12: contrib/bmake contrib/bmake/filemon contrib/bmake/lst.lib contrib/bmake/mk contrib/bmake/mk/sys contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests X-SVN-Commit-Revision: 363352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2020 00:17:10 -0000 Author: sjg Date: Mon Jul 20 00:17:08 2020 New Revision: 363352 URL: https://svnweb.freebsd.org/changeset/base/363352 Log: Update to bmake-20200710 Key changes include reduced noise at end of failed build log and avoid evaluation of unnecessary terms in conditionals. In META MODE; a target flagged .META is out-of-date if meta file is missing MFC of r361986, r363117 Added: stable/12/contrib/bmake/unit-tests/cond-short.exp stable/12/contrib/bmake/unit-tests/cond-short.mk (contents, props changed) stable/12/usr.bin/bmake/unit-tests/Makefile.config (contents, props changed) Modified: stable/12/contrib/bmake/ChangeLog stable/12/contrib/bmake/FILES stable/12/contrib/bmake/Makefile stable/12/contrib/bmake/VERSION stable/12/contrib/bmake/arch.c stable/12/contrib/bmake/bmake.1 stable/12/contrib/bmake/bmake.cat1 stable/12/contrib/bmake/buf.c stable/12/contrib/bmake/compat.c stable/12/contrib/bmake/cond.c stable/12/contrib/bmake/configure stable/12/contrib/bmake/configure.in stable/12/contrib/bmake/dir.c stable/12/contrib/bmake/dirname.c stable/12/contrib/bmake/filemon/filemon_dev.c stable/12/contrib/bmake/for.c stable/12/contrib/bmake/hash.c stable/12/contrib/bmake/hash.h stable/12/contrib/bmake/job.c stable/12/contrib/bmake/job.h stable/12/contrib/bmake/lst.lib/lstAppend.c stable/12/contrib/bmake/lst.lib/lstAtEnd.c stable/12/contrib/bmake/lst.lib/lstAtFront.c stable/12/contrib/bmake/lst.lib/lstClose.c stable/12/contrib/bmake/lst.lib/lstConcat.c stable/12/contrib/bmake/lst.lib/lstDatum.c stable/12/contrib/bmake/lst.lib/lstDeQueue.c stable/12/contrib/bmake/lst.lib/lstDupl.c stable/12/contrib/bmake/lst.lib/lstEnQueue.c stable/12/contrib/bmake/lst.lib/lstFind.c stable/12/contrib/bmake/lst.lib/lstFindFrom.c stable/12/contrib/bmake/lst.lib/lstFirst.c stable/12/contrib/bmake/lst.lib/lstForEach.c stable/12/contrib/bmake/lst.lib/lstForEachFrom.c stable/12/contrib/bmake/lst.lib/lstInit.c stable/12/contrib/bmake/lst.lib/lstInsert.c stable/12/contrib/bmake/lst.lib/lstIsAtEnd.c stable/12/contrib/bmake/lst.lib/lstIsEmpty.c stable/12/contrib/bmake/lst.lib/lstLast.c stable/12/contrib/bmake/lst.lib/lstNext.c stable/12/contrib/bmake/lst.lib/lstOpen.c stable/12/contrib/bmake/lst.lib/lstPrev.c stable/12/contrib/bmake/lst.lib/lstRemove.c stable/12/contrib/bmake/lst.lib/lstReplace.c stable/12/contrib/bmake/lst.lib/lstSucc.c stable/12/contrib/bmake/main.c stable/12/contrib/bmake/make.1 stable/12/contrib/bmake/make.c stable/12/contrib/bmake/make.h stable/12/contrib/bmake/make_malloc.c stable/12/contrib/bmake/meta.c stable/12/contrib/bmake/meta.h stable/12/contrib/bmake/mk/ChangeLog stable/12/contrib/bmake/mk/FILES stable/12/contrib/bmake/mk/dirdeps-targets.mk stable/12/contrib/bmake/mk/dirdeps.mk stable/12/contrib/bmake/mk/gendirdeps.mk stable/12/contrib/bmake/mk/host-target.mk stable/12/contrib/bmake/mk/init.mk stable/12/contrib/bmake/mk/install-mk stable/12/contrib/bmake/mk/meta2deps.py stable/12/contrib/bmake/mk/mkopt.sh stable/12/contrib/bmake/mk/sys/AIX.mk stable/12/contrib/bmake/mk/sys/Darwin.mk stable/12/contrib/bmake/mk/sys/Generic.mk stable/12/contrib/bmake/mk/sys/HP-UX.mk stable/12/contrib/bmake/mk/sys/IRIX.mk stable/12/contrib/bmake/mk/sys/Linux.mk stable/12/contrib/bmake/mk/sys/NetBSD.mk stable/12/contrib/bmake/mk/sys/OSF1.mk stable/12/contrib/bmake/mk/sys/OpenBSD.mk stable/12/contrib/bmake/mk/sys/SunOS.mk stable/12/contrib/bmake/mk/sys/UnixWare.mk stable/12/contrib/bmake/nonints.h stable/12/contrib/bmake/parse.c stable/12/contrib/bmake/str.c stable/12/contrib/bmake/suff.c stable/12/contrib/bmake/targ.c stable/12/contrib/bmake/trace.c stable/12/contrib/bmake/unit-tests/Makefile stable/12/contrib/bmake/unit-tests/modmatch.mk stable/12/contrib/bmake/unit-tests/modmisc.exp stable/12/contrib/bmake/unit-tests/modmisc.mk stable/12/contrib/bmake/unit-tests/modorder.exp stable/12/contrib/bmake/unit-tests/modorder.mk stable/12/contrib/bmake/unit-tests/sysv.exp stable/12/contrib/bmake/unit-tests/sysv.mk stable/12/contrib/bmake/unit-tests/varmisc.exp stable/12/contrib/bmake/unit-tests/varmisc.mk stable/12/contrib/bmake/util.c stable/12/contrib/bmake/var.c stable/12/usr.bin/bmake/Makefile stable/12/usr.bin/bmake/Makefile.config stable/12/usr.bin/bmake/config.h stable/12/usr.bin/bmake/unit-tests/Makefile Modified: stable/12/contrib/bmake/ChangeLog ============================================================================== --- stable/12/contrib/bmake/ChangeLog Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/ChangeLog Mon Jul 20 00:17:08 2020 (r363352) @@ -1,3 +1,120 @@ +2020-07-10 Simon J Gerraty + + * configure.in: use AC_INCLUDES_DEFAULT rather than AC_HEADER_STDC + + * VERSION (_MAKE_VERSION): 20200710 + Merge with NetBSD make, pick up + o filemon/filemon_dev.c: use O_CLOEXEC rather than extra syscall + o meta.c: target flagged .META is out-of-date if meta file missing + +2020-07-09 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200709 + Merge with NetBSD make, pick up + o cond.c: fix for compare_expression when doEval=0 + o unit-tests/Makefile: rework + o filemon/filemon_dev.c: ensure filemon fd is closed on exec. + +2020-07-04 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200704 + Merge with NetBSD make, pick up + (most of this by rillig@) + o lots of style and white-space cleanup + o lots more unit tests for variable modifiers + o simplified description of some functions + o str.c: refactor Str_Match + o var.c: debugging output for :@ + constify VarModify parameter + fix :hash modifier on 16-bit platforms + remove unnecessary forward declarations + refactor ApplyModifier_SysV to have less indentation + simplify code for :E and :R + clean up code for :H and :T + refactor ApplyModifiers + + * var.c: we need stdint.h on some platforms to get uint32_t + * unit-test/Makefile: we need to supress the specific error + for RE substitution error in modmisc, since it varies accross + different OS. + +2020-07-02 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200702 + Merge with NetBSD make, pick up + o var.c: more improvements to avoiding unnecessary evaluation + use enums for flags + o remove flags arg to Var_Set which outside of var.c is always 0 + +2020-07-01 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200701 + Merge with NetBSD make, pick up + o var.c: with change to cond.c; ensure that nested variables + within a variable name are expanded. + o unit-tests/varmisc.mk: test for nested varname + +2020-06-29 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200629 + Merge with NetBSD make, pick up + o cond.c: do not eval unnecessary terms of conditionals. + +2020-06-25 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200625 + Merge with NetBSD make, pick up + o meta.c: report error if lseek in filemon_read fails + +2020-06-22 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200622 + Merge with NetBSD make, pick up + o dieQuietly: ignore OP_SUBMAKE as too aggressive + +2020-06-19 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200619 + Merge with NetBSD make, pick up + o str.c: performance improvement for Str_Match for multiple '*' + o dieQuietly: supress the failure output from make + when failing node is a sub-make or a sibling failed. + This cuts down greatly on unhelpful noise at the end of + build log. Disabled by -dj or .MAKE.DIE_QUIETLY=no + +2020-06-10 Simon J Gerraty + + * FILES: add LICENSE to appease some packagers. + This is an attempt to fairly represent the license on almost + 200 files, which are almost all BSD-3-Clause + The few exceptions being more liberal. + + * VERSION (_MAKE_VERSION): 20200610 + Merge with NetBSD make, pick up + o unit test for :Or + +2020-06-06 Simon J Gerraty + + * 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 + + * 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 + + * 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 * VERSION (_MAKE_VERSION): 20200517 Modified: stable/12/contrib/bmake/FILES ============================================================================== --- stable/12/contrib/bmake/FILES Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/FILES Mon Jul 20 00:17:08 2020 (r363352) @@ -1,5 +1,6 @@ ChangeLog FILES +LICENSE Makefile Makefile.config.in PSD.doc/Makefile @@ -107,6 +108,8 @@ unit-tests/cond2.exp unit-tests/cond2.mk unit-tests/cond-late.mk unit-tests/cond-late.exp +unit-tests/cond-short.mk +unit-tests/cond-short.exp unit-tests/dollar.exp unit-tests/dollar.mk unit-tests/doterror.exp Modified: stable/12/contrib/bmake/Makefile ============================================================================== --- stable/12/contrib/bmake/Makefile Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/Makefile Mon Jul 20 00:17:08 2020 (r363352) @@ -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 Modified: stable/12/contrib/bmake/VERSION ============================================================================== --- stable/12/contrib/bmake/VERSION Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/VERSION Mon Jul 20 00:17:08 2020 (r363352) @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20200517 +_MAKE_VERSION=20200710 Modified: stable/12/contrib/bmake/arch.c ============================================================================== --- stable/12/contrib/bmake/arch.c Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/arch.c Mon Jul 20 00:17:08 2020 (r363352) @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $ */ +/* $NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $"; +static char rcsid[] = "$NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: arch.c,v 1.71 2019/10/05 23:35:57 mrg Exp $"); +__RCSID("$NetBSD: arch.c,v 1.73 2020/07/03 08:02:55 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -312,7 +312,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * free(freeIt); if (result == var_Error) { - return(FAILURE); + return FAILURE; } else { subLibName = TRUE; } @@ -354,7 +354,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * free(freeIt); if (result == var_Error) { - return(FAILURE); + return FAILURE; } else { doSubst = TRUE; } @@ -372,7 +372,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * */ if (*cp == '\0') { printf("No closing parenthesis in archive specification\n"); - return (FAILURE); + return FAILURE; } /* @@ -426,7 +426,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * if (gn == NULL) { free(buf); - return(FAILURE); + return FAILURE; } else { gn->type |= OP_ARCHV; (void)Lst_AtEnd(nodeLst, gn); @@ -437,7 +437,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * * ourselves. */ free(buf); - return(FAILURE); + return FAILURE; } /* * Free buffer and continue with our work. @@ -461,7 +461,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * gn = Targ_FindNode(nameBuf, TARG_CREATE); if (gn == NULL) { free(nameBuf); - return (FAILURE); + return FAILURE; } else { /* * We've found the node, but have to make sure the rest of @@ -483,7 +483,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * gn = Targ_FindNode(nameBuf, TARG_CREATE); free(nameBuf); if (gn == NULL) { - return (FAILURE); + return FAILURE; } else { /* * We've found the node, but have to make sure the rest of the @@ -520,7 +520,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * } while (*cp != '\0' && isspace ((unsigned char)*cp)); *linePtr = cp; - return (SUCCESS); + return SUCCESS; } /*- @@ -544,7 +544,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * static int ArchFindArchive(const void *ar, const void *archName) { - return (strcmp(archName, ((const Arch *)ar)->name)); + return strcmp(archName, ((const Arch *)ar)->name); } /*- @@ -602,7 +602,7 @@ ArchStatMember(char *archive, char *member, Boolean ha he = Hash_FindEntry(&ar->members, member); if (he != NULL) { - return ((struct ar_hdr *)Hash_GetValue(he)); + return (struct ar_hdr *)Hash_GetValue(he); } else { /* Try truncated name */ char copy[AR_MAX_NAME_LEN+1]; @@ -614,7 +614,7 @@ ArchStatMember(char *archive, char *member, Boolean ha copy[AR_MAX_NAME_LEN] = '\0'; } if ((he = Hash_FindEntry(&ar->members, copy)) != NULL) - return ((struct ar_hdr *)Hash_GetValue(he)); + return (struct ar_hdr *)Hash_GetValue(he); return NULL; } } @@ -635,7 +635,7 @@ ArchStatMember(char *archive, char *member, Boolean ha return NULL; } else { fclose(arch); - return (&sarh); + return &sarh; } } @@ -753,7 +753,7 @@ ArchStatMember(char *archive, char *member, Boolean ha he = Hash_FindEntry(&ar->members, member); if (he != NULL) { - return ((struct ar_hdr *)Hash_GetValue(he)); + return (struct ar_hdr *)Hash_GetValue(he); } else { return NULL; } @@ -962,7 +962,7 @@ ArchFindMember(char *archive, char *member, struct ar_ fclose(arch); return NULL; } - return (arch); + return arch; } } else #ifdef AR_EFMT1 @@ -996,7 +996,7 @@ ArchFindMember(char *archive, char *member, struct ar_ fclose(arch); return NULL; } - return (arch); + return arch; } if (fseek(arch, -elen, SEEK_CUR) != 0) { fclose(arch); @@ -1152,7 +1152,7 @@ Arch_MTime(GNode *gn) } gn->mtime = modTime; - return (modTime); + return modTime; } /*- @@ -1179,7 +1179,7 @@ Arch_MemMTime(GNode *gn) if (Lst_Open(gn->parents) != SUCCESS) { gn->mtime = 0; - return (0); + return 0; } while ((ln = Lst_Next(gn->parents)) != NULL) { pgn = (GNode *)Lst_Datum(ln); @@ -1211,7 +1211,7 @@ Arch_MemMTime(GNode *gn) Lst_Close(gn->parents); - return (gn->mtime); + return gn->mtime; } /*- @@ -1252,9 +1252,9 @@ Arch_FindLib(GNode *gn, Lst path) free(libName); #ifdef LIBRARIES - Var_Set(TARGET, gn->name, gn, 0); + Var_Set(TARGET, gn->name, gn); #else - Var_Set(TARGET, gn->path == NULL ? gn->name : gn->path, gn, 0); + Var_Set(TARGET, gn->path == NULL ? gn->name : gn->path, gn); #endif /* LIBRARIES */ } @@ -1337,7 +1337,7 @@ Arch_LibOODate(GNode *gn) oodate = FALSE; #endif } - return (oodate); + return oodate; } /*- Modified: stable/12/contrib/bmake/bmake.1 ============================================================================== --- stable/12/contrib/bmake/bmake.1 Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/bmake.1 Mon Jul 20 00:17:08 2020 (r363352) @@ -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 .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 pat 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 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. Modified: stable/12/contrib/bmake/bmake.cat1 ============================================================================== --- stable/12/contrib/bmake/bmake.cat1 Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/bmake.cat1 Mon Jul 20 00:17:08 2020 (r363352) @@ -779,9 +779,10 @@ BMAKE(1) FreeBSD General Commands Manua 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 with expansion (`:=') to prevent such behavior. For example, @@ -803,8 +804,12 @@ BMAKE(1) FreeBSD General Commands Manua 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. :range[=count] @@ -903,7 +908,15 @@ BMAKE(1) FreeBSD General Commands Manua 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 Manua `:[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 Manua 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 Manua 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 Manua 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 Modified: stable/12/contrib/bmake/buf.c ============================================================================== --- stable/12/contrib/bmake/buf.c Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/buf.c Mon Jul 20 00:17:08 2020 (r363352) @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $ */ +/* $NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: buf.c,v 1.25 2012/04/24 20:26:58 sjg Exp $"); +__RCSID("$NetBSD: buf.c,v 1.26 2020/07/03 08:02:55 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -160,7 +160,7 @@ Buf_GetAll(Buffer *bp, int *numBytesPtr) if (numBytesPtr != NULL) *numBytesPtr = bp->count; - return (bp->buffer); + return bp->buffer; } /*- Modified: stable/12/contrib/bmake/compat.c ============================================================================== --- stable/12/contrib/bmake/compat.c Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/compat.c Mon Jul 20 00:17:08 2020 (r363352) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $ */ +/* $NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.110 2020/01/19 19:42:32 riastradh Exp $"); +__RCSID("$NetBSD: compat.c,v 1.113 2020/07/03 08:13:23 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -236,7 +236,7 @@ CompatRunCommand(void *cmdp, void *gnp) silent = gn->type & OP_SILENT; errCheck = !(gn->type & OP_IGNORE); doIt = FALSE; - + cmdNode = Lst_Member(gn->commands, cmd); cmdStart = Var_Subst(NULL, cmd, gn, VARF_WANTRES); @@ -249,18 +249,18 @@ CompatRunCommand(void *cmdp, void *gnp) if (*cmdStart == '\0') { free(cmdStart); - return(0); + return 0; } cmd = cmdStart; Lst_Replace(cmdNode, cmdStart); if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) { (void)Lst_AtEnd(ENDNode->commands, cmdStart); - return(0); + return 0; } if (strcmp(cmdStart, "...") == 0) { gn->type |= OP_SAVE_CMDS; - return(0); + return 0; } while ((*cmd == '@') || (*cmd == '-') || (*cmd == '+')) { @@ -287,7 +287,7 @@ CompatRunCommand(void *cmdp, void *gnp) * If we did not end up with a command, just skip it. */ if (!*cmd) - return (0); + return 0; #if !defined(MAKE_NATIVE) /* @@ -307,7 +307,7 @@ CompatRunCommand(void *cmdp, void *gnp) * go to the shell. Therefore treat '=' and ':' like shell * meta characters as documented in make(1). */ - + useShell = needshell(cmd, FALSE); #endif @@ -325,7 +325,7 @@ CompatRunCommand(void *cmdp, void *gnp) * we go... */ if (!doIt && NoExecute(gn)) { - return (0); + return 0; } if (DEBUG(JOB)) fprintf(debug_file, "Execute: '%s'\n", cmd); @@ -377,7 +377,7 @@ again: meta_compat_start(); } #endif - + /* * Fork and execute the single command. If the fork fails, we abort. */ @@ -499,8 +499,8 @@ again: bmake_signal(compatSigno, SIG_DFL); kill(myPid, compatSigno); } - - return (status); + + return status; } /*- @@ -550,7 +550,7 @@ Compat_Make(void *gnp, void *pgnp) if (Lst_Member(gn->iParents, pgn) != NULL) { char *p1; - Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); + Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn); free(p1); } @@ -654,7 +654,7 @@ Compat_Make(void *gnp, void *pgnp) } else { if (Lst_Member(gn->iParents, pgn) != NULL) { char *p1; - Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0); + Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn); free(p1); } switch(gn->made) { @@ -681,7 +681,7 @@ Compat_Make(void *gnp, void *pgnp) cohorts: Lst_ForEach(gn->cohorts, Compat_Make, pgnp); - return (0); + return 0; } /*- Modified: stable/12/contrib/bmake/cond.c ============================================================================== --- stable/12/contrib/bmake/cond.c Sun Jul 19 23:56:19 2020 (r363351) +++ stable/12/contrib/bmake/cond.c Mon Jul 20 00:17:08 2020 (r363352) @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $ */ +/* $NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 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.75 2017/04/16 20:59:04 riastradh Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $"); +__RCSID("$NetBSD: cond.c,v 1.79 2020/07/09 22:34:08 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -146,7 +146,7 @@ typedef enum { * last two fields are stored in condInvert and condDefProc, respectively. */ static void CondPushBack(Token); -static int CondGetArg(char **, char **, const char *); +static int CondGetArg(Boolean, char **, char **, const char *); static Boolean CondDoDefined(int, const char *); static int CondStrMatch(const void *, const void *); static Boolean CondDoMake(int, const char *); @@ -186,7 +186,7 @@ static unsigned int cond_min_depth = 0; /* depth at * Indicate when we should be strict about lhs of comparisons. * TRUE when Cond_EvalExpression is called from Cond_Eval (.if etc) * FALSE when Cond_EvalExpression is called from var.c:ApplyModifiers - * since lhs is already expanded and we cannot tell if + * since lhs is already expanded and we cannot tell if * it was a variable reference or not. */ static Boolean lhsStrict; @@ -225,9 +225,6 @@ CondPushBack(Token t) * CondGetArg -- * Find the argument of a built-in function. * - * Input: - * parens TRUE if arg should be bounded by parens - * * Results: * The length of the argument and the address of the argument. * @@ -238,7 +235,7 @@ CondPushBack(Token t) *----------------------------------------------------------------------- */ static int -CondGetArg(char **linePtr, char **argPtr, const char *func) +CondGetArg(Boolean doEval, char **linePtr, char **argPtr, const char *func) { char *cp; int argLen; @@ -259,7 +256,7 @@ CondGetArg(char **linePtr, char **argPtr, const char * * the word 'make' or 'defined' at the beginning of a symbol... */ *argPtr = NULL; - return (0); + return 0; } while (*cp == ' ' || *cp == '\t') { @@ -290,7 +287,8 @@ CondGetArg(char **linePtr, char **argPtr, const char * int len; void *freeIt; - cp2 = Var_Parse(cp, VAR_CMD, VARF_UNDEFERR|VARF_WANTRES, + cp2 = Var_Parse(cp, VAR_CMD, VARF_UNDEFERR| + (doEval ? VARF_WANTRES : 0), &len, &freeIt); Buf_AddBytes(&buf, strlen(cp2), cp2); free(freeIt); @@ -316,11 +314,11 @@ CondGetArg(char **linePtr, char **argPtr, const char * if (func != NULL && *cp++ != ')') { Parse_Error(PARSE_WARNING, "Missing closing parenthesis for %s()", func); - return (0); + return 0; } *linePtr = cp; - return (argLen); + return argLen; } /*- @@ -349,7 +347,7 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char } free(p1); - return (result); + return result; } /*- @@ -369,7 +367,7 @@ CondDoDefined(int argLen MAKE_ATTR_UNUSED, const char static int CondStrMatch(const void *string, const void *pattern) { - return(!Str_Match(string, pattern)); + return !Str_Match(string, pattern); } /*- @@ -414,14 +412,14 @@ CondDoExists(int argLen MAKE_ATTR_UNUSED, const char * if (DEBUG(COND)) { fprintf(debug_file, "exists(%s) result is \"%s\"\n", arg, path ? path : ""); - } + } if (path != NULL) { result = TRUE; free(path); } else { result = FALSE; } - return (result); + return result; } /*- @@ -443,7 +441,7 @@ CondDoTarget(int argLen MAKE_ATTR_UNUSED, const char * GNode *gn; gn = Targ_FindNode(arg, TARG_NOCREATE); - return (gn != NULL) && !OP_NOP(gn->type); + return gn != NULL && !OP_NOP(gn->type); } /*- @@ -467,7 +465,7 @@ CondDoCommands(int argLen MAKE_ATTR_UNUSED, const char GNode *gn; gn = Targ_FindNode(arg, TARG_NOCREATE); - return (gn != NULL) && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands); + return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands); } /*- @@ -577,7 +575,7 @@ CondGetString(Boolean doEval, Boolean *quoted, void ** /* if we are in quotes, then an undefined variable is ok */ str = Var_Parse(condExpr, VAR_CMD, ((!qt && doEval) ? VARF_UNDEFERR : 0) | - VARF_WANTRES, &len, freeIt); + (doEval ? VARF_WANTRES : 0), &len, freeIt); if (str == var_Error) { if (*freeIt) { free(*freeIt); @@ -668,7 +666,7 @@ compare_expression(Boolean doEval) rhs = NULL; lhsFree = rhsFree = FALSE; lhsQuoted = rhsQuoted = FALSE; - + /* * Parse the variable spec and skip over it, saving its * value in lhs. @@ -711,7 +709,7 @@ compare_expression(Boolean doEval) goto done; } /* For .ifxxx compare against zero */ - if (CondCvtArg(lhs, &left)) { + if (CondCvtArg(lhs, &left)) { t = left != 0.0; goto done; } @@ -738,6 +736,11 @@ compare_expression(Boolean doEval) if (!rhs) goto done; + if (!doEval) { + t = TOK_FALSE; + goto done; + } + if (rhsQuoted || lhsQuoted) { do_string_compare: if (((*op != '!') && (*op != '=')) || (op[1] != '=')) { @@ -764,7 +767,7 @@ do_string_compare: * rhs is either a float or an integer. Convert both the * lhs and the rhs to a double and compare the two. */ - + if (!CondCvtArg(lhs, &left) || !CondCvtArg(rhs, &right)) goto do_string_compare; @@ -813,7 +816,7 @@ done: } static int -get_mpt_arg(char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED) +get_mpt_arg(Boolean doEval, char **linePtr, char **argPtr, const char *func MAKE_ATTR_UNUSED) { /* * Use Var_Parse to parse the spec in parens and return @@ -827,7 +830,7 @@ get_mpt_arg(char **linePtr, char **argPtr, const char /* We do all the work here and return the result as the length */ *argPtr = NULL; - val = Var_Parse(cp - 1, VAR_CMD, VARF_WANTRES, &length, &freeIt); + val = Var_Parse(cp - 1, VAR_CMD, doEval ? VARF_WANTRES : 0, &length, &freeIt); /* * Advance *linePtr to beyond the closing ). Note that * we subtract one because 'length' is calculated from 'cp - 1'. @@ -864,7 +867,7 @@ compare_function(Boolean doEval) static const struct fn_def { const char *fn_name; int fn_name_len; - int (*fn_getarg)(char **, char **, const char *); + int (*fn_getarg)(Boolean, char **, char **, const char *); Boolean (*fn_proc)(int, const char *); } fn_defs[] = { { "defined", 7, CondGetArg, CondDoDefined }, @@ -892,7 +895,7 @@ compare_function(Boolean doEval) if (*cp != '(') break; - arglen = fn_def->fn_getarg(&cp, &arg, fn_def->fn_name); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***