Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1640978rwb; Fri, 13 Jan 2023 15:31:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXuN9HPH8X96EfuDBOJBrCBEndBbVP9cvaH/EaTfoeKmdRvau1mb0IHi4mYdDb2+OtaLO1kH X-Received: by 2002:a17:903:1209:b0:193:2303:c9e5 with SMTP id l9-20020a170903120900b001932303c9e5mr32383778plh.20.1673652694401; Fri, 13 Jan 2023 15:31:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673652694; cv=none; d=google.com; s=arc-20160816; b=ENWw6mfEKbsabLy0aYYqWWlOxEWyNiBcdA5I5uby/pgq2osJZTeBESqOaPYKPqRm/u KfsNGfL706gKT4lzV/pqoiSYnXiiVBMMUYqZWe3I+B7yvIpVxuV3Vw6EiS+jgyLxBy3Q G74ZcdQhiflOUva5Xm6PCJIm8PmGu/LfEbtONU3pEfr8YNyE/wY2NsPkfE15Gqh6bzfr pdgUqkZO/C1J7uA870h1M5HHehZlTG2OGSuekNsHLfNz8/5ptMfiP6nTf7I3GVgNLTuC X44J+p1HzaWbdNp/pzOnjknwFRfr1IblMy1XvoqYv938Ej50bczDC+cSbX/TX+G4gDg2 U3yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BY609W+RhGncJpLGsLFTmsHR4NCyfTU2HTS8CdOqR80=; b=0X4JrrBHck+oYMI8irTEjfcqV45jIJnvOpgomlQLz8XORaWPa9ywUezHeSqUZrGuI/ r+WJGnzEj3ec3b82ETcwSne++60GZNO+6YjU4xXnQcbkAphndgP1S7VTOTxbFjcGSKzP OXe0CJNp+xspXumpFGP7w5uAGUJcRkh6vS7hoxggehq4uXa5Qq8B8QanmVsnLuta7HrT vG+jz0H574gmh8/aaOUgqNMWA4QXXcheCQEQKAxMIJ6STpZ1GaJOXpuBRg/TDGRQIy4c VAgTNcRa7ZSY3uLnr49qkqTvcHUw3Nc8HxzS5ClPZzSdy/2DS8MoaIKvFIhH0x5snPki XlLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BBLnmu7w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ja14-20020a170902efce00b0018f9d68f452si2208653plb.195.2023.01.13.15.31.25; Fri, 13 Jan 2023 15:31:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BBLnmu7w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231383AbjAMXM0 (ORCPT + 52 others); Fri, 13 Jan 2023 18:12:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbjAMXMY (ORCPT ); Fri, 13 Jan 2023 18:12:24 -0500 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 906F552C6A; Fri, 13 Jan 2023 15:12:23 -0800 (PST) Received: by mail-yb1-xb36.google.com with SMTP id p188so24183675yba.5; Fri, 13 Jan 2023 15:12:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BY609W+RhGncJpLGsLFTmsHR4NCyfTU2HTS8CdOqR80=; b=BBLnmu7wTpyRpe1vlSApwJwOufO4BV2eXl8TNYC9oUJBKH082MttNKekZu41Pusf9m VmfJY4sr3we8ivvg8AJjtAGHmZCSZXt+BYZFuCNC1/j6iawjyIKQlVvQKKPiGt2F5fRE BjTkdPI4pDiWuvuCxVhCQfBOdIgBWJIwLEw/3tRTKIQJJOxLXKmlEBpNBoTQmslLiYrq ByKa9bMiyp26P8upBsPMMyrfkeWZDxgpqFaQb1jVNzq6/OLBpMBe33IV8qfcG+PoMtPh Ewg377TuvH4xJFzn3ahp+hGywE5Kb1w3ojHCFMZH0ok9JoRTIhKonHFFy2rK8BFCBeLa P0WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BY609W+RhGncJpLGsLFTmsHR4NCyfTU2HTS8CdOqR80=; b=tsfohfGuYSmQr46m22m9dVhu8D/RWCPiZyPcUwrUeXLRkVJLcTkF9I3K39l0Wt031j 3uMvkJUywBxS5oHR5dlxqWRcbaCqaikSrfvxG4/eGg/RTuZachss0HSP4HAhJQt3v7p+ Skw4e2lWE4PzremfRHy7NAPbd3N83Qqim5NFoVUliCcSwFJXghBfWgKbU4adGHES077g LzEYPoc7eB6eqzYtpEQ5RRvp1JSm2m2O/BaAOcHX5x4WTY9qUJs0aJnTSMA8y4B+mgli OqUGFwvFDcBmytN2N4vs459f9TrCvRxTgkx+Wp6gLEAOhVBZD3uV/GsidCF7vaiTDGhl P1fw== X-Gm-Message-State: AFqh2kqHiiKbDs3/jnQDTaX4mZn2+/ppdgW1L17HO3txurA1Q+GDq6eL an56WlLsxBs3eFCe0Yiercl2kZku0GxqifEWu44= X-Received: by 2002:a25:7702:0:b0:7b4:bdd7:e631 with SMTP id s2-20020a257702000000b007b4bdd7e631mr3698278ybc.507.1673651542817; Fri, 13 Jan 2023 15:12:22 -0800 (PST) MIME-Version: 1.0 References: <20230109204520.539080-1-ojeda@kernel.org> <20230109204520.539080-4-ojeda@kernel.org> In-Reply-To: From: Miguel Ojeda Date: Sat, 14 Jan 2023 00:12:11 +0100 Message-ID: Subject: Re: [PATCH 4/6] kbuild: rust_is_available: check if the script was invoked from Kbuild To: Masahiro Yamada Cc: Miguel Ojeda , linux-kbuild@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2023 at 6:29 AM Masahiro Yamada wrote: > > I do not like this. > We do not need to cater to every oddity. > > Checking MAKEFLAGS is too much. I agree we should not attempt to catch every possible mistake in the script, but there have been several people hitting precisely this case (the latest is in the linked thread in the commit message), i.e. some people read the `Makefile` and notice the script invocation, and go execute it, but they are unlikely to be aware of the target in that case. > You can check RUSTC/BINDGEN/CC if you persist in this. This is fine, and actually we should do it regardless of `MAKEFLAGS`. I can add it to v2. However, that does not cover the same thing as `MAKEFLAGS` is trying to here. The reason is that even if they see e.g. "RUSTC is not set", they will not know about how to call the script properly, i.e. through the `Makefile` target. For `RUSTC` and `BINDGEN`, it does not really matter (and we could give a default to the variable, since the name rarely would be different). However, for `CC`, the logic that Kbuild uses is more complex, so it seems best to me to let Kbuild tell us what the actual compiler is. Cheers, Miguel