03.11.2024 15:37, Marc Espie пишет: > Something like this in make is definitely trivial.
I did just that using the existing -s: Index: compat.c =================================================================== RCS file: /cvs/src/usr.bin/make/compat.c,v diff -u -p -r1.95 compat.c --- compat.c 18 Jun 2024 02:11:03 -0000 1.95 +++ compat.c 22 Oct 2024 21:09:06 -0000 @@ -274,9 +274,10 @@ Compat_Run(Lst targs, bool *has_errors, while ((gn = Lst_DeQueue(targs)) != NULL) { CompatMake(gn, NULL); - if (gn->built_status == UPTODATE) - printf("`%s' is up to date.\n", gn->name); - else if (gn->built_status == ABORTED) { + if (gn->built_status == UPTODATE) { + if (!beSilent) + printf("`%s' is up to date.\n", gn->name); + }else if (gn->built_status == ABORTED) { printf("`%s' not remade because of errors.\n", gn->name); *out_of_date = true; > > Big question is, are we okay with yet another option ?: New -Q seems fine as to me as well and it does not exist in other implementations I know of, so no conflict. Marc, can you elaborate on the second instance of "is up to date" in make.c and why it does not get the same treat? Nit: quietUpdateFlag would better match -Q. > > Index: compat.c > =================================================================== > RCS file: /cvs/src/usr.bin/make/compat.c,v > diff -u -p -r1.93 compat.c > --- compat.c 26 Jan 2020 12:41:21 -0000 1.93 > +++ compat.c 3 Nov 2024 12:35:33 -0000 > @@ -275,9 +275,10 @@ Compat_Run(Lst targs, bool *has_errors, > while ((gn = Lst_DeQueue(targs)) != NULL) { > CompatMake(gn, NULL); > > - if (gn->built_status == UPTODATE) > - printf("`%s' is up to date.\n", gn->name); > - else if (gn->built_status == ABORTED) { > + if (gn->built_status == UPTODATE) { > + if (!silentUpdateFlag) > + printf("`%s' is up to date.\n", gn->name); > + } else if (gn->built_status == ABORTED) { > printf("`%s' not remade because of errors.\n", > gn->name); > *out_of_date = true; > Index: extern.h > =================================================================== > RCS file: /cvs/src/usr.bin/make/extern.h,v > diff -u -p -r1.44 extern.h > --- extern.h 13 Jan 2020 14:51:50 -0000 1.44 > +++ extern.h 3 Nov 2024 12:35:33 -0000 > @@ -42,6 +42,7 @@ > > extern bool ignoreErrors; /* True if should ignore all errors */ > extern bool beSilent; /* True if should print no commands */ > +extern bool silentUpdateFlag; /* True if shouldn't print 'is up-to-date' */ > extern bool noExecute; /* True if should execute nothing */ > extern bool allPrecious; /* True if every target is precious */ > extern bool keepgoing; /* True if should continue on unaffected > Index: main.c > =================================================================== > RCS file: /cvs/src/usr.bin/make/main.c,v > diff -u -p -r1.127 main.c > --- main.c 13 Jan 2020 15:41:53 -0000 1.127 > +++ main.c 3 Nov 2024 12:35:33 -0000 > @@ -86,6 +86,7 @@ bool touchFlag; /* -t flag */ > bool ignoreErrors; /* -i flag */ > bool beSilent; /* -s flag */ > bool dumpData; /* -p flag */ > +bool silentUpdateFlag; /* -Q flag */ > > struct dirs { > char *current; > @@ -192,7 +193,7 @@ MainParseArgs(int argc, char **argv) > { > int c, optend; > > -#define OPTFLAGS "BC:D:I:SV:d:ef:ij:km:npqrst" > +#define OPTFLAGS "BC:D:I:SV:d:ef:ij:km:npqQrst" > #define OPTLETTERS "BSiknpqrst" > > if (pledge("stdio rpath wpath cpath fattr proc exec", NULL) == -1) > @@ -332,6 +333,9 @@ MainParseArgs(int argc, char **argv) > Dir_AddDir(systemIncludePath, optarg); > record_option(c, optarg); > break; > + case 'Q': > + silentUpdateFlag = true; > + break; > case -1: > /* Check for variable assignments and targets. */ > if (argv[optind] != NULL && > @@ -668,6 +672,7 @@ main(int argc, char **argv) > Static_Lst_Init(&special); > > beSilent = false; /* Print commands as executed */ > + silentUpdateFlag = false; /* show "is up-to-date" messages */ > ignoreErrors = false; /* Pay attention to non-zero returns */ > noExecute = false; /* Execute all commands */ > keepgoing = false; /* Stop on error */ > Index: make.1 > =================================================================== > RCS file: /cvs/src/usr.bin/make/make.1,v > diff -u -p -r1.133 make.1 > --- make.1 8 Mar 2021 06:20:50 -0000 1.133 > +++ make.1 3 Nov 2024 12:35:33 -0000 > @@ -38,7 +38,7 @@ > .Nd maintain program dependencies > .Sh SYNOPSIS > .Nm make > -.Op Fl BeiknpqrSst > +.Op Fl BeiknpQqrSst > .Op Fl C Ar directory > .Op Fl D Ar variable > .Op Fl d Ar flags > @@ -254,6 +254,10 @@ Using > .Fl m > will override the default system include directory > .Pa /usr/share/mk . > +.It Fl Q > +Don't display > +.Sq is up-to-date > +messages. > .It Fl V Ar variable > Print > .Nm make Ns 's >