From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5CADC433F5 for ; Wed, 6 Apr 2022 17:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238574AbiDFR3k (ORCPT ); Wed, 6 Apr 2022 13:29:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238895AbiDFR3M (ORCPT ); Wed, 6 Apr 2022 13:29:12 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D2639BD8C; Wed, 6 Apr 2022 08:31:42 -0700 (PDT) Received: from grover.sesame (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 236FUcaR017647; Thu, 7 Apr 2022 00:30:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 236FUcaR017647 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649259040; bh=ZjLI+JlU2bV41qJ132mX31sa9fHjwtqOwYEH0MoaLug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HwKWHytb/6NOhlKUWo3ktzf0qSgbOIzHs0XdE40KePawNCjaYQcr/E3j79K19sAxi lNzL5XnbhtRn3Be9QzMacoDGrvMw+8vcV9vl1bY//3aozWeomBXjc1TA1tnjyzTwSF lua7dFcQ6ON4jAGhAXyub/UC3YZAZVMGlZnRN9AqjCA/OAEifO1iwf5c7km9iye0IV Oml2F/uru4fWLk4aNMl37QFbCTm6Bsq/+qON1vnPDeK+a3HD5LoXHmHqXOb+WAFoYO ac7klb5GGIwx3O1JtR/owTXiokeMn6NUQAXWxdj7YmkruN7B9b+E1tJcWq+kWcSHzF eECPVG3FNOpxA== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , Nick Desaulniers Subject: [PATCH 2/7] kbuild: make multi_depend work with targets in subdirectory Date: Thu, 7 Apr 2022 00:30:18 +0900 Message-Id: <20220406153023.500847-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220406153023.500847-1-masahiroy@kernel.org> References: <20220406153023.500847-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Precisely speaking, when you get the stem of the path, you should use $(patsubst $(obj)/%,%,...) instead of $(notdir ...). I do not see this usecase, but if you create a composite object in a subdirectory, the Makefile should look like this: obj-$(CONFIG_FOO) += dir/foo.o dir/foo-objs := dir/foo1.o dir/foo2.o The member objects should be assigned to dir/foo-objs instead of foo-objs. This syntax is more consistent with commit 54b8ae66ae1a ("kbuild: change *FLAGS_.o to take the path relative to $(obj)"). Signed-off-by: Masahiro Yamada --- scripts/Makefile.lib | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index d56cda3c1e8a..0453a1904646 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -236,9 +236,9 @@ endif # Usage: # $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add) define multi_depend -$(foreach m, $(notdir $1), \ - $(eval $(obj)/$m: \ - $(addprefix $(obj)/, $(call suffix-search, $m, $2, $3)))) +$(foreach m, $1, \ + $(eval $m: \ + $(addprefix $(obj)/, $(call suffix-search, $(patsubst $(obj)/%,%,$m), $2, $3)))) endef # Copy a file -- 2.32.0