From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 72B9A3858C00 for ; Mon, 12 Sep 2022 22:47:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72B9A3858C00 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]:49850) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXsCu-0004GE-Nr; Mon, 12 Sep 2022 18:47:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:To:From: Subject; bh=Ef9FFiSW2TCy3b7UsrKcSUTQID4KDFEU+X1yxY/x/Do=; b=HWQ712/H7EFtSvUr2 u5BtyVIOOREeyk+Xsdxem406qmNakN5lcUyD7dasg1shXECTonSscrbE1nNR12PF7oFBBO8beNzjV blZVjxGG0h3DyVoDuIkcP+4ym9pE+6WwfriY4jzxmSaCFeXdvvxOO4t8ZDDoq7gP3p371gi2qk/Bh UfWOoHLGjG2rn+S5TuuBlB9bT8RwBFyXKbfso3KWRN4qgmngla4tZK199R6qnpc26F1Ua+hwh0eDV 0CMzAakheAyVSTyh5Oz97i9+HKfVbGnQkAiJFBKjJ6RdzYLyv0t3o9S8PUEUU2ZxvjP/KaTGR/kz0 RO0koDP/DbrbO7Iwg==; Received: from [160.231.0.90] (port=15722 helo=llin-psh13-dsa.dsone.3ds.com) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXsCu-0001mI-Gf; Mon, 12 Sep 2022 18:47:12 -0400 Message-ID: <874f0d588c3f96e96a3e2971eaa43b070ba4172e.camel@gnu.org> Subject: Re: [PATCH v2] Makerules: fix MAKEFLAGS assignment for upcoming make-4.4 [BZ# 29564] From: Paul Smith Reply-To: psmith@gnu.org To: Sergei Trofimovich , libc-alpha@sourceware.org Cc: Siddhesh Poyarekar Date: Mon, 12 Sep 2022 18:47:11 -0400 In-Reply-To: <20220912212711.2819763-1-slyich@gmail.com> References: <20220912212711.2819763-1-slyich@gmail.com> Organization: GNU's Not UNIX! Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (by Flathub.org) MIME-Version: 1.0 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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=3Drandom" (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.