CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Jul 11 20:09:16 UTC 2024 Modified Files: src/usr.bin/make: compat.c main.c make.h src/usr.bin/make/unit-tests: var-op-shell.mk Log Message: Compat_RunCommand use tempfile if cmd too big Extract the logic recently added to Cmd_Exec to handle long commands via temp file to Cmd_Argv, so it can also be leveraged by Compat_RunCommand Reviewed by: christos To generate a diff of this commit: cvs rdiff -u -r1.259 -r1.260 src/usr.bin/make/compat.c cvs rdiff -u -r1.631 -r1.632 src/usr.bin/make/main.c cvs rdiff -u -r1.343 -r1.344 src/usr.bin/make/make.h cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/var-op-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.259 src/usr.bin/make/compat.c:1.260 --- src/usr.bin/make/compat.c:1.259 Sat Jun 15 20:02:45 2024 +++ src/usr.bin/make/compat.c Thu Jul 11 20:09:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.259 2024/06/15 20:02:45 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.260 2024/07/11 20:09:16 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.259 2024/06/15 20:02:45 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.260 2024/07/11 20:09:16 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -246,6 +246,8 @@ Compat_RunCommand(const char *cmdp, GNod bool useShell; /* True if command should be executed using a * shell */ const char *cmd = cmdp; + char cmd_file[MAXPATHLEN]; + size_t cmd_len; silent = (gn->type & OP_SILENT) != OP_NONE; errCheck = !(gn->type & OP_IGNORE); @@ -316,20 +318,20 @@ Compat_RunCommand(const char *cmdp, GNod DEBUG1(JOB, "Execute: '%s'\n", cmd); - if (useShell && shellPath == NULL) - Shell_Init(); /* we need shellPath */ + cmd_len = strlen(cmd); + if (cmd_len > MAKE_CMDLEN_LIMIT) + useShell = true; + else + cmd_file[0] = '\0'; if (useShell) { static const char *shargv[5]; - /* The following work for any of the builtin shell specs. */ - int shargc = 0; - shargv[shargc++] = shellPath; - if (errCheck && shellErrFlag != NULL) - shargv[shargc++] = shellErrFlag; - shargv[shargc++] = DEBUG(SHELL) ? "-xc" : "-c"; - shargv[shargc++] = cmd; - shargv[shargc] = NULL; + if (Cmd_Argv(cmd, cmd_len, shargv, 5, + cmd_file, sizeof(cmd_file), + (errCheck && shellErrFlag != NULL), + DEBUG(SHELL)) < 0) + Fatal("cannot run \"%s\"", cmd); av = shargv; bp = NULL; mav = NULL; @@ -422,6 +424,8 @@ Compat_RunCommand(const char *cmdp, GNod } free(cmdStart); + if (cmd_file[0] != '\0') + unlink(cmd_file); compatChild = 0; if (compatSigno != 0) { bmake_signal(compatSigno, SIG_DFL); Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.631 src/usr.bin/make/main.c:1.632 --- src/usr.bin/make/main.c:1.631 Tue Jul 9 19:43:01 2024 +++ src/usr.bin/make/main.c Thu Jul 11 20:09:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.631 2024/07/09 19:43:01 rillig Exp $ */ +/* $NetBSD: main.c,v 1.632 2024/07/11 20:09:16 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.631 2024/07/09 19:43:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.632 2024/07/11 20:09:16 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1685,6 +1685,56 @@ found: return true; } +/* populate av for Cmd_Exec and Compat_RunCommand */ +int +Cmd_Argv(const char *cmd, size_t cmd_len, const char **av, size_t avsz, +char *cmd_file, size_t cmd_filesz, bool eflag, bool xflag) +{ + int ac = 0; + int cmd_fd = -1; + + if (shellPath == NULL) + Shell_Init(); + + if (cmd_file != NULL) { + if (cmd_len == 0) + cmd_len = strlen(cmd); + + if (cmd_len > MAKE_CMDLEN_LIMIT) { + cmd_fd = mkTempFile(NULL, cmd_file, cmd_filesz); + if (cmd_fd >= 0) { +ssize_t n; + +n = write(cmd_fd, cmd, cmd_len); +close(cmd_fd); +if (n < (ssize_t)cmd_len) { + unlink(cmd_file); + cmd_fd = -1; +} + } + } else + cmd_file[0] = '\0'; + } + + if (avsz < 4 || (eflag && avsz < 5)) + return -1; + + /* The following works for any of the builtin shell specs. */ + av[ac++] = shellPath; + if (eflag) + av[ac++] = shellErrFlag; + if (cmd_fd >= 0) { + if (xflag) + av[ac++] = "-x"; + av[ac++] = cmd_file; + } else { + av[ac++] = xflag ? "-xc" : "-c"; + av[ac++] = cmd; + } + av[ac] = NULL; + return ac; +} + /* * Execute the command in cmd, and return its output (only stdout, not * stderr, possibly empty). In the output, replace newlines with spaces. @@ -1703,40 +1753,11 @@
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Jul 11 20:09:16 UTC 2024 Modified Files: src/usr.bin/make: compat.c main.c make.h src/usr.bin/make/unit-tests: var-op-shell.mk Log Message: Compat_RunCommand use tempfile if cmd too big Extract the logic recently added to Cmd_Exec to handle long commands via temp file to Cmd_Argv, so it can also be leveraged by Compat_RunCommand Reviewed by: christos To generate a diff of this commit: cvs rdiff -u -r1.259 -r1.260 src/usr.bin/make/compat.c cvs rdiff -u -r1.631 -r1.632 src/usr.bin/make/main.c cvs rdiff -u -r1.343 -r1.344 src/usr.bin/make/make.h cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/var-op-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon Jul 1 21:02:26 UTC 2024 Modified Files: src/usr.bin/make: make.1 var.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: varmod-to-title.exp varmod-to-title.mk Log Message: make: add :tc to capitalize first letter of each word This is very hard to do without :tc Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/make.1 cvs rdiff -u -r1.1125 -r1.1126 src/usr.bin/make/var.c cvs rdiff -u -r1.347 -r1.348 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varmod-to-title.exp \ src/usr.bin/make/unit-tests/varmod-to-title.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.377 src/usr.bin/make/make.1:1.378 --- src/usr.bin/make/make.1:1.377 Sat Jun 1 06:26:36 2024 +++ src/usr.bin/make/make.1 Mon Jul 1 21:02:26 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.377 2024/06/01 06:26:36 sjg Exp $ +.\" $NetBSD: make.1,v 1.378 2024/07/01 21:02:26 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd June 1, 2024 +.Dd July 1, 2024 .Dt MAKE 1 .Os .Sh NAME @@ -1574,6 +1574,9 @@ If .Ar c is omitted, no separator is used. The common escapes (including octal numeric codes) work as expected. +.It Cm \&:tt +Converts the first character of each word to upper-case, +and the rest to lower-case letters. .It Cm \&:tu Converts the value to upper-case letters. .It Cm \&:tW Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1125 src/usr.bin/make/var.c:1.1126 --- src/usr.bin/make/var.c:1.1125 Sun Jun 30 15:21:23 2024 +++ src/usr.bin/make/var.c Mon Jul 1 21:02:26 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1125 2024/06/30 15:21:23 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1126 2024/07/01 21:02:26 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1125 2024/06/30 15:21:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1126 2024/07/01 21:02:26 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3142,6 +3142,21 @@ ok: } static char * +str_totitle(const char *str) +{ + size_t i, n = strlen(str) + 1; + char *res = bmake_malloc(n); + for (i = 0; i < n; i++) { + if (i == 0 || ch_isspace(res[i - 1])) + res[i] = ch_toupper(str[i]); + else + res[i] = ch_tolower(str[i]); + } + return res; +} + + +static char * str_toupper(const char *str) { size_t i, n = strlen(str) + 1; @@ -3188,6 +3203,13 @@ ApplyModifier_To(const char **pp, ModCha return AMR_OK; } + if (mod[1] == 't') {/* :tt */ + *pp = mod + 2; + if (Expr_ShouldEval(expr)) + Expr_SetValueOwn(expr, str_totitle(Expr_Str(expr))); + return AMR_OK; + } + if (mod[1] == 'u') {/* :tu */ *pp = mod + 2; if (Expr_ShouldEval(expr)) Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.347 src/usr.bin/make/unit-tests/Makefile:1.348 --- src/usr.bin/make/unit-tests/Makefile:1.347 Sat Jun 1 15:54:40 2024 +++ src/usr.bin/make/unit-tests/Makefile Mon Jul 1 21:02:26 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.347 2024/06/01 15:54:40 sjg Exp $ +# $NetBSD: Makefile,v 1.348 2024/07/01 21:02:26 sjg Exp $ # # Unit tests for make(1) # @@ -397,6 +397,7 @@ TESTS+= varmod-to-lower TESTS+= varmod-to-many-words TESTS+= varmod-to-one-word TESTS+= varmod-to-separator +TESTS+= varmod-to-title TESTS+= varmod-to-upper TESTS+= varmod-undefined TESTS+= varmod-unique Added files: Index: src/usr.bin/make/unit-tests/varmod-to-title.exp diff -u /dev/null src/usr.bin/make/unit-tests/varmod-to-title.exp:1.1 --- /dev/null Mon Jul 1 21:02:26 2024 +++ src/usr.bin/make/unit-tests/varmod-to-title.exp Mon Jul 1 21:02:26 2024 @@ -0,0 +1 @@ +exit status 0 Index: src/usr.bin/make/unit-tests/varmod-to-title.mk diff -u /dev/null src/usr.bin/make/unit-tests/varmod-to-title.mk:1.1 --- /dev/null Mon Jul 1 21:02:26 2024 +++ src/usr.bin/make/unit-tests/varmod-to-title.mk Mon Jul 1 21:02:26 2024 @@ -0,0 +1,31 @@ +# $NetBSD: varmod-to-title.mk,v 1.1 2024/07/01 21:02:26 sjg Exp $ +# +# Tests for the :tc variable modifier, which converts the expression value +# to lowercase. +# +# TODO: What about non-ASCII characters? ISO-8859-1, UTF-8? + +.if ${:UUPPER:tt} != "Upper" +. error +.endif + +.if ${:Ulower:tt} != "Lower" +. error +.endif + +.if ${:UMixeD case.:tt} != "Mixed Case." +. error +.endif + +# The ':tt' modifier works on the whole string, without splitting it into +# words. +.if ${:Umultiple spaces:tt} != "Multiple Spaces" +. error +.endif + +# Note words only
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon Jul 1 21:02:26 UTC 2024 Modified Files: src/usr.bin/make: make.1 var.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: varmod-to-title.exp varmod-to-title.mk Log Message: make: add :tc to capitalize first letter of each word This is very hard to do without :tc Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/make.1 cvs rdiff -u -r1.1125 -r1.1126 src/usr.bin/make/var.c cvs rdiff -u -r1.347 -r1.348 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varmod-to-title.exp \ src/usr.bin/make/unit-tests/varmod-to-title.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Mon Jun 3 02:46:29 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: varmod-undefined.mk Log Message: Note that varmod-undefined depends on .MAKE.SAVE_DOLLARS=yes To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-undefined.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/varmod-undefined.mk diff -u src/usr.bin/make/unit-tests/varmod-undefined.mk:1.10 src/usr.bin/make/unit-tests/varmod-undefined.mk:1.11 --- src/usr.bin/make/unit-tests/varmod-undefined.mk:1.10 Sun Jun 2 17:44:48 2024 +++ src/usr.bin/make/unit-tests/varmod-undefined.mk Mon Jun 3 02:46:29 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-undefined.mk,v 1.10 2024/06/02 17:44:48 rillig Exp $ +# $NetBSD: varmod-undefined.mk,v 1.11 2024/06/03 02:46:29 sjg Exp $ # # Tests for the :U variable modifier, which returns the given string # if the variable is undefined. @@ -7,6 +7,9 @@ # directive-for.mk # varmod-defined.mk +# this test depends on +.MAKE.SAVE_DOLLARS= yes + # The pattern ${:Uword} is heavily used when expanding .for loops. # # This is how an expanded .for loop looks like.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Mon Jun 3 02:46:29 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: varmod-undefined.mk Log Message: Note that varmod-undefined depends on .MAKE.SAVE_DOLLARS=yes To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-undefined.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sat Jun 1 15:54:41 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: Run check-expect.lua in .CURDIR To generate a diff of this commit: cvs rdiff -u -r1.346 -r1.347 src/usr.bin/make/unit-tests/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.346 src/usr.bin/make/unit-tests/Makefile:1.347 --- src/usr.bin/make/unit-tests/Makefile:1.346 Sat Jun 1 10:06:23 2024 +++ src/usr.bin/make/unit-tests/Makefile Sat Jun 1 15:54:40 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.346 2024/06/01 10:06:23 rillig Exp $ +# $NetBSD: Makefile,v 1.347 2024/06/01 15:54:40 sjg Exp $ # # Unit tests for make(1) # @@ -776,7 +776,7 @@ test: ${OUTFILES} .PHONY lua=${LUA:Ulua} ; \ have_lua=$$("$$lua" -e 'print "yes"' 2>&1) ; \ if [ "$$have_lua" = "yes" ]; then \ - "$$lua" ./check-expect.lua *.mk; \ + (cd ${.CURDIR} && "$$lua" ./check-expect.lua *.mk); \ fi; \ fi
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sat Jun 1 15:54:41 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: Run check-expect.lua in .CURDIR To generate a diff of this commit: cvs rdiff -u -r1.346 -r1.347 src/usr.bin/make/unit-tests/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Jun 1 07:37:19 UTC 2024 Modified Files: src/usr.bin/make: main.c Log Message: make: ensure loop termination in purge_relative_cached_realpaths You cannot ignore the return from HashIter_Next To generate a diff of this commit: cvs rdiff -u -r1.619 -r1.620 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.619 src/usr.bin/make/main.c:1.620 --- src/usr.bin/make/main.c:1.619 Fri May 31 05:50:11 2024 +++ src/usr.bin/make/main.c Sat Jun 1 07:37:19 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.619 2024/05/31 05:50:11 rillig Exp $ */ +/* $NetBSD: main.c,v 1.620 2024/06/01 07:37:19 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.619 2024/05/31 05:50:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.620 2024/06/01 07:37:19 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1971,12 +1971,13 @@ static void purge_relative_cached_realpaths(void) { HashIter hi; + bool more; HashIter_Init(, _realpaths); - HashIter_Next(); - while (hi.entry != NULL) { + more = HashIter_Next(); + while (more) { HashEntry *he = hi.entry; - HashIter_Next(); + more = HashIter_Next(); if (he->key[0] != '/') { DEBUG1(DIR, "cached_realpath: purging %s\n", he->key); HashTable_DeleteEntry(_realpaths, he);
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Jun 1 07:37:19 UTC 2024 Modified Files: src/usr.bin/make: main.c Log Message: make: ensure loop termination in purge_relative_cached_realpaths You cannot ignore the return from HashIter_Next To generate a diff of this commit: cvs rdiff -u -r1.619 -r1.620 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Jun 1 06:26:36 UTC 2024 Modified Files: src/usr.bin/make: make.1 make.h parse.c var.c src/usr.bin/make/unit-tests: directive-export.exp directive-export.mk export-all.mk Log Message: make: add .export-all An explicit syntax for exporting all global variables is much safer than allowing .export with no argument to do the same. Add .export-all and have .export with no argument throw a warning saying to use .export-all Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/make.1 cvs rdiff -u -r1.336 -r1.337 src/usr.bin/make/make.h cvs rdiff -u -r1.728 -r1.729 src/usr.bin/make/parse.c cvs rdiff -u -r1.1116 -r1.1117 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-export.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/directive-export.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/export-all.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Jun 1 06:26:36 UTC 2024 Modified Files: src/usr.bin/make: make.1 make.h parse.c var.c src/usr.bin/make/unit-tests: directive-export.exp directive-export.mk export-all.mk Log Message: make: add .export-all An explicit syntax for exporting all global variables is much safer than allowing .export with no argument to do the same. Add .export-all and have .export with no argument throw a warning saying to use .export-all Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/make.1 cvs rdiff -u -r1.336 -r1.337 src/usr.bin/make/make.h cvs rdiff -u -r1.728 -r1.729 src/usr.bin/make/parse.c cvs rdiff -u -r1.1116 -r1.1117 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-export.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/directive-export.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/export-all.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.376 src/usr.bin/make/make.1:1.377 --- src/usr.bin/make/make.1:1.376 Tue May 28 19:09:04 2024 +++ src/usr.bin/make/make.1 Sat Jun 1 06:26:36 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.376 2024/05/28 19:09:04 sjg Exp $ +.\" $NetBSD: make.1,v 1.377 2024/06/01 06:26:36 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd May 28, 2024 +.Dd June 1, 2024 .Dt MAKE 1 .Os .Sh NAME @@ -1960,12 +1960,7 @@ The directives for exporting and unexpor .Bl -tag -width Ds .It Ic .export Ar variable No ... Export the specified global variable. -If no variable list is provided, all globals are exported -except for internal variables (those that start with -.Ql \&. ) . -This is not affected by the -.Fl X -flag, so should be used with caution. +.Pp For compatibility with other make programs, .Cm export Ar variable\| Ns Cm \&= Ns Ar value (without leading dot) is also accepted. @@ -1973,6 +1968,12 @@ For compatibility with other make progra Appending a variable name to .Va .MAKE.EXPORTED is equivalent to exporting a variable. +.It Ic .export-all +Export all globals except for internal variables (those that start with +.Ql \&. ) . +This is not affected by the +.Fl X +flag, so should be used with caution. .It Ic .export-env Ar variable No ... The same as .Ql .export , Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.336 src/usr.bin/make/make.h:1.337 --- src/usr.bin/make/make.h:1.336 Sat Jun 1 05:08:48 2024 +++ src/usr.bin/make/make.h Sat Jun 1 06:26:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.336 2024/06/01 05:08:48 rillig Exp $ */ +/* $NetBSD: make.h,v 1.337 2024/06/01 06:26:36 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -992,6 +992,8 @@ typedef enum VarSetFlags { } VarSetFlags; typedef enum VarExportMode { + /* .export-all */ + VEM_ALL, /* .export-env */ VEM_ENV, /* .export: Initial export or update an already exported variable. */ Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.728 src/usr.bin/make/parse.c:1.729 --- src/usr.bin/make/parse.c:1.728 Fri May 31 05:50:11 2024 +++ src/usr.bin/make/parse.c Sat Jun 1 06:26:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.728 2024/05/31 05:50:11 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.729 2024/06/01 06:26:36 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,7 +105,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.728 2024/05/31 05:50:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.729 2024/06/01 06:26:36 sjg Exp $"); /* Detects a multiple-inclusion guard in a makefile. */ typedef enum { @@ -2759,6 +2759,8 @@ ParseDirective(char *line) Var_Undef(arg); else if (Substring_Equals(dir, "export")) Var_Export(VEM_PLAIN, arg); + else if (Substring_Equals(dir, "export-all")) + Var_Export(VEM_ALL, arg); else if (Substring_Equals(dir, "export-env")) Var_Export(VEM_ENV, arg); else if (Substring_Equals(dir, "export-literal")) Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1116 src/usr.bin/make/var.c:1.1117 --- src/usr.bin/make/var.c:1.1116 Sat Jun 1 05:08:48 2024 +++ src/usr.bin/make/var.c Sat Jun 1 06:26:36 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1116 2024/06/01 05:08:48 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1117 2024/06/01 06:26:36 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1116 2024/06/01 05:08:48 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1117 2024/06/01 06:26:36 sjg Exp $"); /* * Variables are defined using one of the
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue May 28 19:09:04 UTC 2024 Modified Files: src/usr.bin/make: main.c make.1 Log Message: make: allow debugging the warning about .OBJDIR When make complains about an unwritable .OBJDIR it is not always obvious how we derrived that value. If MAKE_DEBUG_OBJDIR_CHECK_WRITABLE is enabled call PrintOnError so we can examine variables that are likely relevant. Fix description of MAKE_OBJDIR_CHECK_WRITABLE in make.1 To generate a diff of this commit: cvs rdiff -u -r1.617 -r1.618 src/usr.bin/make/main.c cvs rdiff -u -r1.375 -r1.376 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.617 src/usr.bin/make/main.c:1.618 --- src/usr.bin/make/main.c:1.617 Fri May 24 23:02:46 2024 +++ src/usr.bin/make/main.c Tue May 28 19:09:04 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.617 2024/05/24 23:02:46 rillig Exp $ */ +/* $NetBSD: main.c,v 1.618 2024/05/28 19:09:04 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.617 2024/05/24 23:02:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.618 2024/05/28 19:09:04 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -739,6 +739,10 @@ Main_SetObjdir(bool writable, const char if ((writable && access(path, W_OK) != 0) || chdir(path) != 0) { (void)fprintf(stderr, "%s: warning: %s: %s.\n", progname, path, strerror(errno)); + /* Allow debugging how we got here - not always obvious */ + if (GetBooleanExpr("${MAKE_DEBUG_OBJDIR_CHECK_WRITABLE}", + false)) + PrintOnError(NULL, ""); return false; } Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.375 src/usr.bin/make/make.1:1.376 --- src/usr.bin/make/make.1:1.375 Sun Mar 10 02:53:37 2024 +++ src/usr.bin/make/make.1 Tue May 28 19:09:04 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.375 2024/03/10 02:53:37 sjg Exp $ +.\" $NetBSD: make.1,v 1.376 2024/05/28 19:09:04 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd March 9, 2024 +.Dd May 28, 2024 .Dt MAKE 1 .Os .Sh NAME @@ -1143,9 +1143,19 @@ This mode can be used to detect undeclar Used to create files in a separate directory, see .Va .OBJDIR . .It Va MAKE_OBJDIR_CHECK_WRITABLE -Used to force a separate directory for the created files, -even if that directory is not writable, see -.Va .OBJDIR . +When true, +.Nm +will check that +.Va .OBJDIR +is writable, and issue a warning if not. +.It Va MAKE_DEBUG_OBJDIR_CHECK_WRITABLE +When true and +.Nm +is warning about an unwritable +.Va .OBJDIR , +report the variables listed in +.Va MAKE_PRINT_VAR_ON_ERROR +to help debug. .It Va MAKEOBJDIRPREFIX Used to create files in a separate directory, see .Va .OBJDIR .
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue May 28 19:09:04 UTC 2024 Modified Files: src/usr.bin/make: main.c make.1 Log Message: make: allow debugging the warning about .OBJDIR When make complains about an unwritable .OBJDIR it is not always obvious how we derrived that value. If MAKE_DEBUG_OBJDIR_CHECK_WRITABLE is enabled call PrintOnError so we can examine variables that are likely relevant. Fix description of MAKE_OBJDIR_CHECK_WRITABLE in make.1 To generate a diff of this commit: cvs rdiff -u -r1.617 -r1.618 src/usr.bin/make/main.c cvs rdiff -u -r1.375 -r1.376 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon May 20 19:14:12 UTC 2024 Modified Files: src/usr.bin/make: dir.c Log Message: make: cleanup style in FindFile Since we removed the last check for isinclude, restore to the previous indentation etc. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.289 -r1.290 src/usr.bin/make/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.289 src/usr.bin/make/dir.c:1.290 --- src/usr.bin/make/dir.c:1.289 Mon May 20 16:04:46 2024 +++ src/usr.bin/make/dir.c Mon May 20 19:14:12 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.289 2024/05/20 16:04:46 sjg Exp $ */ +/* $NetBSD: dir.c,v 1.290 2024/05/20 19:14:12 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -132,7 +132,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.289 2024/05/20 16:04:46 sjg Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.290 2024/05/20 19:14:12 sjg Exp $"); /* * A search path is a list of CachedDir structures. A CachedDir has in it the @@ -1206,8 +1206,7 @@ FindFile(const char *name, SearchPath *p return file; } - if (seenDotLast - && (file = DirFindDot(name, base)) != NULL) + if (seenDotLast && (file = DirFindDot(name, base)) != NULL) return file; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon May 20 19:14:12 UTC 2024 Modified Files: src/usr.bin/make: dir.c Log Message: make: cleanup style in FindFile Since we removed the last check for isinclude, restore to the previous indentation etc. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.289 -r1.290 src/usr.bin/make/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/usr.bin/make
Taylor R Campbell wrote: > Can you please back this out promptly, add automatic tests for > whatever the underlying issue is, and redo it another way? I did a scan of miss-use of <>, and looks like libc might have an issue: lib/libc/arch/arm/Makefile.inc:28:.include expects to find lib/libc/softfloat/Makefile.inc via .CURDIR, so have re-enabled that search.
Re: CVS commit: src/usr.bin/make
Taylor R Campbell wrote: > > --- cleandir-libterminfo --- > nbmake[5]: "/tmp/build/2024.05.19.20.09.40-i386/src/lib/libterminfo/Makefile" > line 50: Could not find Makefile.hash > > Can you please back this out promptly, add automatic tests for > whatever the underlying issue is, and redo it another way? Sorry, for the break. The makefile in lib/libterminfo was using <> when it should use "". Martin already fixed it. I'm checking for similar
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon May 20 16:04:46 UTC 2024 Modified Files: src/usr.bin/make: dir.c Log Message: Allow .include <> to search .CURDIR last libc at least appears to depend on this. To generate a diff of this commit: cvs rdiff -u -r1.288 -r1.289 src/usr.bin/make/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.288 src/usr.bin/make/dir.c:1.289 --- src/usr.bin/make/dir.c:1.288 Sun May 19 20:09:40 2024 +++ src/usr.bin/make/dir.c Mon May 20 16:04:46 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.288 2024/05/19 20:09:40 sjg Exp $ */ +/* $NetBSD: dir.c,v 1.289 2024/05/20 16:04:46 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -132,7 +132,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.288 2024/05/19 20:09:40 sjg Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.289 2024/05/20 16:04:46 sjg Exp $"); /* * A search path is a list of CachedDir structures. A CachedDir has in it the @@ -1206,7 +1206,7 @@ FindFile(const char *name, SearchPath *p return file; } - if (!isinclude && seenDotLast + if (seenDotLast && (file = DirFindDot(name, base)) != NULL) return file; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Mon May 20 16:04:46 UTC 2024 Modified Files: src/usr.bin/make: dir.c Log Message: Allow .include <> to search .CURDIR last libc at least appears to depend on this. To generate a diff of this commit: cvs rdiff -u -r1.288 -r1.289 src/usr.bin/make/dir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun May 19 20:09:40 UTC 2024 Modified Files: src/usr.bin/make: dir.c dir.h parse.c Log Message: make: use separate function to include makefiles. Have Dir_FindFile and Dir_FindInclude call FindFile with a bool flag to indicate whether .CURDIR should be be searched at all. To generate a diff of this commit: cvs rdiff -u -r1.287 -r1.288 src/usr.bin/make/dir.c cvs rdiff -u -r1.47 -r1.48 src/usr.bin/make/dir.h cvs rdiff -u -r1.722 -r1.723 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.287 src/usr.bin/make/dir.c:1.288 --- src/usr.bin/make/dir.c:1.287 Sun May 19 17:55:54 2024 +++ src/usr.bin/make/dir.c Sun May 19 20:09:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.287 2024/05/19 17:55:54 sjg Exp $ */ +/* $NetBSD: dir.c,v 1.288 2024/05/19 20:09:40 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -132,7 +132,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.287 2024/05/19 17:55:54 sjg Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.288 2024/05/19 20:09:40 sjg Exp $"); /* * A search path is a list of CachedDir structures. A CachedDir has in it the @@ -1144,15 +1144,16 @@ found: * Input: * name the file to find * path the directories to search, or NULL + * isinclude if true, do not search .CURDIR at all * * Results: * The freshly allocated path to the file, or NULL. */ -char * -Dir_FindFile(const char *name, SearchPath *path) +static char * +FindFile(const char *name, SearchPath *path, bool isinclude) { char *file; /* the current filename to check */ - bool seenDotLast = false; /* true if we should search dot last */ + bool seenDotLast = isinclude; /* true if we should search dot last */ struct cached_stat cst; const char *trailing_dot = "."; const char *base = str_basename(name); @@ -1165,9 +1166,7 @@ Dir_FindFile(const char *name, SearchPat return NULL; } - if (path == sysIncPath || path == defSysIncPath) - seenDotLast = true; - else if (path->dirs.first != NULL) { + if (!seenDotLast && path->dirs.first != NULL) { CachedDir *dir = path->dirs.first->datum; if (dir == dotLast) { seenDotLast = true; @@ -1207,7 +1206,8 @@ Dir_FindFile(const char *name, SearchPat return file; } - if (seenDotLast && (file = DirFindDot(name, base)) != NULL) + if (!isinclude && seenDotLast + && (file = DirFindDot(name, base)) != NULL) return file; } @@ -1248,6 +1248,38 @@ Dir_FindFile(const char *name, SearchPat return NULL; } +/* + * Find the file with the given name along the given search path. + * + * Input: + * name the file to find + * path the directories to search, or NULL + * + * Results: + * The freshly allocated path to the file, or NULL. + */ +char * +Dir_FindFile(const char *name, SearchPath *path) +{ + return FindFile(name, path, false); +} + +/* + * Find the include file with the given name along the given search path. + * + * Input: + * name the file to find + * path the directories to search, or NULL + * + * Results: + * The freshly allocated path to the file, or NULL. + */ +char * +Dir_FindInclude(const char *name, SearchPath *path) +{ + return FindFile(name, path, true); +} + /* * Search for 'needle' starting at the directory 'here' and then working our Index: src/usr.bin/make/dir.h diff -u src/usr.bin/make/dir.h:1.47 src/usr.bin/make/dir.h:1.48 --- src/usr.bin/make/dir.h:1.47 Tue Jan 24 00:24:02 2023 +++ src/usr.bin/make/dir.h Sun May 19 20:09:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.47 2023/01/24 00:24:02 sjg Exp $ */ +/* $NetBSD: dir.h,v 1.48 2024/05/19 20:09:40 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -86,6 +86,7 @@ void Dir_SetSYSPATH(void); bool Dir_HasWildcards(const char *) MAKE_ATTR_USE; void SearchPath_Expand(SearchPath *, const char *, StringList *); char *Dir_FindFile(const char *, SearchPath *) MAKE_ATTR_USE; +char *Dir_FindInclude(const char *, SearchPath *) MAKE_ATTR_USE; char *Dir_FindHereOrAbove(const char *, const char *) MAKE_ATTR_USE; void Dir_UpdateMTime(GNode *, bool); CachedDir *SearchPath_Add(SearchPath *, const char *); Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.722 src/usr.bin/make/parse.c:1.723 --- src/usr.bin/make/parse.c:1.722 Sat Apr 27 17:33:46 2024 +++ src/usr.bin/make/parse.c Sun May 19 20:09:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.722 2024/04/27 17:33:46 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.723 2024/05/19 20:09:40 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,7 +105,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.722 2024/04/27 17:33:46 rillig Exp $"); +MAKE_RCSID("$NetBSD:
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun May 19 20:09:40 UTC 2024 Modified Files: src/usr.bin/make: dir.c dir.h parse.c Log Message: make: use separate function to include makefiles. Have Dir_FindFile and Dir_FindInclude call FindFile with a bool flag to indicate whether .CURDIR should be be searched at all. To generate a diff of this commit: cvs rdiff -u -r1.287 -r1.288 src/usr.bin/make/dir.c cvs rdiff -u -r1.47 -r1.48 src/usr.bin/make/dir.h cvs rdiff -u -r1.722 -r1.723 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun May 19 17:55:55 UTC 2024 Modified Files: src/usr.bin/make: dir.c main.c src/usr.bin/make/unit-tests: deptgt-phony.exp Log Message: Dir_FindFile treat sysIncPath and defSysIncPath as special Rather than play games with adding .DOTLAST and then having to exclude that from .SYSPATH, just have Dir_FindFile check if path is sysIncPath or defSysIncPath and behave as if .DOTLAST seen and also skip the final search of .CURDIR. Fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty. To generate a diff of this commit: cvs rdiff -u -r1.286 -r1.287 src/usr.bin/make/dir.c cvs rdiff -u -r1.615 -r1.616 src/usr.bin/make/main.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/deptgt-phony.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun May 19 17:55:55 UTC 2024 Modified Files: src/usr.bin/make: dir.c main.c src/usr.bin/make/unit-tests: deptgt-phony.exp Log Message: Dir_FindFile treat sysIncPath and defSysIncPath as special Rather than play games with adding .DOTLAST and then having to exclude that from .SYSPATH, just have Dir_FindFile check if path is sysIncPath or defSysIncPath and behave as if .DOTLAST seen and also skip the final search of .CURDIR. Fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty. To generate a diff of this commit: cvs rdiff -u -r1.286 -r1.287 src/usr.bin/make/dir.c cvs rdiff -u -r1.615 -r1.616 src/usr.bin/make/main.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/deptgt-phony.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.286 src/usr.bin/make/dir.c:1.287 --- src/usr.bin/make/dir.c:1.286 Fri Dec 29 18:53:24 2023 +++ src/usr.bin/make/dir.c Sun May 19 17:55:54 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.286 2023/12/29 18:53:24 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.287 2024/05/19 17:55:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -132,7 +132,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.286 2023/12/29 18:53:24 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.287 2024/05/19 17:55:54 sjg Exp $"); /* * A search path is a list of CachedDir structures. A CachedDir has in it the @@ -566,10 +566,12 @@ void Dir_SetSYSPATH(void) { CachedDirListNode *ln; - + SearchPath *path = Lst_IsEmpty(>dirs) + ? defSysIncPath : sysIncPath; + Var_ReadOnly(".SYSPATH", false); Global_Delete(".SYSPATH"); - for (ln = sysIncPath->dirs.first; ln != NULL; ln = ln->next) { + for (ln = path->dirs.first; ln != NULL; ln = ln->next) { CachedDir *dir = ln->datum; Global_Append(".SYSPATH", dir->name); } @@ -1163,7 +1165,9 @@ Dir_FindFile(const char *name, SearchPat return NULL; } - if (path->dirs.first != NULL) { + if (path == sysIncPath || path == defSysIncPath) + seenDotLast = true; + else if (path->dirs.first != NULL) { CachedDir *dir = path->dirs.first->datum; if (dir == dotLast) { seenDotLast = true; Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.615 src/usr.bin/make/main.c:1.616 --- src/usr.bin/make/main.c:1.615 Tue May 7 18:26:22 2024 +++ src/usr.bin/make/main.c Sun May 19 17:55:54 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.615 2024/05/07 18:26:22 sjg Exp $ */ +/* $NetBSD: main.c,v 1.616 2024/05/19 17:55:54 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.615 2024/05/07 18:26:22 sjg Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.616 2024/05/19 17:55:54 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1156,8 +1156,6 @@ InitDefSysIncPath(char *syspath) else syspath = bmake_strdup(syspath); - /* do NOT search .CURDIR first for .include */ - SearchPath_Add(defSysIncPath, ".DOTLAST"); for (start = syspath; *start != '\0'; start = p) { for (p = start; *p != '\0' && *p != ':'; p++) continue; Index: src/usr.bin/make/unit-tests/deptgt-phony.exp diff -u src/usr.bin/make/unit-tests/deptgt-phony.exp:1.4 src/usr.bin/make/unit-tests/deptgt-phony.exp:1.5 --- src/usr.bin/make/unit-tests/deptgt-phony.exp:1.4 Tue Apr 30 16:41:32 2024 +++ src/usr.bin/make/unit-tests/deptgt-phony.exp Sun May 19 17:55:54 2024 @@ -2,7 +2,7 @@ Expanding "depsrc-phony-pr-15164-*-wildc Expanding "deptgt-phony-pr-15164-*-wildcard"... Searching for .depend ... failed. -Searching for .depend ...[dot last]... +Searching for .depend ... ... failed. Wildcard expanding "all"...
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue May 7 18:26:22 UTC 2024 Modified Files: src/usr.bin/make: job.c main.c make.h var.c src/usr.bin/make/unit-tests: opt-debug-graph1.exp opt-debug-graph2.exp opt-debug-graph3.exp suff-main-several.exp suff-transform-debug.exp varname-dot-makeoverrides.exp varname-dot-makeoverrides.mk Log Message: make: all command line overrides go in .MAKEOVERRIDES Not all variables that start with '.' are internals, and unless they are explicitly flagged as internal should go into .MAKEOVERRIDES Update varname-dot-makeoverrides to check this. Also avoid using SCOPE_CMDLINE when ReadOnly will do. To generate a diff of this commit: cvs rdiff -u -r1.470 -r1.471 src/usr.bin/make/job.c cvs rdiff -u -r1.614 -r1.615 src/usr.bin/make/main.c cvs rdiff -u -r1.332 -r1.333 src/usr.bin/make/make.h cvs rdiff -u -r1.1108 -r1.1109 src/usr.bin/make/var.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/opt-debug-graph1.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \ src/usr.bin/make/unit-tests/opt-debug-graph3.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/suff-main-several.exp cvs rdiff -u -r1.3 -r1.4 \ src/usr.bin/make/unit-tests/varname-dot-makeoverrides.exp cvs rdiff -u -r1.5 -r1.6 \ src/usr.bin/make/unit-tests/varname-dot-makeoverrides.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.470 src/usr.bin/make/job.c:1.471 --- src/usr.bin/make/job.c:1.470 Sat Apr 27 20:41:32 2024 +++ src/usr.bin/make/job.c Tue May 7 18:26:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.470 2024/04/27 20:41:32 rillig Exp $ */ +/* $NetBSD: job.c,v 1.471 2024/05/07 18:26:22 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.470 2024/04/27 20:41:32 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.471 2024/05/07 18:26:22 sjg Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -2155,7 +2155,8 @@ Shell_Init(void) if (shellPath == NULL) InitShellNameAndPath(); - Var_SetWithFlags(SCOPE_CMDLINE, ".SHELL", shellPath, VAR_SET_READONLY); + Var_SetWithFlags(SCOPE_CMDLINE, ".SHELL", shellPath, + VAR_SET_INTERNAL|VAR_SET_READONLY); if (shell->errFlag == NULL) shell->errFlag = ""; if (shell->echoFlag == NULL) Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.614 src/usr.bin/make/main.c:1.615 --- src/usr.bin/make/main.c:1.614 Tue Apr 30 16:13:33 2024 +++ src/usr.bin/make/main.c Tue May 7 18:26:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.614 2024/04/30 16:13:33 sjg Exp $ */ +/* $NetBSD: main.c,v 1.615 2024/05/07 18:26:22 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.614 2024/04/30 16:13:33 sjg Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.615 2024/05/07 18:26:22 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1389,7 +1389,7 @@ main_Init(int argc, char **argv) Global_Set(".MAKEOVERRIDES", ""); Global_Set("MFLAGS", ""); Global_Set(".ALLTARGETS", ""); - Var_Set(SCOPE_CMDLINE, ".MAKE.LEVEL.ENV", MAKE_LEVEL_ENV); + Global_Set_ReadOnly(".MAKE.LEVEL.ENV", MAKE_LEVEL_ENV); /* Set some other useful variables. */ { Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.332 src/usr.bin/make/make.h:1.333 --- src/usr.bin/make/make.h:1.332 Sat Apr 27 20:41:32 2024 +++ src/usr.bin/make/make.h Tue May 7 18:26:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.332 2024/04/27 20:41:32 rillig Exp $ */ +/* $NetBSD: make.h,v 1.333 2024/05/07 18:26:22 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -990,7 +990,8 @@ typedef enum VarSetFlags { * except for another call to Var_Set with the same flag. See the * special targets '.NOREADONLY' and '.READONLY'. */ - VAR_SET_READONLY = 1 << 1 + VAR_SET_READONLY = 1 << 1, + VAR_SET_INTERNAL = 1 << 2 } VarSetFlags; typedef enum VarExportMode { Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1108 src/usr.bin/make/var.c:1.1109 --- src/usr.bin/make/var.c:1.1108 Sun Apr 28 15:10:19 2024 +++ src/usr.bin/make/var.c Tue May 7 18:26:22 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1108 2024/04/28 15:10:19 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1109 2024/05/07 18:26:22 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -132,7 +132,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1108 2024/04/28
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue May 7 18:26:22 UTC 2024 Modified Files: src/usr.bin/make: job.c main.c make.h var.c src/usr.bin/make/unit-tests: opt-debug-graph1.exp opt-debug-graph2.exp opt-debug-graph3.exp suff-main-several.exp suff-transform-debug.exp varname-dot-makeoverrides.exp varname-dot-makeoverrides.mk Log Message: make: all command line overrides go in .MAKEOVERRIDES Not all variables that start with '.' are internals, and unless they are explicitly flagged as internal should go into .MAKEOVERRIDES Update varname-dot-makeoverrides to check this. Also avoid using SCOPE_CMDLINE when ReadOnly will do. To generate a diff of this commit: cvs rdiff -u -r1.470 -r1.471 src/usr.bin/make/job.c cvs rdiff -u -r1.614 -r1.615 src/usr.bin/make/main.c cvs rdiff -u -r1.332 -r1.333 src/usr.bin/make/make.h cvs rdiff -u -r1.1108 -r1.1109 src/usr.bin/make/var.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/opt-debug-graph1.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \ src/usr.bin/make/unit-tests/opt-debug-graph3.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/suff-main-several.exp cvs rdiff -u -r1.3 -r1.4 \ src/usr.bin/make/unit-tests/varname-dot-makeoverrides.exp cvs rdiff -u -r1.5 -r1.6 \ src/usr.bin/make/unit-tests/varname-dot-makeoverrides.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Tue Apr 30 16:41:33 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: Makefile deptgt-phony.exp Log Message: Subst DEFSYSPATH in deptgt-phony To generate a diff of this commit: cvs rdiff -u -r1.343 -r1.344 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/deptgt-phony.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.343 src/usr.bin/make/unit-tests/Makefile:1.344 --- src/usr.bin/make/unit-tests/Makefile:1.343 Sat Apr 20 10:18:55 2024 +++ src/usr.bin/make/unit-tests/Makefile Tue Apr 30 16:41:32 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.343 2024/04/20 10:18:55 rillig Exp $ +# $NetBSD: Makefile,v 1.344 2024/04/30 16:41:32 sjg Exp $ # # Unit tests for make(1) # @@ -589,8 +589,9 @@ unexport-env.rawout: export.mk # In tests that use the debugging option -dd, ignore debugging output that is # only logged in -DCLEANUP mode. -STD_SED_CMDS.dd= -e '/^OpenDirs_Done:/d' -STD_SED_CMDS.dd+= -e '/^CachedDir /d' +STD_SED_CMDS.dd= -e '/^OpenDirs_Done:/d' +STD_SED_CMDS.dd+= -e '/^CachedDir /d' +STD_SED_CMDS.dd+= -e 's, ${DEFSYSPATH:U/usr/share/mk} , ,' # Omit details such as process IDs from the output of the -dg1 option. STD_SED_CMDS.dg1= -e 's,${.CURDIR}$$,,' Index: src/usr.bin/make/unit-tests/deptgt-phony.exp diff -u src/usr.bin/make/unit-tests/deptgt-phony.exp:1.3 src/usr.bin/make/unit-tests/deptgt-phony.exp:1.4 --- src/usr.bin/make/unit-tests/deptgt-phony.exp:1.3 Tue Apr 30 16:13:34 2024 +++ src/usr.bin/make/unit-tests/deptgt-phony.exp Tue Apr 30 16:41:32 2024 @@ -3,7 +3,7 @@ Expanding "deptgt-phony-pr-15164-*-wildc Searching for .depend ... failed. Searching for .depend ...[dot last]... - /usr/share/mk ... +... failed. Wildcard expanding "all"... Searching for all ...
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Tue Apr 30 16:41:33 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: Makefile deptgt-phony.exp Log Message: Subst DEFSYSPATH in deptgt-phony To generate a diff of this commit: cvs rdiff -u -r1.343 -r1.344 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/deptgt-phony.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue Apr 30 16:13:34 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: deptgt-phony.exp opt-m-include-dir.mk Log Message: make: ensure '.include ' respects MAKESYSPATH Since Dir_FindFile is used by '.include' and its variants, and will first search .CURDIR unless the give path starts with ".DOTLAST". Update unit-tests/opt-m-include-dir to test this. To generate a diff of this commit: cvs rdiff -u -r1.613 -r1.614 src/usr.bin/make/main.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/deptgt-phony.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-m-include-dir.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.613 src/usr.bin/make/main.c:1.614 --- src/usr.bin/make/main.c:1.613 Sat Apr 27 17:33:46 2024 +++ src/usr.bin/make/main.c Tue Apr 30 16:13:33 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.613 2024/04/27 17:33:46 rillig Exp $ */ +/* $NetBSD: main.c,v 1.614 2024/04/30 16:13:33 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.613 2024/04/27 17:33:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.614 2024/04/30 16:13:33 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1156,6 +1156,8 @@ InitDefSysIncPath(char *syspath) else syspath = bmake_strdup(syspath); + /* do NOT search .CURDIR first for .include */ + SearchPath_Add(defSysIncPath, ".DOTLAST"); for (start = syspath; *start != '\0'; start = p) { for (p = start; *p != '\0' && *p != ':'; p++) continue; Index: src/usr.bin/make/unit-tests/deptgt-phony.exp diff -u src/usr.bin/make/unit-tests/deptgt-phony.exp:1.2 src/usr.bin/make/unit-tests/deptgt-phony.exp:1.3 --- src/usr.bin/make/unit-tests/deptgt-phony.exp:1.2 Fri Feb 11 23:44:18 2022 +++ src/usr.bin/make/unit-tests/deptgt-phony.exp Tue Apr 30 16:13:34 2024 @@ -2,7 +2,7 @@ Expanding "depsrc-phony-pr-15164-*-wildc Expanding "deptgt-phony-pr-15164-*-wildcard"... Searching for .depend ... failed. -Searching for .depend ... +Searching for .depend ...[dot last]... /usr/share/mk ... failed. Wildcard expanding "all"... Index: src/usr.bin/make/unit-tests/opt-m-include-dir.mk diff -u src/usr.bin/make/unit-tests/opt-m-include-dir.mk:1.4 src/usr.bin/make/unit-tests/opt-m-include-dir.mk:1.5 --- src/usr.bin/make/unit-tests/opt-m-include-dir.mk:1.4 Tue Sep 1 20:14:34 2020 +++ src/usr.bin/make/unit-tests/opt-m-include-dir.mk Tue Apr 30 16:13:34 2024 @@ -1,4 +1,4 @@ -# $NetBSD: opt-m-include-dir.mk,v 1.4 2020/09/01 20:14:34 rillig Exp $ +# $NetBSD: opt-m-include-dir.mk,v 1.5 2024/04/30 16:13:34 sjg Exp $ # # Tests for the -m command line option, which adds a directory to the # search path for the .include <...> directive. @@ -22,11 +22,14 @@ TEST_DIR:= ${.PARSEFILE:R}.tmp/sub/sub/sub/workdir CANARY_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-canary.mk ACTUAL_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-step3.mk +WANTED_FILE:= ${.PARSEFILE:R}.tmp/sub/opt-m-check.mk _!= mkdir -p ${TEST_DIR} _!= > ${CANARY_FILE} _!= cp ${MAKEFILE} ${TEST_DIR}/step2.mk _!= cp ${MAKEFILE} ${ACTUAL_FILE} +_!= echo CHECK=ok > ${WANTED_FILE} +_!= echo CHECK=${WANTED_FILE:T} found in .CURDIR > ${TEST_DIR}/${WANTED_FILE:T} step1: @${.MAKE} -C ${TEST_DIR} -f step2.mk step2 @@ -52,9 +55,10 @@ step1: .elif ${.PARSEFILE:T} == "opt-m-step3.mk" # This file is included by step2.mk. +.include step2: - @echo ok + @echo ${CHECK} .else . error
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue Apr 30 16:13:34 UTC 2024 Modified Files: src/usr.bin/make: main.c src/usr.bin/make/unit-tests: deptgt-phony.exp opt-m-include-dir.mk Log Message: make: ensure '.include ' respects MAKESYSPATH Since Dir_FindFile is used by '.include' and its variants, and will first search .CURDIR unless the give path starts with ".DOTLAST". Update unit-tests/opt-m-include-dir to test this. To generate a diff of this commit: cvs rdiff -u -r1.613 -r1.614 src/usr.bin/make/main.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/deptgt-phony.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-m-include-dir.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Mar 10 02:53:38 UTC 2024 Modified Files: src/usr.bin/make: compat.c job.c main.c make.1 make.h targ.c Log Message: make: record exit status in GNode SetErrorVars can now set .ERROR_EXIT which allows a .ERROR target to ignore the case of .ERROR_EXIT == 6 which means failure happened elsewhere. Reviewed by: To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/usr.bin/make/compat.c cvs rdiff -u -r1.466 -r1.467 src/usr.bin/make/job.c cvs rdiff -u -r1.611 -r1.612 src/usr.bin/make/main.c cvs rdiff -u -r1.374 -r1.375 src/usr.bin/make/make.1 cvs rdiff -u -r1.328 -r1.329 src/usr.bin/make/make.h cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/targ.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.253 src/usr.bin/make/compat.c:1.254 --- src/usr.bin/make/compat.c:1.253 Fri Mar 1 16:41:42 2024 +++ src/usr.bin/make/compat.c Sun Mar 10 02:53:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.253 2024/03/01 16:41:42 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.254 2024/03/10 02:53:37 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.253 2024/03/01 16:41:42 sjg Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.254 2024/03/10 02:53:37 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -390,6 +390,8 @@ Compat_RunCommand(const char *cmdp, GNod meta_job_error(NULL, gn, false, status); #endif gn->made = ERROR; + if (WIFEXITED(reason)) +gn->exit_status = status; if (opts.keepgoing) { /* * Abort the current target, Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.466 src/usr.bin/make/job.c:1.467 --- src/usr.bin/make/job.c:1.466 Fri Mar 1 16:41:42 2024 +++ src/usr.bin/make/job.c Sun Mar 10 02:53:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.466 2024/03/01 16:41:42 sjg Exp $ */ +/* $NetBSD: job.c,v 1.467 2024/03/10 02:53:37 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.466 2024/03/01 16:41:42 sjg Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.467 2024/03/10 02:53:37 sjg Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -2044,6 +2044,8 @@ JobReapChild(pid_t pid, int status, bool job->status = JOB_ST_FINISHED; job->exit_status = status; + if (WIFEXITED(status)) + job->node->exit_status = WEXITSTATUS(status); JobFinish(job, status); } Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.611 src/usr.bin/make/main.c:1.612 --- src/usr.bin/make/main.c:1.611 Fri Mar 1 16:41:42 2024 +++ src/usr.bin/make/main.c Sun Mar 10 02:53:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.611 2024/03/01 16:41:42 sjg Exp $ */ +/* $NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.611 2024/03/01 16:41:42 sjg Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.612 2024/03/10 02:53:37 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -2037,10 +2037,13 @@ static void SetErrorVars(GNode *gn) { StringListNode *ln; + char sts[16]; /* * We can print this even if there is no .ERROR target. */ + snprintf(sts, sizeof(sts), "%d", gn->exit_status); + Global_Set(".ERROR_EXIT", sts); Global_Set(".ERROR_TARGET", gn->name); Global_Delete(".ERROR_CMD"); Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.374 src/usr.bin/make/make.1:1.375 --- src/usr.bin/make/make.1:1.374 Thu Jan 25 21:00:59 2024 +++ src/usr.bin/make/make.1 Sun Mar 10 02:53:37 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.374 2024/01/25 21:00:59 sjg Exp $ +.\" $NetBSD: make.1,v 1.375 2024/03/10 02:53:37 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd January 24, 2024 +.Dd March 9, 2024 .Dt MAKE 1 .Os .Sh NAME @@ -879,6 +879,9 @@ Is used in error handling, see .It Va .ERROR_CWD Is used in error handling, see .Va MAKE_PRINT_VAR_ON_ERROR . +.It Va .ERROR_EXIT +Is used in error handling, see +.Va MAKE_PRINT_VAR_ON_ERROR . .It Va .ERROR_META_FILE Is used in error handling in .Dq meta @@ -1185,6 +1188,8 @@ When stops due to an error, it sets .Sq Va .ERROR_TARGET to the name of the target that failed, +.Sq Va .ERROR_EXIT +to the exit status of the failed target, .Sq Va
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Mar 10 02:53:38 UTC 2024 Modified Files: src/usr.bin/make: compat.c job.c main.c make.1 make.h targ.c Log Message: make: record exit status in GNode SetErrorVars can now set .ERROR_EXIT which allows a .ERROR target to ignore the case of .ERROR_EXIT == 6 which means failure happened elsewhere. Reviewed by: To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/usr.bin/make/compat.c cvs rdiff -u -r1.466 -r1.467 src/usr.bin/make/job.c cvs rdiff -u -r1.611 -r1.612 src/usr.bin/make/main.c cvs rdiff -u -r1.374 -r1.375 src/usr.bin/make/make.1 cvs rdiff -u -r1.328 -r1.329 src/usr.bin/make/make.h cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/targ.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Fri Mar 1 20:15:59 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: var-scope-local.exp var-scope-local.mk Log Message: make: update var-scope-local test Show what VAR value is in environment of target script. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/var-scope-local.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/var-scope-local.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/var-scope-local.exp diff -u src/usr.bin/make/unit-tests/var-scope-local.exp:1.7 src/usr.bin/make/unit-tests/var-scope-local.exp:1.8 --- src/usr.bin/make/unit-tests/var-scope-local.exp:1.7 Wed Dec 20 09:03:09 2023 +++ src/usr.bin/make/unit-tests/var-scope-local.exp Fri Mar 1 20:15:59 2024 @@ -61,11 +61,18 @@ dir/subdir/inference-rule-chain.ir-to: * : Making var-scope-local.o from var-scope-local.c. : Making basename "var-scope-local.o" in "." from "var-scope-local.c" in ".". : Making var-scope-local-assign.o with VAR="local". +var-scope-local-assign.o env has VAR='local' : Making var-scope-local-append.o with VAR="local to var-scope-local-append.o". +var-scope-local-append.o env has VAR='local to var-scope-local-append.o' : Making var-scope-local-append-global.o with VAR="global+local". +var-scope-local-append-global.o env has VAR='global+local' : Making var-scope-local-default.o with VAR="global". +var-scope-local-default.o env has VAR='global' : Making var-scope-local-subst.o with VAR="global+local". +var-scope-local-subst.o env has VAR='global+local' : Making var-scope-local-shell.o with VAR="output". +var-scope-local-shell.o env has VAR='output' : var-scope-local-use.o uses .USE VAR="global" +var-scope-local-use.o env has VAR='global' : all overwritten exit status 0 Index: src/usr.bin/make/unit-tests/var-scope-local.mk diff -u src/usr.bin/make/unit-tests/var-scope-local.mk:1.9 src/usr.bin/make/unit-tests/var-scope-local.mk:1.10 --- src/usr.bin/make/unit-tests/var-scope-local.mk:1.9 Wed Dec 20 09:03:09 2023 +++ src/usr.bin/make/unit-tests/var-scope-local.mk Fri Mar 1 20:15:59 2024 @@ -1,4 +1,4 @@ -# $NetBSD: var-scope-local.mk,v 1.9 2023/12/20 09:03:09 rillig Exp $ +# $NetBSD: var-scope-local.mk,v 1.10 2024/03/01 20:15:59 sjg Exp $ # # Tests for target-local variables, such as ${.TARGET} or $@. These variables # are relatively short-lived as they are created just before making the @@ -200,12 +200,14 @@ var-scope-local-default.o \ var-scope-local-subst.o \ var-scope-local-shell.o: : Making ${.TARGET} with VAR="${VAR}". + @echo "${.TARGET} env has VAR='$$VAR'" # Target-local variables are enabled by default. Force them to be enabled # just in case a test above has disabled them. .MAKE.TARGET_LOCAL_VARIABLES= yes VAR= global +.export VAR # If the sources of a dependency line look like a variable assignment, make # treats them as such. There is only a single variable assignment per @@ -264,6 +266,7 @@ var-scope-local-shell.o: VAR != echo out # expect: : var-scope-local-use.o uses .USE VAR="global" a_use: .USE VAR=use : ${.TARGET} uses .USE VAR="${VAR}" + @echo "${.TARGET} env has VAR='$$VAR'" all: var-scope-local-use.o var-scope-local-use.o: a_use
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Fri Mar 1 20:15:59 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: var-scope-local.exp var-scope-local.mk Log Message: make: update var-scope-local test Show what VAR value is in environment of target script. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/var-scope-local.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/var-scope-local.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Fri Mar 1 16:41:42 UTC 2024 Modified Files: src/usr.bin/make: compat.c job.c main.c make.h var.c Log Message: make: export target scope values Pass target scope to Var_ReexportVars so that a target process will see the correct values in its env. We must then mark any Global scope variable as unexported so targets without local value get the Global one. To generate a diff of this commit: cvs rdiff -u -r1.252 -r1.253 src/usr.bin/make/compat.c cvs rdiff -u -r1.465 -r1.466 src/usr.bin/make/job.c cvs rdiff -u -r1.610 -r1.611 src/usr.bin/make/main.c cvs rdiff -u -r1.327 -r1.328 src/usr.bin/make/make.h cvs rdiff -u -r1.1099 -r1.1100 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.252 src/usr.bin/make/compat.c:1.253 --- src/usr.bin/make/compat.c:1.252 Fri Jan 5 23:22:06 2024 +++ src/usr.bin/make/compat.c Fri Mar 1 16:41:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.252 2024/01/05 23:22:06 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.253 2024/03/01 16:41:42 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.252 2024/01/05 23:22:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.253 2024/03/01 16:41:42 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -326,7 +326,7 @@ Compat_RunCommand(const char *cmdp, GNod meta_compat_start(); #endif - Var_ReexportVars(); + Var_ReexportVars(gn); compatChild = cpid = vfork(); if (cpid < 0) Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.465 src/usr.bin/make/job.c:1.466 --- src/usr.bin/make/job.c:1.465 Sun Jan 7 11:39:04 2024 +++ src/usr.bin/make/job.c Fri Mar 1 16:41:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.465 2024/01/07 11:39:04 rillig Exp $ */ +/* $NetBSD: job.c,v 1.466 2024/03/01 16:41:42 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.465 2024/01/07 11:39:04 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.466 2024/03/01 16:41:42 sjg Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1420,7 +1420,7 @@ JobExec(Job *job, char **argv) /* Pre-emptively mark job running, pid still zero though */ job->status = JOB_ST_RUNNING; - Var_ReexportVars(); + Var_ReexportVars(job->node); cpid = vfork(); if (cpid == -1) Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.610 src/usr.bin/make/main.c:1.611 --- src/usr.bin/make/main.c:1.610 Wed Feb 7 06:43:02 2024 +++ src/usr.bin/make/main.c Fri Mar 1 16:41:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.610 2024/02/07 06:43:02 rillig Exp $ */ +/* $NetBSD: main.c,v 1.611 2024/03/01 16:41:42 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.610 2024/02/07 06:43:02 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.611 2024/03/01 16:41:42 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1735,7 +1735,7 @@ Cmd_Exec(const char *cmd, char **error) return bmake_strdup(""); } - Var_ReexportVars(); + Var_ReexportVars(SCOPE_GLOBAL); switch (cpid = vfork()) { case 0: Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.327 src/usr.bin/make/make.h:1.328 --- src/usr.bin/make/make.h:1.327 Sun Dec 17 09:02:26 2023 +++ src/usr.bin/make/make.h Fri Mar 1 16:41:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.327 2023/12/17 09:02:26 rillig Exp $ */ +/* $NetBSD: make.h,v 1.328 2024/03/01 16:41:42 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -1011,7 +1011,7 @@ char *Var_Subst(const char *, GNode *, V void Var_Expand(FStr *, GNode *, VarEvalMode); void Var_Stats(void); void Var_Dump(GNode *); -void Var_ReexportVars(void); +void Var_ReexportVars(GNode *); void Var_Export(VarExportMode, const char *); void Var_ExportVars(const char *); void Var_UnExport(bool, const char *); Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1099 src/usr.bin/make/var.c:1.1100 --- src/usr.bin/make/var.c:1.1099 Wed Feb 7 06:43:02 2024 +++ src/usr.bin/make/var.c Fri Mar 1 16:41:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1099 2024/02/07 06:43:02 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1100 2024/03/01 16:41:42 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -137,7 +137,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Fri Mar 1 16:41:42 UTC 2024 Modified Files: src/usr.bin/make: compat.c job.c main.c make.h var.c Log Message: make: export target scope values Pass target scope to Var_ReexportVars so that a target process will see the correct values in its env. We must then mark any Global scope variable as unexported so targets without local value get the Global one. To generate a diff of this commit: cvs rdiff -u -r1.252 -r1.253 src/usr.bin/make/compat.c cvs rdiff -u -r1.465 -r1.466 src/usr.bin/make/job.c cvs rdiff -u -r1.610 -r1.611 src/usr.bin/make/main.c cvs rdiff -u -r1.327 -r1.328 src/usr.bin/make/make.h cvs rdiff -u -r1.1099 -r1.1100 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Feb 3 00:20:23 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod.exp varmod.mk Log Message: make: state of save_dollars affects what is a parse error When save_dollars is false it is not a parse error to encounter $$ rather than \$. To generate a diff of this commit: cvs rdiff -u -r1.1095 -r1.1096 src/usr.bin/make/var.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1095 src/usr.bin/make/var.c:1.1096 --- src/usr.bin/make/var.c:1.1095 Sun Jan 21 15:02:17 2024 +++ src/usr.bin/make/var.c Sat Feb 3 00:20:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1095 2024/01/21 15:02:17 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1096 2024/02/03 00:20:23 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1095 2024/01/21 15:02:17 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1096 2024/02/03 00:20:23 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -4147,12 +4147,12 @@ IsShortVarnameValid(char varname, const if (!opts.strict) return false; /* XXX: Missing error message */ - if (varname == '$') + if (varname == '$' && save_dollars) Parse_Error(PARSE_FATAL, "To escape a dollar, use \\$, not $$, at \"%s\"", start); else if (varname == '\0') Parse_Error(PARSE_FATAL, "Dollar followed by nothing"); - else + else if (save_dollars) Parse_Error(PARSE_FATAL, "Invalid variable name '%c', at \"%s\"", varname, start); Index: src/usr.bin/make/unit-tests/varmod.exp diff -u src/usr.bin/make/unit-tests/varmod.exp:1.7 src/usr.bin/make/unit-tests/varmod.exp:1.8 --- src/usr.bin/make/unit-tests/varmod.exp:1.7 Thu Jun 1 20:56:35 2023 +++ src/usr.bin/make/unit-tests/varmod.exp Sat Feb 3 00:20:23 2024 @@ -1,8 +1,8 @@ -make: "varmod.mk" line 98: To escape a dollar, use \$, not $$, at "$$:L} != """ -make: "varmod.mk" line 98: Invalid variable name ':', at "$:L} != """ -make: "varmod.mk" line 104: Dollar followed by nothing -make: "varmod.mk" line 114: Missing delimiter ':' after modifier "P" -make: "varmod.mk" line 116: Missing argument for ".error" +make: "varmod.mk" line 101: To escape a dollar, use \$, not $$, at "$$:L} != """ +make: "varmod.mk" line 101: Invalid variable name ':', at "$:L} != """ +make: "varmod.mk" line 107: Dollar followed by nothing +make: "varmod.mk" line 117: Missing delimiter ':' after modifier "P" +make: "varmod.mk" line 119: Missing argument for ".error" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod.mk diff -u src/usr.bin/make/unit-tests/varmod.mk:1.9 src/usr.bin/make/unit-tests/varmod.mk:1.10 --- src/usr.bin/make/unit-tests/varmod.mk:1.9 Sun Nov 19 21:47:52 2023 +++ src/usr.bin/make/unit-tests/varmod.mk Sat Feb 3 00:20:23 2024 @@ -1,4 +1,4 @@ -# $NetBSD: varmod.mk,v 1.9 2023/11/19 21:47:52 rillig Exp $ +# $NetBSD: varmod.mk,v 1.10 2024/02/03 00:20:23 sjg Exp $ # # Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback. # @@ -56,6 +56,9 @@ # | `u` | strict || yes | # | `from=to`| greedy | SysV, fallback | N/A | +# These tests assume +.MAKE.SAVE_DOLLARS = yes + DOLLAR1= $$ DOLLAR2= ${:U\$}
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Feb 3 00:20:23 UTC 2024 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varmod.exp varmod.mk Log Message: make: state of save_dollars affects what is a parse error When save_dollars is false it is not a parse error to encounter $$ rather than \$. To generate a diff of this commit: cvs rdiff -u -r1.1095 -r1.1096 src/usr.bin/make/var.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Jan 25 21:00:59 UTC 2024 Modified Files: src/usr.bin/make: make.1 Log Message: Note that in both :U and :D newval may be empty To generate a diff of this commit: cvs rdiff -u -r1.373 -r1.374 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.373 src/usr.bin/make/make.1:1.374 --- src/usr.bin/make/make.1:1.373 Thu Jan 25 07:35:46 2024 +++ src/usr.bin/make/make.1 Thu Jan 25 21:00:59 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.373 2024/01/25 07:35:46 sjg Exp $ +.\" $NetBSD: make.1,v 1.374 2024/01/25 21:00:59 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -1772,11 +1772,11 @@ is used to save the result of the .Ql :S modifier which is later referenced using the index values from .Ql :range . -.It Cm \&:U\| Ns Oo Ar newval Oc +.It Cm \&:U\| Ns Ar newval If the variable is undefined, the optional .Ar newval -is the value. +(which may be empty) is the value. If the variable is defined, the existing value is returned. This is another ODE make feature. It is handy for setting per-target CFLAGS for instance: @@ -1786,7 +1786,7 @@ If a value is only required if the varia .It Cm \&:D\| Ns Ar newval If the variable is defined, .Ar newval -is the value. +(which may be empty) is the value. .It Cm \&:L The name of the variable is the value. .It Cm \&:P
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Jan 25 21:00:59 UTC 2024 Modified Files: src/usr.bin/make: make.1 Log Message: Note that in both :U and :D newval may be empty To generate a diff of this commit: cvs rdiff -u -r1.373 -r1.374 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Jan 25 07:35:46 UTC 2024 Modified Files: src/usr.bin/make: make.1 Log Message: Indicate that for :U newval is optional To generate a diff of this commit: cvs rdiff -u -r1.372 -r1.373 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.372 src/usr.bin/make/make.1:1.373 --- src/usr.bin/make/make.1:1.372 Sun Dec 24 16:48:30 2023 +++ src/usr.bin/make/make.1 Thu Jan 25 07:35:46 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.372 2023/12/24 16:48:30 sjg Exp $ +.\" $NetBSD: make.1,v 1.373 2024/01/25 07:35:46 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd December 24, 2023 +.Dd January 24, 2024 .Dt MAKE 1 .Os .Sh NAME @@ -1772,8 +1772,9 @@ is used to save the result of the .Ql :S modifier which is later referenced using the index values from .Ql :range . -.It Cm \&:U\| Ns Ar newval +.It Cm \&:U\| Ns Oo Ar newval Oc If the variable is undefined, +the optional .Ar newval is the value. If the variable is defined, the existing value is returned.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Jan 25 07:35:46 UTC 2024 Modified Files: src/usr.bin/make: make.1 Log Message: Indicate that for :U newval is optional To generate a diff of this commit: cvs rdiff -u -r1.372 -r1.373 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Jan 7 02:07:44 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: make: unit-tests handle TEST_MAKE:T != make We need to allow for ${TEST_MAKE:T}[1-9]: etc when TEST_MAKE is not 'make' To generate a diff of this commit: cvs rdiff -u -r1.341 -r1.342 src/usr.bin/make/unit-tests/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.341 src/usr.bin/make/unit-tests/Makefile:1.342 --- src/usr.bin/make/unit-tests/Makefile:1.341 Sat Sep 9 16:41:04 2023 +++ src/usr.bin/make/unit-tests/Makefile Sun Jan 7 02:07:44 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.341 2023/09/09 16:41:04 sjg Exp $ +# $NetBSD: Makefile,v 1.342 2024/01/07 02:07:44 sjg Exp $ # # Unit tests for make(1) # @@ -747,6 +747,7 @@ _SED_CMDS+= -e 's,${.OBJDIR},,g' _SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,' _SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,' _SED_CMDS+= -e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,' +_SED_CMDS+= -e 's,${TEST_MAKE:T:S,.,\\.,g}\(\[[1-9][0-9]*\]:\),make\1,' _SED_CMDS+= -e 's,/,,g' _SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g' _SED_CMDS+= -e '/MAKE_VERSION/d'
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Jan 7 02:07:44 UTC 2024 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: make: unit-tests handle TEST_MAKE:T != make We need to allow for ${TEST_MAKE:T}[1-9]: etc when TEST_MAKE is not 'make' To generate a diff of this commit: cvs rdiff -u -r1.341 -r1.342 src/usr.bin/make/unit-tests/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Jan 7 01:33:58 UTC 2024 Modified Files: src/usr.bin/make: job.c main.c src/usr.bin/make/unit-tests: jobs-error-indirect.exp jobs-error-nested-make.exp jobs-error-nested.exp var-recursive.exp Log Message: make: more consistent error messages Move %s: progname from Job_CheckCommands to Fatal to avoid is being repeated when Job_CheckCommands is passed Error. This means some errors from var also report progname (and level) which is useful. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.463 -r1.464 src/usr.bin/make/job.c cvs rdiff -u -r1.608 -r1.609 src/usr.bin/make/main.c cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/jobs-error-indirect.exp \ src/usr.bin/make/unit-tests/jobs-error-nested.exp cvs rdiff -u -r1.3 -r1.4 \ src/usr.bin/make/unit-tests/jobs-error-nested-make.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-recursive.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.463 src/usr.bin/make/job.c:1.464 --- src/usr.bin/make/job.c:1.463 Fri Jan 5 23:22:06 2024 +++ src/usr.bin/make/job.c Sun Jan 7 01:33:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.463 2024/01/05 23:22:06 rillig Exp $ */ +/* $NetBSD: job.c,v 1.464 2024/01/07 01:33:57 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -141,7 +141,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.463 2024/01/05 23:22:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.464 2024/01/07 01:33:57 sjg Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1379,7 +1379,7 @@ Job_CheckCommands(GNode *gn, void (*abor return false; } - abortProc("%s: don't know how to make %s. Stop", progname, gn->name); + abortProc("don't know how to make %s. Stop", gn->name); return false; } Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.608 src/usr.bin/make/main.c:1.609 --- src/usr.bin/make/main.c:1.608 Fri Jan 5 23:22:06 2024 +++ src/usr.bin/make/main.c Sun Jan 7 01:33:57 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.608 2024/01/05 23:22:06 rillig Exp $ */ +/* $NetBSD: main.c,v 1.609 2024/01/07 01:33:57 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.608 2024/01/05 23:22:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.609 2024/01/07 01:33:57 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1851,6 +1851,7 @@ Fatal(const char *fmt, ...) Job_Wait(); (void)fflush(stdout); + fprintf(stderr, "%s: ", progname); va_start(ap, fmt); (void)vfprintf(stderr, fmt, ap); va_end(ap); Index: src/usr.bin/make/unit-tests/jobs-error-indirect.exp diff -u src/usr.bin/make/unit-tests/jobs-error-indirect.exp:1.1 src/usr.bin/make/unit-tests/jobs-error-indirect.exp:1.2 --- src/usr.bin/make/unit-tests/jobs-error-indirect.exp:1.1 Tue Dec 1 17:50:04 2020 +++ src/usr.bin/make/unit-tests/jobs-error-indirect.exp Sun Jan 7 01:33:57 2024 @@ -2,7 +2,7 @@ false *** [indirect] Error code 1 make: stopped in unit-tests -1 error +make: 1 error make: stopped in unit-tests exit status 2 Index: src/usr.bin/make/unit-tests/jobs-error-nested.exp diff -u src/usr.bin/make/unit-tests/jobs-error-nested.exp:1.1 src/usr.bin/make/unit-tests/jobs-error-nested.exp:1.2 --- src/usr.bin/make/unit-tests/jobs-error-nested.exp:1.1 Tue Dec 1 17:50:04 2020 +++ src/usr.bin/make/unit-tests/jobs-error-nested.exp Sun Jan 7 01:33:57 2024 @@ -3,13 +3,13 @@ false *** [nested] Error code 1 make: stopped in unit-tests -1 error +make: 1 error make: stopped in unit-tests *** [all] Error code 2 make: stopped in unit-tests -1 error +make: 1 error make: stopped in unit-tests exit status 2 Index: src/usr.bin/make/unit-tests/jobs-error-nested-make.exp diff -u src/usr.bin/make/unit-tests/jobs-error-nested-make.exp:1.3 src/usr.bin/make/unit-tests/jobs-error-nested-make.exp:1.4 --- src/usr.bin/make/unit-tests/jobs-error-nested-make.exp:1.3 Fri Jan 8 21:46:50 2021 +++ src/usr.bin/make/unit-tests/jobs-error-nested-make.exp Sun Jan 7 01:33:57 2024 @@ -3,7 +3,7 @@ false *** [nested] Error code 1 make: stopped in unit-tests -1 error +make: 1 error make: stopped in unit-tests Index: src/usr.bin/make/unit-tests/var-recursive.exp diff -u src/usr.bin/make/unit-tests/var-recursive.exp:1.6 src/usr.bin/make/unit-tests/var-recursive.exp:1.7 --- src/usr.bin/make/unit-tests/var-recursive.exp:1.6 Thu Jun 1 20:56:35 2023 +++ src/usr.bin/make/unit-tests/var-recursive.exp Sun Jan 7 01:33:57 2024 @@ -1,19 +1,19 @@ make:
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Jan 7 01:33:58 UTC 2024 Modified Files: src/usr.bin/make: job.c main.c src/usr.bin/make/unit-tests: jobs-error-indirect.exp jobs-error-nested-make.exp jobs-error-nested.exp var-recursive.exp Log Message: make: more consistent error messages Move %s: progname from Job_CheckCommands to Fatal to avoid is being repeated when Job_CheckCommands is passed Error. This means some errors from var also report progname (and level) which is useful. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.463 -r1.464 src/usr.bin/make/job.c cvs rdiff -u -r1.608 -r1.609 src/usr.bin/make/main.c cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/jobs-error-indirect.exp \ src/usr.bin/make/unit-tests/jobs-error-nested.exp cvs rdiff -u -r1.3 -r1.4 \ src/usr.bin/make/unit-tests/jobs-error-nested-make.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-recursive.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Fri Jan 5 22:20:07 UTC 2024 Modified Files: src/usr.bin/make: main.c Log Message: Cmd_Exec use tempfile if cmd is too big To avoid blowing commandline/env limits, if "cmd" is more than 1000 bytes, write it to a file and pass that to shell. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.606 -r1.607 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.606 src/usr.bin/make/main.c:1.607 --- src/usr.bin/make/main.c:1.606 Wed Dec 27 00:45:37 2023 +++ src/usr.bin/make/main.c Fri Jan 5 22:20:07 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.606 2023/12/27 00:45:37 sjg Exp $ */ +/* $NetBSD: main.c,v 1.607 2024/01/05 22:20:07 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.606 2023/12/27 00:45:37 sjg Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.607 2024/01/05 22:20:07 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1705,14 +1705,38 @@ Cmd_Exec(const char *cmd, char **error) char *output; char *p; int saved_errno; + char cmd_file[MAXPATHLEN]; + size_t cmd_len; + int cmd_fd = -1; if (shellPath == NULL) Shell_Init(); + cmd_len = strlen(cmd); + if (cmd_len > 1000) { + cmd_fd = mkTempFile(NULL, cmd_file, sizeof(cmd_file)); + if (cmd_fd >= 0) { + ssize_t n; + + n = write(cmd_fd, cmd, cmd_len); + close(cmd_fd); + if (n < (ssize_t)cmd_len) { +unlink(cmd_file); +cmd_fd = -1; + } + } + } + args[0] = shellName; - args[1] = "-c"; - args[2] = cmd; - args[3] = NULL; + if (cmd_fd >= 0) { + args[1] = cmd_file; + args[2] = NULL; + } else { + cmd_file[0] = '\0'; + args[1] = "-c"; + args[2] = cmd; + args[3] = NULL; + } DEBUG1(VAR, "Capturing the output of command \"%s\"\n", cmd); if (pipe(pipefds) == -1) { @@ -1775,6 +1799,8 @@ Cmd_Exec(const char *cmd, char **error) "Couldn't read shell's output for \"", cmd, "\""); else *error = NULL; + if (cmd_file[0] != '\0') + unlink(cmd_file); return output; } @@ -2129,7 +2155,7 @@ getTmpdir(void) /* * Create and open a temp file using "pattern". - * If out_fname is provided, set it to a copy of the filename created. + * If tfile is provided, set it to a copy of the filename created. * Otherwise unlink the file once open. */ int
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Fri Jan 5 22:20:07 UTC 2024 Modified Files: src/usr.bin/make: main.c Log Message: Cmd_Exec use tempfile if cmd is too big To avoid blowing commandline/env limits, if "cmd" is more than 1000 bytes, write it to a file and pass that to shell. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.606 -r1.607 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed Jan 3 20:24:16 UTC 2024 Modified Files: src/usr.bin/make: parse.c Log Message: make: do not add newline to an empty buffer When LoadFile reads from /dev/null the buffer will be empty, appending "\n" just results in an unnecessary extra call to ParseRawLine. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.713 -r1.714 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.713 src/usr.bin/make/parse.c:1.714 --- src/usr.bin/make/parse.c:1.713 Fri Dec 29 20:43:58 2023 +++ src/usr.bin/make/parse.c Wed Jan 3 20:24:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.713 2023/12/29 20:43:58 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.714 2024/01/03 20:24:16 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,7 +105,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.713 2023/12/29 20:43:58 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.714 2024/01/03 20:24:16 sjg Exp $"); /* Detects a multiple-inclusion guard in a makefile. */ typedef enum { @@ -383,7 +383,7 @@ LoadFile(const char *path, int fd) } assert(buf.len <= buf.cap); - if (!Buf_EndsWith(, '\n')) + if (buf.len > 0 && !Buf_EndsWith(, '\n')) Buf_AddByte(, '\n'); return buf; /* may not be null-terminated */
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed Jan 3 20:24:16 UTC 2024 Modified Files: src/usr.bin/make: parse.c Log Message: make: do not add newline to an empty buffer When LoadFile reads from /dev/null the buffer will be empty, appending "\n" just results in an unnecessary extra call to ParseRawLine. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.713 -r1.714 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed Dec 27 00:45:37 UTC 2023 Modified Files: src/usr.bin/make: main.c Log Message: make: ensure shellPath is set before using it. To generate a diff of this commit: cvs rdiff -u -r1.605 -r1.606 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.605 src/usr.bin/make/main.c:1.606 --- src/usr.bin/make/main.c:1.605 Sun Dec 17 09:02:26 2023 +++ src/usr.bin/make/main.c Wed Dec 27 00:45:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.605 2023/12/17 09:02:26 rillig Exp $ */ +/* $NetBSD: main.c,v 1.606 2023/12/27 00:45:37 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.605 2023/12/17 09:02:26 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.606 2023/12/27 00:45:37 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1706,7 +1706,7 @@ Cmd_Exec(const char *cmd, char **error) char *p; int saved_errno; - if (shellName == NULL) + if (shellPath == NULL) Shell_Init(); args[0] = shellName;
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed Dec 27 00:45:37 UTC 2023 Modified Files: src/usr.bin/make: main.c Log Message: make: ensure shellPath is set before using it. To generate a diff of this commit: cvs rdiff -u -r1.605 -r1.606 src/usr.bin/make/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue Dec 26 20:09:42 UTC 2023 Modified Files: src/usr.bin/make: compat.c Log Message: Move fflush to a point to catch all cases. To generate a diff of this commit: cvs rdiff -u -r1.250 -r1.251 src/usr.bin/make/compat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue Dec 26 20:09:42 UTC 2023 Modified Files: src/usr.bin/make: compat.c Log Message: Move fflush to a point to catch all cases. To generate a diff of this commit: cvs rdiff -u -r1.250 -r1.251 src/usr.bin/make/compat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.250 src/usr.bin/make/compat.c:1.251 --- src/usr.bin/make/compat.c:1.250 Tue Dec 26 17:12:33 2023 +++ src/usr.bin/make/compat.c Tue Dec 26 20:09:42 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.250 2023/12/26 17:12:33 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.251 2023/12/26 20:09:42 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.250 2023/12/26 17:12:33 sjg Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.251 2023/12/26 20:09:42 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -400,7 +400,6 @@ Compat_RunCommand(const char *cmdp, GNod * but let others continue. */ printf(" (continuing)\n"); -fflush(stdout); } else { printf("\n"); } @@ -412,9 +411,9 @@ Compat_RunCommand(const char *cmdp, GNod * If we return 0, this will happen... */ printf(" (ignored)\n"); - fflush(stdout); status = 0; } + fflush(stdout); } free(cmdStart);
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue Dec 26 17:12:33 UTC 2023 Modified Files: src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: depsrc-ignore.exp deptgt-delete_on_error.exp sh-leading-hyphen.exp Log Message: make: fix order of output in compat mode Ensure that make's output is correctly ordered with the output of the target's commands, even when the output does not go to a terminal. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.249 -r1.250 src/usr.bin/make/compat.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-ignore.exp \ src/usr.bin/make/unit-tests/sh-leading-hyphen.exp cvs rdiff -u -r1.3 -r1.4 \ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue Dec 26 17:12:33 UTC 2023 Modified Files: src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: depsrc-ignore.exp deptgt-delete_on_error.exp sh-leading-hyphen.exp Log Message: make: fix order of output in compat mode Ensure that make's output is correctly ordered with the output of the target's commands, even when the output does not go to a terminal. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.249 -r1.250 src/usr.bin/make/compat.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-ignore.exp \ src/usr.bin/make/unit-tests/sh-leading-hyphen.exp cvs rdiff -u -r1.3 -r1.4 \ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.249 src/usr.bin/make/compat.c:1.250 --- src/usr.bin/make/compat.c:1.249 Sun Dec 24 16:48:30 2023 +++ src/usr.bin/make/compat.c Tue Dec 26 17:12:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.249 2023/12/24 16:48:30 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.250 2023/12/26 17:12:33 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.249 2023/12/24 16:48:30 sjg Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.250 2023/12/26 17:12:33 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -400,6 +400,7 @@ Compat_RunCommand(const char *cmdp, GNod * but let others continue. */ printf(" (continuing)\n"); +fflush(stdout); } else { printf("\n"); } @@ -411,6 +412,7 @@ Compat_RunCommand(const char *cmdp, GNod * If we return 0, this will happen... */ printf(" (ignored)\n"); + fflush(stdout); status = 0; } } Index: src/usr.bin/make/unit-tests/depsrc-ignore.exp diff -u src/usr.bin/make/unit-tests/depsrc-ignore.exp:1.2 src/usr.bin/make/unit-tests/depsrc-ignore.exp:1.3 --- src/usr.bin/make/unit-tests/depsrc-ignore.exp:1.2 Sat Aug 29 15:06:33 2020 +++ src/usr.bin/make/unit-tests/depsrc-ignore.exp Tue Dec 26 17:12:33 2023 @@ -1,8 +1,8 @@ ignore-errors begin false ignore-errors +*** Error code 1 (ignored) ignore-errors end all begin -*** Error code 1 (ignored) false all *** Error code 1 (continuing) Index: src/usr.bin/make/unit-tests/sh-leading-hyphen.exp diff -u src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.2 src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.3 --- src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.2 Thu Jan 19 19:55:27 2023 +++ src/usr.bin/make/unit-tests/sh-leading-hyphen.exp Tue Dec 26 17:12:33 2023 @@ -6,6 +6,6 @@ unknown-command: not found *** Error code 127 (ignored) unknown-long-option 'needed for needshell in compat.c' unknown-long-option: not found -whitespace in leading part *** Error code 127 (ignored) +whitespace in leading part exit status 0 Index: src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp diff -u src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.3 src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.4 --- src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.3 Sat Mar 18 22:20:12 2023 +++ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp Tue Dec 26 17:12:33 2023 @@ -16,6 +16,7 @@ make: *** deptgt-delete_on_error-regular Stop. make: stopped in unit-tests +*** Error code 1 (ignored) Parallel mode > deptgt-delete_on_error-regular; false @@ -45,5 +46,4 @@ make: stopped in unit-tests make: stopped in unit-tests *** Error code 1 (ignored) -*** Error code 1 (ignored) exit status 0
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Dec 24 16:48:30 UTC 2023 Modified Files: src/usr.bin/make: compat.c make.1 src/usr.bin/make/unit-tests: shell-sh.mk Log Message: Compat_RunCommand call Shell_Init is shellPath is NULL Since .SHELL is potentially used in compat mode as well, the man page description should not imply it is only used in jobs mode. Remove path="sh" from shell-sh unit-test - and it would have detected this bug. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 src/usr.bin/make/compat.c cvs rdiff -u -r1.371 -r1.372 src/usr.bin/make/make.1 cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/shell-sh.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.248 src/usr.bin/make/compat.c:1.249 --- src/usr.bin/make/compat.c:1.248 Tue Dec 19 19:33:39 2023 +++ src/usr.bin/make/compat.c Sun Dec 24 16:48:30 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.248 2023/12/19 19:33:39 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.249 2023/12/24 16:48:30 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.248 2023/12/19 19:33:39 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.249 2023/12/24 16:48:30 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -275,11 +275,9 @@ Compat_RunCommand(const char *cmdp, GNod silent = !DEBUG(LOUD); else if (*cmd == '-') errCheck = false; - else if (*cmd == '+') { + else if (*cmd == '+') doIt = true; - if (shellName == NULL) /* we came here from jobs */ -Shell_Init(); - } else if (!ch_isspace(*cmd)) + else if (!ch_isspace(*cmd)) /* Ignore whitespace for compatibility with gnu make */ break; cmd++; @@ -302,6 +300,9 @@ Compat_RunCommand(const char *cmdp, GNod DEBUG1(JOB, "Execute: '%s'\n", cmd); + if (useShell && shellPath == NULL) + Shell_Init(); /* we need shellPath */ + if (useShell) { static const char *shargv[5]; Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.371 src/usr.bin/make/make.1:1.372 --- src/usr.bin/make/make.1:1.371 Sun Sep 10 21:52:36 2023 +++ src/usr.bin/make/make.1 Sun Dec 24 16:48:30 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.371 2023/09/10 21:52:36 rillig Exp $ +.\" $NetBSD: make.1,v 1.372 2023/12/24 16:48:30 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd September 9, 2023 +.Dd December 24, 2023 .Dt MAKE 1 .Os .Sh NAME @@ -2522,7 +2522,7 @@ set the read-only attribute on the globa .It Ic .SHELL Sets the shell that .Nm -uses to execute commands in jobs mode. +uses to execute commands. The sources are a set of .Ar field\| Ns Cm \&= Ns Ar value pairs. Index: src/usr.bin/make/unit-tests/shell-sh.mk diff -u src/usr.bin/make/unit-tests/shell-sh.mk:1.1 src/usr.bin/make/unit-tests/shell-sh.mk:1.2 --- src/usr.bin/make/unit-tests/shell-sh.mk:1.1 Sat Oct 3 14:39:36 2020 +++ src/usr.bin/make/unit-tests/shell-sh.mk Sun Dec 24 16:48:30 2023 @@ -1,9 +1,9 @@ -# $NetBSD: shell-sh.mk,v 1.1 2020/10/03 14:39:36 rillig Exp $ +# $NetBSD: shell-sh.mk,v 1.2 2023/12/24 16:48:30 sjg Exp $ # # Tests for using a bourne shell for running the commands. # This is the default shell, so there's nothing surprising. -.SHELL: name="sh" path="sh" +.SHELL: name="sh" all: : normal
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Dec 24 16:48:30 UTC 2023 Modified Files: src/usr.bin/make: compat.c make.1 src/usr.bin/make/unit-tests: shell-sh.mk Log Message: Compat_RunCommand call Shell_Init is shellPath is NULL Since .SHELL is potentially used in compat mode as well, the man page description should not imply it is only used in jobs mode. Remove path="sh" from shell-sh unit-test - and it would have detected this bug. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 src/usr.bin/make/compat.c cvs rdiff -u -r1.371 -r1.372 src/usr.bin/make/make.1 cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/shell-sh.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Dec 9 00:13:38 UTC 2023 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varname-dot-shell.exp Log Message: make: Var_SetWithFlags set fromCmd for SCOPE_CMDLINE Set fromCmd true for SCOPE_CMDLINE regardless of the variable name. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.1075 -r1.1076 src/usr.bin/make/var.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varname-dot-shell.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Dec 9 00:13:38 UTC 2023 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: varname-dot-shell.exp Log Message: make: Var_SetWithFlags set fromCmd for SCOPE_CMDLINE Set fromCmd true for SCOPE_CMDLINE regardless of the variable name. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.1075 -r1.1076 src/usr.bin/make/var.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varname-dot-shell.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1075 src/usr.bin/make/var.c:1.1076 --- src/usr.bin/make/var.c:1.1075 Sun Nov 19 22:50:11 2023 +++ src/usr.bin/make/var.c Sat Dec 9 00:13:38 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1075 2023/11/19 22:50:11 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1076 2023/12/09 00:13:38 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1075 2023/11/19 22:50:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1076 2023/12/09 00:13:38 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -994,25 +994,26 @@ Var_SetWithFlags(GNode *scope, const cha * Any variables given on the command line are automatically exported * to the environment (as per POSIX standard), except for internals. */ - if (scope == SCOPE_CMDLINE && !(flags & VAR_SET_NO_EXPORT) && - name[0] != '.') { + if (scope == SCOPE_CMDLINE) { v->fromCmd = true; + if (!(flags & VAR_SET_NO_EXPORT) && name[0] != '.') { - /* - * If requested, don't export these in the environment - * individually. We still put them in .MAKEOVERRIDES so - * that the command-line settings continue to override - * Makefile settings. - */ - if (!opts.varNoExportEnv) - setenv(name, val, 1); - /* XXX: What about .MAKE.EXPORTED? */ - /* - * XXX: Why not just mark the variable for needing export, as - * in ExportVarPlain? - */ - - Global_Append(".MAKEOVERRIDES", name); + /* + * If requested, don't export these in the + * environment individually. We still put + * them in .MAKEOVERRIDES so that the + * command-line settings continue to override + * Makefile settings. + */ + if (!opts.varNoExportEnv) +setenv(name, val, 1); + /* XXX: What about .MAKE.EXPORTED? */ + /* + * XXX: Why not just mark the variable for + * needing export, as in ExportVarPlain? + */ + Global_Append(".MAKEOVERRIDES", name); + } } if (name[0] == '.' && strcmp(name, MAKE_SAVE_DOLLARS) == 0) Index: src/usr.bin/make/unit-tests/varname-dot-shell.exp diff -u src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.16 src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.17 --- src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.16 Sat Mar 26 14:34:07 2022 +++ src/usr.bin/make/unit-tests/varname-dot-shell.exp Sat Dec 9 00:13:38 2023 @@ -5,7 +5,7 @@ Global: delete .SHELL (not found) Command: .SHELL = (details omitted) Global: ORIG_SHELL = (details omitted) Parsing line 12: .SHELL= overwritten -Global: .SHELL = overwritten +Global: .SHELL = overwritten ignored! CondParser_Eval: ${.SHELL} != ${ORIG_SHELL} Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined) Var_Parse: ${ORIG_SHELL} (eval-defined) @@ -18,9 +18,9 @@ Var_Parse: ${.SHELL} != ${ORIG_SHELL} (e Var_Parse: ${ORIG_SHELL} (eval-defined) Comparing "(details omitted)" != "(details omitted)" Parsing line 27: .undef .SHELL -Global: delete .SHELL +Global: delete .SHELL (not found) Parsing line 28: .SHELL= newly overwritten -Global: .SHELL = newly overwritten +Global: .SHELL = newly overwritten ignored! CondParser_Eval: ${.SHELL} != ${ORIG_SHELL} Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined) Var_Parse: ${ORIG_SHELL} (eval-defined)
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Sep 10 16:25:32 UTC 2023 Modified Files: src/usr.bin/make/unit-tests: opt-jobs.mk varname-dot-make-jobs.mk Log Message: make: skip -jC tests unless .MAKE.JOBS.C is yes To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-jobs.mk \ src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/opt-jobs.mk diff -u src/usr.bin/make/unit-tests/opt-jobs.mk:1.4 src/usr.bin/make/unit-tests/opt-jobs.mk:1.5 --- src/usr.bin/make/unit-tests/opt-jobs.mk:1.4 Sun Sep 10 11:41:33 2023 +++ src/usr.bin/make/unit-tests/opt-jobs.mk Sun Sep 10 16:25:32 2023 @@ -1,4 +1,4 @@ -# $NetBSD: opt-jobs.mk,v 1.4 2023/09/10 11:41:33 rillig Exp $ +# $NetBSD: opt-jobs.mk,v 1.5 2023/09/10 16:25:32 sjg Exp $ # # Tests for the -j command line option, which creates the targets in parallel. @@ -39,7 +39,7 @@ EXPECT..5e1C= # unlikely to o EXPECT.07.5C= EXPECT.08.5C= argument '08.5C' to option '-j' must be a positive number (exit 2) -.if ${.MAKE.JOBS.C} +.if ${.MAKE.JOBS.C} == "yes" . for arg in ${ARGS} OUTPUT!= ${MAKE} -r -f /dev/null -j ${arg} -v .MAKE.JOBS 2>&1 || echo "(exit $$?)" .if ${OUTPUT:C,^[0-9]+$,numeric,W} == numeric Index: src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk diff -u src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.4 src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.5 --- src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.4 Sat Sep 9 01:30:59 2023 +++ src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk Sun Sep 10 16:25:32 2023 @@ -1,4 +1,4 @@ -# $NetBSD: varname-dot-make-jobs.mk,v 1.4 2023/09/09 01:30:59 sjg Exp $ +# $NetBSD: varname-dot-make-jobs.mk,v 1.5 2023/09/10 16:25:32 sjg Exp $ # # Tests for the special .MAKE.JOBS variable, which is defined in jobs mode # only. There it contains the number of jobs that may run in parallel. @@ -15,16 +15,13 @@ all: @${MAKE} -r -f ${MAKEFILE} echo -j20 @${MAKE} -r -f ${MAKEFILE} echo -j0001 -.if !make(echo) +.if !make(echo) && ${.MAKE.JOBS.C} == "yes" # These results will not be static, we need NCPU # to compute expected results. -# We only support -jC if _SC_NPROCESSORS_ONLN is defined, -# otherwise we will get NCPU=0 -NCPU!= ${MAKE} -r -f /dev/null -jC -V .MAKE.JOBS 2> /dev/null || echo 0 - -.if ${NCPU} > 0 all: jC +NCPU!= ${MAKE} -r -f /dev/null -jC -V .MAKE.JOBS + # If -j arg is floating point or ends in C; # .MAKE.JOBS is a multiple of _SC_NPROCESSORS_ONLN # No news is good news here. @@ -38,7 +35,6 @@ jC: done .endif -.endif # expect: undefined # expect: 1
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Sep 10 16:25:32 UTC 2023 Modified Files: src/usr.bin/make/unit-tests: opt-jobs.mk varname-dot-make-jobs.mk Log Message: make: skip -jC tests unless .MAKE.JOBS.C is yes To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-jobs.mk \ src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Sep 9 16:41:04 UTC 2023 Modified Files: src/usr.bin/make: main.c make.1 src/usr.bin/make/unit-tests: Makefile opt-debug-graph1.exp opt-debug-graph2.exp opt-debug-graph3.exp suff-main-several.exp suff-transform-debug.exp Log Message: Add .MAKE.JOBS.C to indicate wether -jC is supported To generate a diff of this commit: cvs rdiff -u -r1.595 -r1.596 src/usr.bin/make/main.c cvs rdiff -u -r1.369 -r1.370 src/usr.bin/make/make.1 cvs rdiff -u -r1.340 -r1.341 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/opt-debug-graph1.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \ src/usr.bin/make/unit-tests/opt-debug-graph3.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/suff-main-several.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.595 src/usr.bin/make/main.c:1.596 --- src/usr.bin/make/main.c:1.595 Sat Sep 9 04:38:48 2023 +++ src/usr.bin/make/main.c Sat Sep 9 16:41:04 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.595 2023/09/09 04:38:48 mrg Exp $ */ +/* $NetBSD: main.c,v 1.596 2023/09/09 16:41:04 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.595 2023/09/09 04:38:48 mrg Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.596 2023/09/09 16:41:04 sjg Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1373,6 +1373,12 @@ main_Init(int argc, char **argv) #endif Global_Set(".MAKE.MAKEFILE_PREFERENCE", MAKEFILE_PREFERENCE_LIST); Global_Set(".MAKE.DEPENDFILE", ".depend"); + /* Tell makefiles like jobs.mk wether we support -jC */ +#ifdef _SC_NPROCESSORS_ONLN + Global_Set_ReadOnly(".MAKE.JOBS.C", "yes"); +#else + Global_Set_ReadOnly(".MAKE.JOBS.C", "no"); +#endif CmdOpts_Init(); allPrecious = false; /* Remove targets when interrupted */ Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.369 src/usr.bin/make/make.1:1.370 --- src/usr.bin/make/make.1:1.369 Sat Sep 9 01:30:59 2023 +++ src/usr.bin/make/make.1 Sat Sep 9 16:41:04 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.369 2023/09/09 01:30:59 sjg Exp $ +.\" $NetBSD: make.1,v 1.370 2023/09/09 16:41:04 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -977,6 +977,11 @@ making it easier to track the degree of The argument to the .Fl j option. +.It Va .MAKE.JOBS.C +A read-only boolean that indicates wether the +.Fl j +option supports use of +.Ql C . .It Va .MAKE.LEVEL The recursion depth of .Nm . Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.340 src/usr.bin/make/unit-tests/Makefile:1.341 --- src/usr.bin/make/unit-tests/Makefile:1.340 Thu Aug 17 18:48:32 2023 +++ src/usr.bin/make/unit-tests/Makefile Sat Sep 9 16:41:04 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.340 2023/08/17 18:48:32 rillig Exp $ +# $NetBSD: Makefile,v 1.341 2023/09/09 16:41:04 sjg Exp $ # # Unit tests for make(1) # @@ -597,6 +597,7 @@ STD_SED_CMDS.dg1= -e 's,${.CURDIR}$$,,' STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE *=\) .*,\1 ,' STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1 ,' +STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE\.JOBS\.C *=\) .*,\1 ,' STD_SED_CMDS.dg1+= -e 's,^\(MACHINE[_ARCH]* *=\) .*,\1 ,' STD_SED_CMDS.dg1+= -e 's,^\(MAKE *=\) .*,\1 ,' STD_SED_CMDS.dg1+= -e 's,^\(\.SHELL *=\) .*,\1 ,' Index: src/usr.bin/make/unit-tests/opt-debug-graph1.exp diff -u src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.11 src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.12 --- src/usr.bin/make/unit-tests/opt-debug-graph1.exp:1.11 Tue Jan 24 00:24:02 2023 +++ src/usr.bin/make/unit-tests/opt-debug-graph1.exp Sat Sep 9 16:41:04 2023 @@ -21,6 +21,7 @@ .MAKE= .MAKE.DEPENDFILE = .MAKE.GID= +.MAKE.JOBS.C = .MAKE.LEVEL = .MAKE.MAKEFILES = .MAKE.MAKEFILE_PREFERENCE = Index: src/usr.bin/make/unit-tests/opt-debug-graph2.exp diff -u src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.6 src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.7 --- src/usr.bin/make/unit-tests/opt-debug-graph2.exp:1.6 Tue Jan 24 00:24:02 2023 +++ src/usr.bin/make/unit-tests/opt-debug-graph2.exp Sat Sep 9 16:41:04 2023 @@ -55,6 +55,7 @@ all : made-target error-targ .MAKE= .MAKE.DEPENDFILE = .MAKE.GID= +.MAKE.JOBS.C = .MAKE.LEVEL = .MAKE.MAKEFILES = .MAKE.MAKEFILE_PREFERENCE = Index: src/usr.bin/make/unit-tests/opt-debug-graph3.exp diff -u
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Sep 9 16:41:04 UTC 2023 Modified Files: src/usr.bin/make: main.c make.1 src/usr.bin/make/unit-tests: Makefile opt-debug-graph1.exp opt-debug-graph2.exp opt-debug-graph3.exp suff-main-several.exp suff-transform-debug.exp Log Message: Add .MAKE.JOBS.C to indicate wether -jC is supported To generate a diff of this commit: cvs rdiff -u -r1.595 -r1.596 src/usr.bin/make/main.c cvs rdiff -u -r1.369 -r1.370 src/usr.bin/make/make.1 cvs rdiff -u -r1.340 -r1.341 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/opt-debug-graph1.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \ src/usr.bin/make/unit-tests/opt-debug-graph3.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/suff-main-several.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Sep 9 01:30:59 UTC 2023 Modified Files: src/usr.bin/make: main.c make.1 src/usr.bin/make/unit-tests: varname-dot-make-jobs.exp varname-dot-make-jobs.mk Log Message: make: allow -j to compute a multiple of ncpu If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating point number or ends in 'C' compute .MAKE.JOBS as a multiple of _SC_NPROCESSORS_ONLN Based on a suggestion from des at freebsd.org Discussed with: rillig, christos To generate a diff of this commit: cvs rdiff -u -r1.593 -r1.594 src/usr.bin/make/main.c cvs rdiff -u -r1.368 -r1.369 src/usr.bin/make/make.1 cvs rdiff -u -r1.2 -r1.3 \ src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.593 src/usr.bin/make/main.c:1.594 --- src/usr.bin/make/main.c:1.593 Tue Mar 28 14:39:31 2023 +++ src/usr.bin/make/main.c Sat Sep 9 01:30:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.593 2023/03/28 14:39:31 rillig Exp $ */ +/* $NetBSD: main.c,v 1.594 2023/09/09 01:30:59 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.593 2023/03/28 14:39:31 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.594 2023/09/09 01:30:59 sjg Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -398,18 +398,37 @@ static void MainParseArgJobs(const char *argvalue) { char *p; + char v[12]; forceJobs = true; opts.maxJobs = (int)strtol(argvalue, , 0); +#ifdef _SC_NPROCESSORS_ONLN + if (*p != '\0') { + double d; + + if (*p == 'C') { + d = (opts.maxJobs > 0) ? opts.maxJobs : 1; + } else if (*p == '.') { + d = strtod(argvalue, ); + } else + d = 0; + if (d > 0) { + p = strchr(argvalue, 0); + opts.maxJobs = sysconf(_SC_NPROCESSORS_ONLN); + opts.maxJobs = (int)(d * (double)opts.maxJobs); + } + } +#endif if (*p != '\0' || opts.maxJobs < 1) { (void)fprintf(stderr, "%s: illegal argument to -j -- must be positive integer!\n", progname); exit(2); /* Not 1 so -q can distinguish error */ } + snprintf(v, sizeof(v), "%d", opts.maxJobs); Global_Append(MAKEFLAGS, "-j"); - Global_Append(MAKEFLAGS, argvalue); - Global_Set(".MAKE.JOBS", argvalue); + Global_Append(MAKEFLAGS, v); + Global_Set(".MAKE.JOBS", v); maxJobTokens = opts.maxJobs; } Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.368 src/usr.bin/make/make.1:1.369 --- src/usr.bin/make/make.1:1.368 Sun Aug 20 19:58:15 2023 +++ src/usr.bin/make/make.1 Sat Sep 9 01:30:59 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.368 2023/08/20 19:58:15 sjg Exp $ +.\" $NetBSD: make.1,v 1.369 2023/09/09 01:30:59 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd August 20, 2023 +.Dd September 9, 2023 .Dt MAKE 1 .Os .Sh NAME @@ -267,6 +267,12 @@ cooperate to avoid overloading the syste Specify the maximum number of jobs that .Nm may have running at any one time. +If +.Ar max_jobs +is a floating point number, or ends with +.Ql C , +then the value is multiplied by the number of CPUs reported online by +.Xr sysconf 3 . The value of .Ar max_jobs is saved in Index: src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp diff -u src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp:1.2 src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp:1.3 --- src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp:1.2 Wed Jan 26 22:47:03 2022 +++ src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp Sat Sep 9 01:30:59 2023 @@ -4,5 +4,5 @@ undefined 5 --- echo --- 20 -0001 +1 exit status 0 Index: src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk diff -u src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.3 src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.4 --- src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk:1.3 Wed Jan 26 22:47:03 2022 +++ src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk Sat Sep 9 01:30:59 2023 @@ -1,4 +1,4 @@ -# $NetBSD: varname-dot-make-jobs.mk,v 1.3 2022/01/26 22:47:03 rillig Exp $ +# $NetBSD: varname-dot-make-jobs.mk,v 1.4 2023/09/09 01:30:59 sjg Exp $ # # Tests for the special .MAKE.JOBS variable, which is defined in jobs mode # only. There it contains the number of jobs that may run in parallel. @@ -15,10 +15,33 @@ all: @${MAKE} -r -f ${MAKEFILE} echo -j20 @${MAKE} -r -f ${MAKEFILE} echo -j0001 +.if !make(echo) +# These results will not be
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Sep 9 01:30:59 UTC 2023 Modified Files: src/usr.bin/make: main.c make.1 src/usr.bin/make/unit-tests: varname-dot-make-jobs.exp varname-dot-make-jobs.mk Log Message: make: allow -j to compute a multiple of ncpu If _SC_NPROCESSORS_ONLN is supported; and -j arg is a floating point number or ends in 'C' compute .MAKE.JOBS as a multiple of _SC_NPROCESSORS_ONLN Based on a suggestion from des at freebsd.org Discussed with: rillig, christos To generate a diff of this commit: cvs rdiff -u -r1.593 -r1.594 src/usr.bin/make/main.c cvs rdiff -u -r1.368 -r1.369 src/usr.bin/make/make.1 cvs rdiff -u -r1.2 -r1.3 \ src/usr.bin/make/unit-tests/varname-dot-make-jobs.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varname-dot-make-jobs.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Aug 20 19:58:15 UTC 2023 Modified Files: src/usr.bin/make: make.1 Log Message: make.1: note that %s should only be used with :localtime To generate a diff of this commit: cvs rdiff -u -r1.367 -r1.368 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun Aug 20 19:58:15 UTC 2023 Modified Files: src/usr.bin/make: make.1 Log Message: make.1: note that %s should only be used with :localtime To generate a diff of this commit: cvs rdiff -u -r1.367 -r1.368 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.367 src/usr.bin/make/make.1:1.368 --- src/usr.bin/make/make.1:1.367 Wed Jun 28 06:15:07 2023 +++ src/usr.bin/make/make.1 Sun Aug 20 19:58:15 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.367 2023/06/28 06:15:07 rillig Exp $ +.\" $NetBSD: make.1,v 1.368 2023/08/20 19:58:15 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd June 28, 2023 +.Dd August 20, 2023 .Dt MAKE 1 .Os .Sh NAME @@ -1496,6 +1496,10 @@ The value is interpreted as a format str using .Xr gmtime 3 , producing the formatted timestamp. +Note: the +.Ql %s +format should only be used with +.Sq Cm \&:localtime . If a .Ar timestamp value is not provided or is 0, the current time is used.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sat Aug 19 01:34:21 UTC 2023 Modified Files: src/usr.bin/make/unit-tests: varmod-mtime.exp varmod-mtime.mk Log Message: varmod-mtime.mk: use :localtime for %s Add a comment to explain why ${%s:L:localtime} should be used to get a value that matches time(3). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-mtime.exp \ src/usr.bin/make/unit-tests/varmod-mtime.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sat Aug 19 01:34:21 UTC 2023 Modified Files: src/usr.bin/make/unit-tests: varmod-mtime.exp varmod-mtime.mk Log Message: varmod-mtime.mk: use :localtime for %s Add a comment to explain why ${%s:L:localtime} should be used to get a value that matches time(3). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-mtime.exp \ src/usr.bin/make/unit-tests/varmod-mtime.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/varmod-mtime.exp diff -u src/usr.bin/make/unit-tests/varmod-mtime.exp:1.3 src/usr.bin/make/unit-tests/varmod-mtime.exp:1.4 --- src/usr.bin/make/unit-tests/varmod-mtime.exp:1.3 Thu Aug 17 19:06:51 2023 +++ src/usr.bin/make/unit-tests/varmod-mtime.exp Sat Aug 19 01:34:21 2023 @@ -1,8 +1,8 @@ -make: "varmod-mtime.mk" line 58: Cannot determine mtime for 'no/such/file1': -make: "varmod-mtime.mk" line 58: Cannot determine mtime for 'no/such/file2': -make: "varmod-mtime.mk" line 58: Malformed conditional (${no/such/file1 no/such/file2:L:mtime=error}) -make: "varmod-mtime.mk" line 69: Invalid argument 'errorhandler-no' for modifier ':mtime' -make: "varmod-mtime.mk" line 69: Malformed conditional (${MAKEFILE:mtime=errorhandler-no} > 0) +make: "varmod-mtime.mk" line 60: Cannot determine mtime for 'no/such/file1': +make: "varmod-mtime.mk" line 60: Cannot determine mtime for 'no/such/file2': +make: "varmod-mtime.mk" line 60: Malformed conditional (${no/such/file1 no/such/file2:L:mtime=error}) +make: "varmod-mtime.mk" line 71: Invalid argument 'errorhandler-no' for modifier ':mtime' +make: "varmod-mtime.mk" line 71: Malformed conditional (${MAKEFILE:mtime=errorhandler-no} > 0) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-mtime.mk diff -u src/usr.bin/make/unit-tests/varmod-mtime.mk:1.3 src/usr.bin/make/unit-tests/varmod-mtime.mk:1.4 --- src/usr.bin/make/unit-tests/varmod-mtime.mk:1.3 Thu Aug 17 19:06:51 2023 +++ src/usr.bin/make/unit-tests/varmod-mtime.mk Sat Aug 19 01:34:21 2023 @@ -1,9 +1,11 @@ -# $NetBSD: varmod-mtime.mk,v 1.3 2023/08/17 19:06:51 rillig Exp $ +# $NetBSD: varmod-mtime.mk,v 1.4 2023/08/19 01:34:21 sjg Exp $ # # Tests for the ':mtime' variable modifier, which maps each word of the # expression to that file's modification time. -start:= ${%s:L:gmtime} +# Note: strftime() uses mktime() for %s and mktime() assumes localtime +# so this should match time() +start:= ${%s:L:localtime} # Ensure that this makefile exists and has a modification time. If the file
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Aug 19 00:09:17 UTC 2023 Modified Files: src/usr.bin/make: meta.c Log Message: meta_ignore: check metaIgnorePaths on raw path Some path prefixes can trigger automount, if we want to ignore them it might be best to check metaIgnorePaths before we call realpath. If the raw path does not match, check again after realpath. To generate a diff of this commit: cvs rdiff -u -r1.205 -r1.206 src/usr.bin/make/meta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/meta.c diff -u src/usr.bin/make/meta.c:1.205 src/usr.bin/make/meta.c:1.206 --- src/usr.bin/make/meta.c:1.205 Tue Mar 28 14:39:31 2023 +++ src/usr.bin/make/meta.c Sat Aug 19 00:09:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.205 2023/03/28 14:39:31 rillig Exp $ */ +/* $NetBSD: meta.c,v 1.206 2023/08/19 00:09:17 sjg Exp $ */ /* * Implement 'meta' mode. @@ -932,6 +932,13 @@ meta_ignore(GNode *gn, const char *p) return true; if (*p == '/') { + /* first try the raw path "as is" */ + if (has_any_prefix(p, )) { +#ifdef DEBUG_META_MODE + DEBUG1(META, "meta_oodate: ignoring path: %s\n", p); +#endif + return true; + } cached_realpath(p, fname); /* clean it up */ if (has_any_prefix(fname, )) { #ifdef DEBUG_META_MODE
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Aug 19 00:09:17 UTC 2023 Modified Files: src/usr.bin/make: meta.c Log Message: meta_ignore: check metaIgnorePaths on raw path Some path prefixes can trigger automount, if we want to ignore them it might be best to check metaIgnorePaths before we call realpath. If the raw path does not match, check again after realpath. To generate a diff of this commit: cvs rdiff -u -r1.205 -r1.206 src/usr.bin/make/meta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Wed Jun 21 21:21:52 UTC 2023 Modified Files: src/usr.bin/make/unit-tests: directive-include-guard.exp directive-include-guard.mk Log Message: Cleanup guard tests The .PARSEFILE:tA tests add no value, the correct form is ${.PARSEDIR:tA}/${.PARSEFILE} but even there :tA rarely matters. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/usr.bin/make/unit-tests/directive-include-guard.exp cvs rdiff -u -r1.10 -r1.11 \ src/usr.bin/make/unit-tests/directive-include-guard.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/directive-include-guard.exp diff -u src/usr.bin/make/unit-tests/directive-include-guard.exp:1.9 src/usr.bin/make/unit-tests/directive-include-guard.exp:1.10 --- src/usr.bin/make/unit-tests/directive-include-guard.exp:1.9 Wed Jun 21 14:33:36 2023 +++ src/usr.bin/make/unit-tests/directive-include-guard.exp Wed Jun 21 21:21:52 2023 @@ -73,12 +73,6 @@ Parse_PushInput: file target-indirect-PA Skipping 'target-indirect-PARSEFILE2.tmp' because '__target-indirect-PARSEFILE2.tmp__' is defined Parse_PushInput: file subdir/target-indirect-PARSEFILE.tmp, line 1 Skipping 'subdir/target-indirect-PARSEFILE.tmp' because '__target-indirect-PARSEFILE.tmp__' is defined -Parse_PushInput: file target-indirect-PARSEFILE-tA.tmp, line 1 -Skipping 'target-indirect-PARSEFILE-tA.tmp' because '__target-indirect-PARSEFILE-tA.tmp__' is defined -Parse_PushInput: file subdir/target-indirect-PARSEFILE-tA.tmp, line 1 -Skipping 'subdir/target-indirect-PARSEFILE-tA.tmp' because '__target-indirect-PARSEFILE-tA.tmp__' is defined -Parse_PushInput: file subdir2/target-indirect-PARSEFILE-tA.tmp, line 1 -Skipping 'subdir2/target-indirect-PARSEFILE-tA.tmp' because '__target-indirect-PARSEFILE-tA.tmp__' is defined Parse_PushInput: file target-indirect-PARSEDIR-PARSEFILE.tmp, line 1 Skipping 'target-indirect-PARSEDIR-PARSEFILE.tmp' because '__target-indirect-PARSEDIR-PARSEFILE.tmp__' is defined Parse_PushInput: file subdir/target-indirect-PARSEDIR-PARSEFILE.tmp, line 1 Index: src/usr.bin/make/unit-tests/directive-include-guard.mk diff -u src/usr.bin/make/unit-tests/directive-include-guard.mk:1.10 src/usr.bin/make/unit-tests/directive-include-guard.mk:1.11 --- src/usr.bin/make/unit-tests/directive-include-guard.mk:1.10 Wed Jun 21 14:33:36 2023 +++ src/usr.bin/make/unit-tests/directive-include-guard.mk Wed Jun 21 21:21:52 2023 @@ -1,4 +1,4 @@ -# $NetBSD: directive-include-guard.mk,v 1.10 2023/06/21 14:33:36 rillig Exp $ +# $NetBSD: directive-include-guard.mk,v 1.11 2023/06/21 21:21:52 sjg Exp $ # # Tests for multiple-inclusion guards in makefiles. # @@ -460,49 +460,8 @@ LINES.subdir/target-indirect-PARSEFILE= # expect: Parse_PushInput: file subdir/target-indirect-PARSEFILE.tmp, line 1 # expect: Skipping 'subdir/target-indirect-PARSEFILE.tmp' because '__target-indirect-PARSEFILE.tmp__' is defined -# Another common form of guard target is __${.PARSEFILE:tA}__. This form only -# works for files that are in the current working directory, it does not work -# for files from other directories, as the modifier ':tA' resolves a file -# relative to the current working directory ('.OBJDIR'). To get a robust -# pattern, use __${.PARSEDIR}/.${.PARSEFILE}__ instead. -INCS+= target-indirect-PARSEFILE-tA -LINES.target-indirect-PARSEFILE-tA= \ - '.if !target(__$${.PARSEFILE:tA}__)' \ - '__$${.PARSEFILE:tA}__: .NOTMAIN' \ - '.endif' -# expect: Parse_PushInput: file target-indirect-PARSEFILE-tA.tmp, line 1 -# expect: Skipping 'target-indirect-PARSEFILE-tA.tmp' because '__target-indirect-PARSEFILE-tA.tmp__' is defined -# The actual target starts with '__${.OBJDIR}/', see the .rawout file, but the -# string '${.OBJDIR}/' gets stripped in post processing. - -# Using the ':tA' modifier to construct guard target names is generally wrong, -# as the ':tA' modifier only works for files in the current working directory. -# For files from subdirectories that are not also found in the current working -# directory, applying the modifier ':tA' has no effect. -INCS+= subdir/target-indirect-PARSEFILE-tA -LINES.subdir/target-indirect-PARSEFILE-tA= \ - '.if !target(__$${.PARSEFILE:tA}__)' \ - '__$${.PARSEFILE:tA}__: .NOTMAIN' \ - '.endif' -# expect: Parse_PushInput: file subdir/target-indirect-PARSEFILE-tA.tmp, line 1 -# expect: Skipping 'subdir/target-indirect-PARSEFILE-tA.tmp' because '__target-indirect-PARSEFILE-tA.tmp__' is defined -# The guard target name does not include any directory since the ':tA' -# modifier file cannot resolve the file in the current working directory. - -# If there are two subdirectories that both have a file with the same basename -# that uses '${.PARSEFILE:tA}' as its guard target, the second file reuses the -# guard name from the first file. To get a robust scheme of guard target -# names, use
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Wed Jun 21 21:21:52 UTC 2023 Modified Files: src/usr.bin/make/unit-tests: directive-include-guard.exp directive-include-guard.mk Log Message: Cleanup guard tests The .PARSEFILE:tA tests add no value, the correct form is ${.PARSEDIR:tA}/${.PARSEFILE} but even there :tA rarely matters. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/usr.bin/make/unit-tests/directive-include-guard.exp cvs rdiff -u -r1.10 -r1.11 \ src/usr.bin/make/unit-tests/directive-include-guard.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed Jun 21 04:20:21 UTC 2023 Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: directive-include-guard.exp directive-include-guard.mk Log Message: Allow guard targets to use variables. I commonly use __${.PARSEDIR:tA}__ where a unique guard is needed, __${.PARSEDIR}__ is also useful in many cases. Combination of patch from rillig and mine To generate a diff of this commit: cvs rdiff -u -r1.350 -r1.351 src/usr.bin/make/cond.c cvs rdiff -u -r1.6 -r1.7 \ src/usr.bin/make/unit-tests/directive-include-guard.exp cvs rdiff -u -r1.7 -r1.8 \ src/usr.bin/make/unit-tests/directive-include-guard.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/cond.c diff -u src/usr.bin/make/cond.c:1.350 src/usr.bin/make/cond.c:1.351 --- src/usr.bin/make/cond.c:1.350 Tue Jun 20 09:25:33 2023 +++ src/usr.bin/make/cond.c Wed Jun 21 04:20:20 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.350 2023/06/20 09:25:33 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.351 2023/06/21 04:20:20 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -92,7 +92,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.350 2023/06/20 09:25:33 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.351 2023/06/21 04:20:20 sjg Exp $"); /* * Conditional expressions conform to this grammar: @@ -1252,22 +1252,6 @@ ParseVarnameGuard(const char **pp, const return false; } -static bool -ParseTargetGuard(const char **pp, const char **target) -{ - const char *p = *pp; - - if (ch_isalpha(*p) || *p == '_') { - while (ch_isalnum(*p) || *p == '_' || *p == '-' - || *p == '<' || *p == '>' || *p == '.' || *p == '/') - p++; - *target = *pp; - *pp = p; - return true; - } - return false; -} - /* Extracts the multiple-inclusion guard from a conditional, if any. */ Guard * Cond_ExtractGuard(const char *line) @@ -1292,9 +1276,17 @@ Cond_ExtractGuard(const char *line) && strcmp(p, ")") == 0) goto found_variable; } else if (skip_string(, "!target(")) { - if (ParseTargetGuard(, ) - && strcmp(p, ")") == 0) -goto found_target; + name = p; + free(ParseWord(, false)); + if (strcmp(p, ")") == 0) { +char *target; +p = name; +target = ParseWord(, true); +guard = bmake_malloc(sizeof(*guard)); +guard->kind = GK_TARGET; +guard->name = target; +return guard; + } } } else if (Substring_Equals(dir, "ifndef")) { if (ParseVarnameGuard(, ) && *p == '\0') @@ -1304,10 +1296,6 @@ Cond_ExtractGuard(const char *line) found_variable: kind = GK_VARIABLE; - goto found; -found_target: - kind = GK_TARGET; -found: guard = bmake_malloc(sizeof(*guard)); guard->kind = kind; guard->name = bmake_strsedup(name, p); Index: src/usr.bin/make/unit-tests/directive-include-guard.exp diff -u src/usr.bin/make/unit-tests/directive-include-guard.exp:1.6 src/usr.bin/make/unit-tests/directive-include-guard.exp:1.7 --- src/usr.bin/make/unit-tests/directive-include-guard.exp:1.6 Tue Jun 20 09:25:34 2023 +++ src/usr.bin/make/unit-tests/directive-include-guard.exp Wed Jun 21 04:20:21 2023 @@ -47,7 +47,13 @@ Skipping 'target.tmp' because '__target. Parse_PushInput: file target-sys.tmp, line 1 Skipping 'target-sys.tmp' because '' is defined Parse_PushInput: file target-indirect.tmp, line 1 -Parse_PushInput: file target-indirect.tmp, line 1 +Skipping 'target-indirect.tmp' because 'target-indirect.tmp' is defined +Parse_PushInput: file target-indirect-PARSEFILE.tmp, line 1 +Skipping 'target-indirect-PARSEFILE.tmp' because '__target-indirect-PARSEFILE.tmp__' is defined +Parse_PushInput: file target-indirect-PARSEFILE2.tmp, line 1 +Skipping 'target-indirect-PARSEFILE2.tmp' because '__target-indirect-PARSEFILE2.tmp__' is defined +Parse_PushInput: file target-indirect-PARSEFILE-tA.tmp, line 1 +Skipping 'target-indirect-PARSEFILE-tA.tmp' because '__target-indirect-PARSEFILE-tA.tmp__' is defined Parse_PushInput: file target-unguarded.tmp, line 1 Parse_PushInput: file target-unguarded.tmp, line 1 Parse_PushInput: file target-plus.tmp, line 1 Index: src/usr.bin/make/unit-tests/directive-include-guard.mk diff -u src/usr.bin/make/unit-tests/directive-include-guard.mk:1.7 src/usr.bin/make/unit-tests/directive-include-guard.mk:1.8 --- src/usr.bin/make/unit-tests/directive-include-guard.mk:1.7 Tue Jun 20 09:25:34 2023 +++ src/usr.bin/make/unit-tests/directive-include-guard.mk Wed Jun 21 04:20:21 2023 @@ -1,4 +1,4 @@ -# $NetBSD: directive-include-guard.mk,v 1.7 2023/06/20 09:25:34 rillig Exp $ +# $NetBSD: directive-include-guard.mk,v 1.8 2023/06/21 04:20:21 sjg Exp $ # # Tests for multiple-inclusion guards in makefiles. # @@ -282,14 +282,45 @@ LINES.target-sys= \ # expect: Parse_PushInput: file target-sys.tmp, line 1 # expect:
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed Jun 21 04:20:21 UTC 2023 Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: directive-include-guard.exp directive-include-guard.mk Log Message: Allow guard targets to use variables. I commonly use __${.PARSEDIR:tA}__ where a unique guard is needed, __${.PARSEDIR}__ is also useful in many cases. Combination of patch from rillig and mine To generate a diff of this commit: cvs rdiff -u -r1.350 -r1.351 src/usr.bin/make/cond.c cvs rdiff -u -r1.6 -r1.7 \ src/usr.bin/make/unit-tests/directive-include-guard.exp cvs rdiff -u -r1.7 -r1.8 \ src/usr.bin/make/unit-tests/directive-include-guard.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Mon Jun 19 15:37:48 UTC 2023 Modified Files: src/usr.bin/make/unit-tests: var-readonly.mk Log Message: Test that .undef of readOnly variable fails To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-readonly.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/var-readonly.mk diff -u src/usr.bin/make/unit-tests/var-readonly.mk:1.2 src/usr.bin/make/unit-tests/var-readonly.mk:1.3 --- src/usr.bin/make/unit-tests/var-readonly.mk:1.2 Thu Jun 1 20:56:35 2023 +++ src/usr.bin/make/unit-tests/var-readonly.mk Mon Jun 19 15:37:48 2023 @@ -1,4 +1,4 @@ -# $NetBSD: var-readonly.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $ +# $NetBSD: var-readonly.mk,v 1.3 2023/06/19 15:37:48 sjg Exp $ # the answer N = 42 @@ -9,6 +9,12 @@ N = 666 .error N ($N) should be 42 .endif +# undef should fail +.undef N +.ifndef N +.error N should not be undef'd +.endif + .NOREADONLY: N # now we can change it N = 69
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Mon Jun 19 15:37:48 UTC 2023 Modified Files: src/usr.bin/make/unit-tests: var-readonly.mk Log Message: Test that .undef of readOnly variable fails To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-readonly.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Fri Jun 16 22:30:35 UTC 2023 Modified Files: src/usr.bin/make: var.c Log Message: make: do not allow delete of readOnly variable. Sometimes we mark a variable readOnly to guard against .undef To generate a diff of this commit: cvs rdiff -u -r1.1055 -r1.1056 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Fri Jun 16 22:30:35 UTC 2023 Modified Files: src/usr.bin/make: var.c Log Message: make: do not allow delete of readOnly variable. Sometimes we mark a variable readOnly to guard against .undef To generate a diff of this commit: cvs rdiff -u -r1.1055 -r1.1056 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1055 src/usr.bin/make/var.c:1.1056 --- src/usr.bin/make/var.c:1.1055 Thu Jun 1 07:44:10 2023 +++ src/usr.bin/make/var.c Fri Jun 16 22:30:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1055 2023/06/01 07:44:10 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1056 2023/06/16 22:30:35 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1055 2023/06/01 07:44:10 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1056 2023/06/16 22:30:35 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -513,6 +513,11 @@ Var_Delete(GNode *scope, const char *var DEBUG2(VAR, "%s: delete %s\n", scope->name, varname); v = he->value; + if (v->readOnly) { + DEBUG2(VAR, "%s: delete %s (readOnly)\n", + scope->name, varname); + return; + } if (v->inUse) { Parse_Error(PARSE_FATAL, "Cannot delete variable \"%s\" while it is used",
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed May 10 18:22:33 UTC 2023 Modified Files: src/usr.bin/make: make.1 var.c Log Message: Make :mtime operate on each word in variable value. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.365 -r1.366 src/usr.bin/make/make.1 cvs rdiff -u -r1.1053 -r1.1054 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Wed May 10 18:22:33 UTC 2023 Modified Files: src/usr.bin/make: make.1 var.c Log Message: Make :mtime operate on each word in variable value. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.365 -r1.366 src/usr.bin/make/make.1 cvs rdiff -u -r1.1053 -r1.1054 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.365 src/usr.bin/make/make.1:1.366 --- src/usr.bin/make/make.1:1.365 Tue May 9 20:53:23 2023 +++ src/usr.bin/make/make.1 Wed May 10 18:22:33 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.365 2023/05/09 20:53:23 sjg Exp $ +.\" $NetBSD: make.1,v 1.366 2023/05/10 18:22:33 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd May 9, 2023 +.Dd May 10, 2023 .Dt MAKE 1 .Os .Sh NAME @@ -1511,9 +1511,9 @@ If a .Ar timestamp value is not provided or is 0, the current time is used. .It Cm \&:mtime Ns Oo Cm = Ns Ar timestamp Oc -call +Call .Xr stat 2 -with the value as pathname; +with each word as pathname; use .Ql st_mtime as the new value. Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1053 src/usr.bin/make/var.c:1.1054 --- src/usr.bin/make/var.c:1.1053 Tue May 9 21:24:56 2023 +++ src/usr.bin/make/var.c Wed May 10 18:22:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1053 2023/05/09 21:24:56 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1054 2023/05/10 18:22:33 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1053 2023/05/09 21:24:56 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1054 2023/05/10 18:22:33 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -2833,49 +2833,69 @@ ApplyModifier_Match(const char **pp, Mod return AMR_OK; } +struct ModifyWord_MtimeArgs { + bool error; + bool fallback; + ApplyModifierResult rc; + time_t t; +}; + +static void +ModifyWord_Mtime(Substring word, SepBuf *buf, void *data) +{ + char tbuf[BUFSIZ]; + struct stat st; + struct ModifyWord_MtimeArgs *args = data; + + if (Substring_IsEmpty(word)) + return; + assert(word.end[0] == '\0'); /* assume null-terminated word */ + if (stat(word.start, ) < 0) { + if (args->error) { + Parse_Error(PARSE_FATAL, + "Cannot determine mtime for '%s': %s", + word.start, strerror(errno)); + args->rc = AMR_CLEANUP; + return; + } + if (args->fallback) + st.st_mtime = args->t; + else + time(_mtime); + } + snprintf(tbuf, sizeof(tbuf), "%u", (unsigned)st.st_mtime); + SepBuf_AddStr(buf, tbuf); +} + /* :mtime */ static ApplyModifierResult ApplyModifier_Mtime(const char **pp, ModChain *ch) { - char buf[BUFSIZ]; - Expr *expr = ch->expr; - const char *args, *mod = *pp; - struct stat st; - bool error = false; - int i = -1; + const char *p, *mod = *pp; + struct ModifyWord_MtimeArgs args; if (!ModMatchEq(mod, "mtime", ch)) return AMR_UNKNOWN; *pp += 5; - args = *pp; - if (args[0] == '=') { - args++; - if (!TryParseIntBase0(, )) { - if (strncmp(args, "error", 5) == 0) { -error = true; -args += 5; + p = *pp; + args.error = args.fallback = false; + args.rc = AMR_OK; + if (p[0] == '=') { + p++; + args.fallback = true; + if (!TryParseTime(, )) { + if (strncmp(p, "error", 5) == 0) { +args.error = true; +p += 5; } else return AMR_BAD; } - *pp = args; + *pp = p; } if (!ModChain_ShouldEval(ch)) return AMR_OK; - if (stat(Expr_Str(expr), ) < 0) { - if (error) { - Parse_Error(PARSE_FATAL, - "Cannot determine mtime for '%s': %s", - Expr_Str(expr), strerror(errno)); - return AMR_CLEANUP; - } - if (i < 0) - time(_mtime); - else - st.st_mtime = (time_t)i; - } - snprintf(buf, sizeof(buf), "%u", (unsigned)st.st_mtime); - Expr_SetValueOwn(expr, bmake_strdup(buf)); - return AMR_OK; + ModifyWords(ch, ModifyWord_Mtime, , ch->oneBigWord); + return args.rc; } static void
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue May 9 20:53:23 UTC 2023 Modified Files: src/usr.bin/make: make.1 var.c Log Message: make: :mtime=error throw error on stat(2) failure Sometimes we want fatal error if stat fails on the presumed pathname. To generate a diff of this commit: cvs rdiff -u -r1.364 -r1.365 src/usr.bin/make/make.1 cvs rdiff -u -r1.1051 -r1.1052 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.364 src/usr.bin/make/make.1:1.365 --- src/usr.bin/make/make.1:1.364 Tue May 9 20:14:27 2023 +++ src/usr.bin/make/make.1 Tue May 9 20:53:23 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.364 2023/05/09 20:14:27 sjg Exp $ +.\" $NetBSD: make.1,v 1.365 2023/05/09 20:53:23 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -1522,6 +1522,13 @@ If fails; use .Ar timestamp or current time. +If +.Ar timestamp +is set to +.Ql error , +then +.Xr stat 2 +failure will cause an error. .It Cm \&:tA Attempts to convert the value to an absolute path using .Xr realpath 3 . Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1051 src/usr.bin/make/var.c:1.1052 --- src/usr.bin/make/var.c:1.1051 Tue May 9 20:14:27 2023 +++ src/usr.bin/make/var.c Tue May 9 20:53:23 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1051 2023/05/09 20:14:27 sjg Exp $ */ +/* $NetBSD: var.c,v 1.1052 2023/05/09 20:53:23 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1051 2023/05/09 20:14:27 sjg Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1052 2023/05/09 20:53:23 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -2841,6 +2841,7 @@ ApplyModifier_Mtime(const char **pp, Mod Expr *expr = ch->expr; const char *args, *mod = *pp; struct stat st; + bool error = false; int i = -1; if (!ModMatchEq(mod, "mtime", ch)) @@ -2849,13 +2850,20 @@ ApplyModifier_Mtime(const char **pp, Mod args = *pp; if (args[0] == '=') { args++; - if (!TryParseIntBase0(, )) - return AMR_BAD; + if (!TryParseIntBase0(, )) { + if (strncmp(args, "error", 5) == 0) { +error = true; +args += 5; + } else +return AMR_BAD; + } *pp = args; } if (!ModChain_ShouldEval(ch)) return AMR_OK; if (stat(Expr_Str(expr), ) < 0) { + if (error) + return AMR_BAD; if (i < 0) time(_mtime); else
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue May 9 20:53:23 UTC 2023 Modified Files: src/usr.bin/make: make.1 var.c Log Message: make: :mtime=error throw error on stat(2) failure Sometimes we want fatal error if stat fails on the presumed pathname. To generate a diff of this commit: cvs rdiff -u -r1.364 -r1.365 src/usr.bin/make/make.1 cvs rdiff -u -r1.1051 -r1.1052 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: sjg Date: Tue May 9 20:14:28 UTC 2023 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make: make.1 var.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: varmod-mtime.exp varmod-mtime.mk Log Message: make: add :mtime to provide mtime of file The value of the variable is passed to stat(2) and st_mtime is new value. An optional arg can be used if stat(2) fails, otherwise the current time is used. See varmod-mtime.mk for usage examples. To generate a diff of this commit: cvs rdiff -u -r1.1258 -r1.1259 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.363 -r1.364 src/usr.bin/make/make.1 cvs rdiff -u -r1.1050 -r1.1051 src/usr.bin/make/var.c cvs rdiff -u -r1.333 -r1.334 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varmod-mtime.exp \ src/usr.bin/make/unit-tests/varmod-mtime.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: sjg Date: Tue May 9 20:14:28 UTC 2023 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make: make.1 var.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: varmod-mtime.exp varmod-mtime.mk Log Message: make: add :mtime to provide mtime of file The value of the variable is passed to stat(2) and st_mtime is new value. An optional arg can be used if stat(2) fails, otherwise the current time is used. See varmod-mtime.mk for usage examples. To generate a diff of this commit: cvs rdiff -u -r1.1258 -r1.1259 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.363 -r1.364 src/usr.bin/make/make.1 cvs rdiff -u -r1.1050 -r1.1051 src/usr.bin/make/var.c cvs rdiff -u -r1.333 -r1.334 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/varmod-mtime.exp \ src/usr.bin/make/unit-tests/varmod-mtime.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1258 src/distrib/sets/lists/tests/mi:1.1259 --- src/distrib/sets/lists/tests/mi:1.1258 Sun Apr 23 08:47:27 2023 +++ src/distrib/sets/lists/tests/mi Tue May 9 20:14:28 2023 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1258 2023/04/23 08:47:27 rillig Exp $ +# $NetBSD: mi,v 1.1259 2023/05/09 20:14:28 sjg Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6099,6 +6099,8 @@ ./usr/tests/usr.bin/make/unit-tests/varmod-match-escape.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-match.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-match.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/varmod-mtime.exptests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/varmod-mtime.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-no-match.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-no-match.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/varmod-order-numeric.exp tests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.363 src/usr.bin/make/make.1:1.364 --- src/usr.bin/make/make.1:1.363 Sun May 7 16:43:50 2023 +++ src/usr.bin/make/make.1 Tue May 9 20:14:27 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.363 2023/05/07 16:43:50 sjg Exp $ +.\" $NetBSD: make.1,v 1.364 2023/05/09 20:14:27 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd May 6, 2023 +.Dd May 9, 2023 .Dt MAKE 1 .Os .Sh NAME @@ -1510,6 +1510,18 @@ producing the formatted timestamp. If a .Ar timestamp value is not provided or is 0, the current time is used. +.It Cm \&:mtime Ns Oo Cm = Ns Ar timestamp Oc +call +.Xr stat 2 +with the value as pathname; +use +.Ql st_mtime +as the new value. +If +.Xr stat 2 +fails; use +.Ar timestamp +or current time. .It Cm \&:tA Attempts to convert the value to an absolute path using .Xr realpath 3 . Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1050 src/usr.bin/make/var.c:1.1051 --- src/usr.bin/make/var.c:1.1050 Tue May 9 16:26:59 2023 +++ src/usr.bin/make/var.c Tue May 9 20:14:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1050 2023/05/09 16:26:59 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1051 2023/05/09 20:14:27 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1050 2023/05/09 16:26:59 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1051 2023/05/09 20:14:27 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -2833,6 +2833,39 @@ ApplyModifier_Match(const char **pp, Mod return AMR_OK; } +/* :mtime */ +static ApplyModifierResult +ApplyModifier_Mtime(const char **pp, ModChain *ch) +{ + char buf[BUFSIZ]; + Expr *expr = ch->expr; + const char *args, *mod = *pp; + struct stat st; + int i = -1; + + if (!ModMatchEq(mod, "mtime", ch)) + return AMR_UNKNOWN; + *pp += 5; + args = *pp; + if (args[0] == '=') { + args++; + if (!TryParseIntBase0(, )) + return AMR_BAD; + *pp = args; + } + if (!ModChain_ShouldEval(ch)) + return AMR_OK; + if (stat(Expr_Str(expr), ) < 0) { + if (i < 0) + time(_mtime); + else + st.st_mtime = (time_t)i; + } + snprintf(buf, sizeof(buf), "%u", (unsigned)st.st_mtime); + Expr_SetValueOwn(expr, bmake_strdup(buf)); + return AMR_OK; +} + static void ParsePatternFlags(const char **pp, PatternFlags *pflags, bool *oneBigWord) { @@ -3815,6 +3848,8 @@ ApplyModifier(const char **pp, ModChain case
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun May 7 16:43:50 UTC 2023 Modified Files: src/usr.bin/make: make.1 Log Message: make.1: lose the trailing blank lines To generate a diff of this commit: cvs rdiff -u -r1.362 -r1.363 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun May 7 16:43:50 UTC 2023 Modified Files: src/usr.bin/make: make.1 Log Message: make.1: lose the trailing blank lines To generate a diff of this commit: cvs rdiff -u -r1.362 -r1.363 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.362 src/usr.bin/make/make.1:1.363 --- src/usr.bin/make/make.1:1.362 Sun May 7 16:32:47 2023 +++ src/usr.bin/make/make.1 Sun May 7 16:43:50 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.362 2023/05/07 16:32:47 sjg Exp $ +.\" $NetBSD: make.1,v 1.363 2023/05/07 16:43:50 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -2727,5 +2727,3 @@ using that token pool to abort the build Sometimes the attempt to suppress a cascade of unnecessary errors, can result in a seemingly unexplained .Ql *** Error code 6 - -
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun May 7 16:32:48 UTC 2023 Modified Files: src/usr.bin/make: make.1 Log Message: make: fix description of .PREFIX For at least 20 years, the setting of .PREFIX in make has not matched the documentation. Since the documented behavior does not match reality or POSIX make, fix the documentation. In FindDepsRegularPath str_basename is applied to .PREFIX this is wrong, but I was unable to verify fixing it was benign in NetBSD build - my NetBSD box (7.2) was unable to build known-good src with or without any patches. For now just document the behavior more accurately. To generate a diff of this commit: cvs rdiff -u -r1.361 -r1.362 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.361 src/usr.bin/make/make.1:1.362 --- src/usr.bin/make/make.1:1.361 Thu Mar 23 03:29:28 2023 +++ src/usr.bin/make/make.1 Sun May 7 16:32:47 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.361 2023/03/23 03:29:28 sjg Exp $ +.\" $NetBSD: make.1,v 1.362 2023/05/07 16:32:47 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd March 22, 2023 +.Dd May 6, 2023 .Dt MAKE 1 .Os .Sh NAME @@ -796,12 +796,10 @@ The list of sources for this target that known as .Sq Va \&? . .It Va .PREFIX -The file prefix of the target, containing only the file portion, no suffix -or preceding directory components; also known as +The name of the target with suffix (if declared in +.Ic .SUFFIXES ) +removed; also known as .Sq Va * . -The suffix must be one of the known suffixes declared with -.Ic .SUFFIXES , -or it is not recognized. .It Va .TARGET The name of the target; also known as .Sq Va @ .
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sun May 7 16:32:48 UTC 2023 Modified Files: src/usr.bin/make: make.1 Log Message: make: fix description of .PREFIX For at least 20 years, the setting of .PREFIX in make has not matched the documentation. Since the documented behavior does not match reality or POSIX make, fix the documentation. In FindDepsRegularPath str_basename is applied to .PREFIX this is wrong, but I was unable to verify fixing it was benign in NetBSD build - my NetBSD box (7.2) was unable to build known-good src with or without any patches. For now just document the behavior more accurately. To generate a diff of this commit: cvs rdiff -u -r1.361 -r1.362 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu May 4 22:31:17 UTC 2023 Modified Files: src/usr.bin/make: compat.c Log Message: Compat_RunCommand mark bp volatile gcc 4.8.5 (NetBSD 7.2) gets upset about bp. To generate a diff of this commit: cvs rdiff -u -r1.246 -r1.247 src/usr.bin/make/compat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.246 src/usr.bin/make/compat.c:1.247 --- src/usr.bin/make/compat.c:1.246 Sat Mar 18 22:20:11 2023 +++ src/usr.bin/make/compat.c Thu May 4 22:31:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.246 2023/03/18 22:20:11 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.247 2023/05/04 22:31:17 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.246 2023/03/18 22:20:11 sjg Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.247 2023/05/04 22:31:17 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -221,7 +221,7 @@ bool Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln) { char *cmdStart; /* Start of expanded command */ - char *bp; + char *volatile bp; bool silent; /* Don't print command */ bool doIt; /* Execute even if -n */ volatile bool errCheck; /* Check errors */
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu May 4 22:31:17 UTC 2023 Modified Files: src/usr.bin/make: compat.c Log Message: Compat_RunCommand mark bp volatile gcc 4.8.5 (NetBSD 7.2) gets upset about bp. To generate a diff of this commit: cvs rdiff -u -r1.246 -r1.247 src/usr.bin/make/compat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Mar 23 03:29:28 UTC 2023 Modified Files: src/usr.bin/make: make.1 Log Message: Document unexplained *** Error code 6 To generate a diff of this commit: cvs rdiff -u -r1.360 -r1.361 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.360 src/usr.bin/make/make.1:1.361 --- src/usr.bin/make/make.1:1.360 Thu Jan 26 20:48:17 2023 +++ src/usr.bin/make/make.1 Thu Mar 23 03:29:28 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.360 2023/01/26 20:48:17 sjg Exp $ +.\" $NetBSD: make.1,v 1.361 2023/03/23 03:29:28 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd January 26, 2023 +.Dd March 22, 2023 .Dt MAKE 1 .Os .Sh NAME @@ -267,7 +267,9 @@ cooperate to avoid overloading the syste Specify the maximum number of jobs that .Nm may have running at any one time. -The value is saved in +The value of +.Ar max_jobs +is saved in .Va .MAKE.JOBS . Turns compatibility mode off, unless the .Fl B @@ -280,6 +282,13 @@ command invocation and then expect to st on the next line. It is more efficient to correct the scripts rather than turn backwards compatibility on. +.Pp +A job token pool with +.Ar max_jobs +tokens is used to control the total number of jobs running. +Each instance of +.Nm +will wait for a token from the pool before running a new job. .It Fl k Continue processing after errors are encountered, but only on those targets that do not depend on the target whose creation caused the error. @@ -2710,3 +2719,15 @@ In many places just counts {} and () in order to find the end of a variable expansion. .Pp There is no way of escaping a space character in a filename. +.Pp +In jobs mode, when a target fails; +.Nm +will put an error token into the job token pool. +This will cause all other instances of +.Nm +using that token pool to abort the build and exit with error code 6. +Sometimes the attempt to suppress a cascade of unnecessary errors, +can result in a seemingly unexplained +.Ql *** Error code 6 + +
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Thu Mar 23 03:29:28 UTC 2023 Modified Files: src/usr.bin/make: make.1 Log Message: Document unexplained *** Error code 6 To generate a diff of this commit: cvs rdiff -u -r1.360 -r1.361 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Mar 18 22:20:12 UTC 2023 Modified Files: src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: cmd-interrupt.exp cmd-interrupt.mk deptgt-delete_on_error.exp Log Message: make: handle .PHONY consitently on interrupt JobDeleteTarget skips .PHONY targets CompatDeleteTarget should do the same This addresses https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269663 To generate a diff of this commit: cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/compat.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-interrupt.exp \ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-interrupt.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.245 src/usr.bin/make/compat.c:1.246 --- src/usr.bin/make/compat.c:1.245 Tue Feb 14 21:38:31 2023 +++ src/usr.bin/make/compat.c Sat Mar 18 22:20:11 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.245 2023/02/14 21:38:31 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.246 2023/03/18 22:20:11 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -91,7 +91,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.245 2023/02/14 21:38:31 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.246 2023/03/18 22:20:11 sjg Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -104,7 +104,8 @@ static int compatSigno; static void CompatDeleteTarget(GNode *gn) { - if (gn != NULL && !GNode_IsPrecious(gn)) { + if (gn != NULL && !GNode_IsPrecious(gn) && + (gn->type & OP_PHONY) == 0) { const char *file = GNode_VarTarget(gn); if (!opts.noExecute && unlink_file(file) == 0) { Index: src/usr.bin/make/unit-tests/cmd-interrupt.exp diff -u src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.2 src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.3 --- src/usr.bin/make/unit-tests/cmd-interrupt.exp:1.2 Fri Aug 28 18:16:22 2020 +++ src/usr.bin/make/unit-tests/cmd-interrupt.exp Sat Mar 18 22:20:12 2023 @@ -2,7 +2,6 @@ make: *** cmd-interrupt-ordinary removed interrupt-ordinary: ok > cmd-interrupt-phony -make: *** cmd-interrupt-phony removed interrupt-phony: ok > cmd-interrupt-precious interrupt-precious: ok Index: src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp diff -u src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.2 src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.3 --- src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.2 Sun Oct 25 21:31:00 2020 +++ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp Sat Mar 18 22:20:12 2023 @@ -7,10 +7,8 @@ make: *** deptgt-delete_on_error-regular make: *** deptgt-delete_on_error-regular-delete removed > deptgt-delete_on_error-phony; false *** Error code 1 (continuing) -make: *** deptgt-delete_on_error-phony removed > deptgt-delete_on_error-phony-delete; false *** Error code 1 (continuing) -make: *** deptgt-delete_on_error-phony-delete removed > deptgt-delete_on_error-precious; false *** Error code 1 (continuing) > deptgt-delete_on_error-precious-delete; false Index: src/usr.bin/make/unit-tests/cmd-interrupt.mk diff -u src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.3 src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.4 --- src/usr.bin/make/unit-tests/cmd-interrupt.mk:1.3 Sun Nov 15 14:07:53 2020 +++ src/usr.bin/make/unit-tests/cmd-interrupt.mk Sat Mar 18 22:20:12 2023 @@ -1,4 +1,4 @@ -# $NetBSD: cmd-interrupt.mk,v 1.3 2020/11/15 14:07:53 rillig Exp $ +# $NetBSD: cmd-interrupt.mk,v 1.4 2023/03/18 22:20:12 sjg Exp $ # # Tests for interrupting a command. # @@ -30,7 +30,7 @@ interrupt-ordinary: interrupt-phony: .PHONY @${.MAKE} ${MAKEFLAGS} -f ${MAKEFILE} cmd-interrupt-phony || true # The ././ is necessary to work around the file cache. - @echo ${.TARGET}: ${exists(././cmd-interrupt-phony) :? error : ok } + @echo ${.TARGET}: ${exists(././cmd-interrupt-phony) :? ok : error } interrupt-precious: .PRECIOUS @${.MAKE} ${MAKEFLAGS} -f ${MAKEFILE} cmd-interrupt-precious || true
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Mar 18 22:20:12 UTC 2023 Modified Files: src/usr.bin/make: compat.c src/usr.bin/make/unit-tests: cmd-interrupt.exp cmd-interrupt.mk deptgt-delete_on_error.exp Log Message: make: handle .PHONY consitently on interrupt JobDeleteTarget skips .PHONY targets CompatDeleteTarget should do the same This addresses https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269663 To generate a diff of this commit: cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/compat.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmd-interrupt.exp \ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cmd-interrupt.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/usr.bin/make
Taylor R Campbell wrote: > That said, I don't see any reason why this should be a macro in the > first place. If there is a compelling reason, please write it down; > if not, please change it to a static function: > Sure. > static BuildMon * > BM(Job *job) > { > > return (job != NULL ? >bm : ); > }
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue Feb 28 06:04:28 UTC 2023 Modified Files: src/usr.bin/make: meta.c Log Message: Use inline function rather that macro BM To generate a diff of this commit: cvs rdiff -u -r1.203 -r1.204 src/usr.bin/make/meta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/meta.c diff -u src/usr.bin/make/meta.c:1.203 src/usr.bin/make/meta.c:1.204 --- src/usr.bin/make/meta.c:1.203 Sat Feb 25 22:52:21 2023 +++ src/usr.bin/make/meta.c Tue Feb 28 06:04:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.203 2023/02/25 22:52:21 sjg Exp $ */ +/* $NetBSD: meta.c,v 1.204 2023/02/28 06:04:28 sjg Exp $ */ /* * Implement 'meta' mode. @@ -99,8 +99,6 @@ extern char**environ; # define strsep(s, d) stresep((s), (d), '\0') #endif -#define BM(job) (job != NULL) ? >bm : - /* * Filemon is a kernel module which snoops certain syscalls. * @@ -636,6 +634,13 @@ meta_mode_init(const char *make_mode) metaCmpFilter = Var_Exists(SCOPE_GLOBAL, MAKE_META_CMP_FILTER); } +MAKE_INLINE BuildMon * +BM(Job *job) +{ + + return ((job != NULL) ? >bm : ); +} + /* * In each case below we allow for job==NULL */
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Tue Feb 28 06:04:28 UTC 2023 Modified Files: src/usr.bin/make: meta.c Log Message: Use inline function rather that macro BM To generate a diff of this commit: cvs rdiff -u -r1.203 -r1.204 src/usr.bin/make/meta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Feb 25 22:52:22 UTC 2023 Modified Files: src/usr.bin/make: meta.c Log Message: meta.c: use macro to access job->bm and if job is NULL use Mybm. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.202 -r1.203 src/usr.bin/make/meta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.