* [Buildroot] [PATCH 1/1] Makefile: identify silent make via firstword findstring
@ 2022-10-14 23:09 James Hilliard
2022-10-30 20:26 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: James Hilliard @ 2022-10-14 23:09 UTC (permalink / raw)
To: buildroot; +Cc: James Hilliard
Make recommends using this technique for identifying short options.
From make NEWS for upcoming version 4.4:
Previously only simple (one-letter) options were added to the MAKEFLAGS
variable that was visible while parsing makefiles. Now, all options are
available in MAKEFLAGS. If you want to check MAKEFLAGS for a one-letter
option, expanding "$(firstword -$(MAKEFLAGS))" is a reliable way to return
the set of one-letter options which can be examined via findstring, etc.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index ec7c034ac1..2d31fd45fa 100644
--- a/Makefile
+++ b/Makefile
@@ -434,7 +434,7 @@ PACKAGES :=
PACKAGES_ALL :=
# silent mode requested?
-QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
+QUIET := $(if $(findstring s,$(firstword -$(MAKEFLAGS))),-q)
# Strip off the annoying quoting
ARCH := $(call qstrip,$(BR2_ARCH))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH 1/1] Makefile: identify silent make via firstword findstring
2022-10-14 23:09 [Buildroot] [PATCH 1/1] Makefile: identify silent make via firstword findstring James Hilliard
@ 2022-10-30 20:26 ` Thomas Petazzoni via buildroot
2022-10-30 20:35 ` James Hilliard
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-10-30 20:26 UTC (permalink / raw)
To: James Hilliard; +Cc: buildroot
Hello James,
On Fri, 14 Oct 2022 17:09:05 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:
> +QUIET := $(if $(findstring s,$(firstword -$(MAKEFLAGS))),-q)
I must be missing something, but why is -$(MAKEFLAGS) used and not just
$(MAKEFLAGS) ?
Indeed, with "make -s --debug -k", $(MAKEFLAGS) is "ks --debug=all",
and therefore $(firstword $(MAKEFLAGS)) is ks, which is good enough for
the findstring s, no? Why is adding a - in front needed?
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH 1/1] Makefile: identify silent make via firstword findstring
2022-10-30 20:26 ` Thomas Petazzoni via buildroot
@ 2022-10-30 20:35 ` James Hilliard
2023-04-10 19:44 ` Arnout Vandecappelle
0 siblings, 1 reply; 4+ messages in thread
From: James Hilliard @ 2022-10-30 20:35 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot
On Sun, Oct 30, 2022 at 4:26 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello James,
>
> On Fri, 14 Oct 2022 17:09:05 -0600
> James Hilliard <james.hilliard1@gmail.com> wrote:
>
> > +QUIET := $(if $(findstring s,$(firstword -$(MAKEFLAGS))),-q)
>
> I must be missing something, but why is -$(MAKEFLAGS) used and not just
> $(MAKEFLAGS) ?
>
> Indeed, with "make -s --debug -k", $(MAKEFLAGS) is "ks --debug=all",
> and therefore $(firstword $(MAKEFLAGS)) is ks, which is good enough for
> the findstring s, no? Why is adding a - in front needed?
I think so that if $(MAKEFLAGS) doesn't have any short options that it won't
accidentally match on a long option.
For example if $(MAKEFLAGS) is " --shuffle=none" the - in front ensures that
we don't match the s in a long option like shuffle.
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH 1/1] Makefile: identify silent make via firstword findstring
2022-10-30 20:35 ` James Hilliard
@ 2023-04-10 19:44 ` Arnout Vandecappelle
0 siblings, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2023-04-10 19:44 UTC (permalink / raw)
To: James Hilliard, Thomas Petazzoni; +Cc: buildroot
On 30/10/2022 21:35, James Hilliard wrote:
> On Sun, Oct 30, 2022 at 4:26 PM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
>>
>> Hello James,
>>
>> On Fri, 14 Oct 2022 17:09:05 -0600
>> James Hilliard <james.hilliard1@gmail.com> wrote:
>>
>>> +QUIET := $(if $(findstring s,$(firstword -$(MAKEFLAGS))),-q)
>>
>> I must be missing something, but why is -$(MAKEFLAGS) used and not just
>> $(MAKEFLAGS) ?
>>
>> Indeed, with "make -s --debug -k", $(MAKEFLAGS) is "ks --debug=all",
>> and therefore $(firstword $(MAKEFLAGS)) is ks, which is good enough for
>> the findstring s, no? Why is adding a - in front needed?
>
> I think so that if $(MAKEFLAGS) doesn't have any short options that it won't
> accidentally match on a long option.
>
> For example if $(MAKEFLAGS) is " --shuffle=none" the - in front ensures that
> we don't match the s in a long option like shuffle.
Exactly right.
However, the firstword approach doesn't work with GNU make 3.81. For example,
the following invocation:
make --no-print-directory -s
will set MAKEFLAGS to " --no-print-directory -s", so the firstword approach
*doesn't* find the -s, but the filter-out approach does.
Therefore, I marked this patch as Rejected.
Regards,
Arnout
>
>>
>> Thanks!
>>
>> Thomas
>> --
>> Thomas Petazzoni, co-owner and CEO, Bootlin
>> Embedded Linux and Kernel engineering and training
>> https://bootlin.com
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-10 19:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-14 23:09 [Buildroot] [PATCH 1/1] Makefile: identify silent make via firstword findstring James Hilliard
2022-10-30 20:26 ` Thomas Petazzoni via buildroot
2022-10-30 20:35 ` James Hilliard
2023-04-10 19:44 ` Arnout Vandecappelle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox