public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Smith <psmith@gnu.org>
To: Sergei Trofimovich <slyich@gmail.com>, libc-alpha@sourceware.org
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>
Subject: Re: [PATCH v2] Makerules: fix MAKEFLAGS assignment for upcoming make-4.4 [BZ# 29564]
Date: Mon, 12 Sep 2022 18:47:11 -0400	[thread overview]
Message-ID: <874f0d588c3f96e96a3e2971eaa43b070ba4172e.camel@gnu.org> (raw)
In-Reply-To: <20220912212711.2819763-1-slyich@gmail.com>

On Mon, 2022-09-12 at 22:27 +0100, Sergei Trofimovich wrote:
> +ifeq ($(findstring s, $(filter-out --% , $(MAKEFLAGS))),)

A more reliable, and guaranteed correct, way to do this is:

  ifeq ($(findstring s,$(firstword -$(MAKEFLAGS)),)

GNU make guarantees that all options which can possibly be represented
as single-letter options will always appear in the first word of
MAKEFLAGS (even if the user used the long option on make's command
line).

It also guarantees that there will be a space before any non-short
options, including if there are no short options given.  In that case
"-$(MAKEFLAGS)" would expand to "- --shuffle=random" (for example) and
firstword would give you just "-".

The filter-out is not as reliable, as it could be possible, someday, to
not filter out something and match incorrectly.

  reply	other threads:[~2022-09-12 22:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 11:50 [PATCH] Makefules: fix MAKEFLAGS assignment for upcoming make-4.4 Sergei Trofimovich
2022-09-12 20:27 ` Siddhesh Poyarekar
2022-09-12 21:27   ` [PATCH v2] Makerules: fix MAKEFLAGS assignment for upcoming make-4.4 [BZ# 29564] Sergei Trofimovich
2022-09-12 22:47     ` Paul Smith [this message]
2022-09-12 23:07       ` [PATCH v3] " Sergei Trofimovich
2022-09-13 14:21         ` Siddhesh Poyarekar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874f0d588c3f96e96a3e2971eaa43b070ba4172e.camel@gnu.org \
    --to=psmith@gnu.org \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@gotplt.org \
    --cc=slyich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).