Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp414292pxf; Wed, 31 Mar 2021 06:40:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynYM9WM9e5gbmcsVFTuBIGKgSQ86Ry/tzD603lrMKvLFJ1D/25RG4CW6Vwh3f/rd6bJ/L9 X-Received: by 2002:a17:906:7d82:: with SMTP id v2mr3661005ejo.524.1617198014548; Wed, 31 Mar 2021 06:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617198014; cv=none; d=google.com; s=arc-20160816; b=U0w00Zc5P/cpfjRjEA3s8npC8nhZuxxJPwOxsC+91akiozQdgTxbBTddpTazZ6mtLy gfNt4i3zHf4BBVv5gZh5vy68Opv6ZuJ76+5nbyIpsImA+rWl0oy0zNSI21JJpEMHthrq 3hSlQBW+UrViRH6kSjdgWKjrlUhCdubYcHXUjWTGBnskd7HDB+rtEqojEvGXY+Qu3qMC LiwLR9zRLjCNFUA7t3PD7nnxpg5xNq89phEP3fWxIh0wmlKzzQzOHBEitMcOMAgORLPO HcrOytB9QGa0fCQ4yBtgxh0OsIOC6RwUvOURxuRfoNo3KK+Hxb10ax05XbIx/bmyA3CQ zKTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=GDUqIPAyXFlw9XgsY6d2xuYxGGqR5Pjr563gkbK8bNQ=; b=UC9ERr+DSLYE04aqUa3Xc4ZFyEd1+Xov9n1oT71DKTvR6/UWJBKFoeu90/T/4+4+hw wwdrUVUkkkeDiSB3JbeCqUXRCia9XvFq6jdHclH1Z5X8xOhbWCuS+Px2IWuOhn9dpx7l XRWIvNIs1otZLRPsFcno8AZYBamI7aghWQ/th/mNKH2yQMDm+DPCK6g+MWOgsTIK0ekO k2bpPI/AJ+vDWWUymAXZ7yI8NU247uhGMclxLbwD+IKem2+f7XC7PrsXOudmKzfrCyVy DVmYoH7WY0uMIcbEjT9cZjxJgrepc8akFVHtuh5Gf38XuyJMqWNV0lB8qLvvS4uS8ItW 0kXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=BDEGunVl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de11si1818356edb.15.2021.03.31.06.39.52; Wed, 31 Mar 2021 06:40:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=BDEGunVl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235909AbhCaNi7 (ORCPT + 99 others); Wed, 31 Mar 2021 09:38:59 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:38970 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235865AbhCaNid (ORCPT ); Wed, 31 Mar 2021 09:38:33 -0400 Received: from localhost.localdomain (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-12.nifty.com with ESMTP id 12VDcFed003995; Wed, 31 Mar 2021 22:38:18 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com 12VDcFed003995 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1617197898; bh=GDUqIPAyXFlw9XgsY6d2xuYxGGqR5Pjr563gkbK8bNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BDEGunVlIF8GfL6OKcla7dVZ9xPt6hJoRixq6w3/Gbhp2gFPnsXN4WlDlJmidzZrU ySfrW97pQphoWpgjsReeFC5DgYXbD1zkQKsDVFRl3AMsS7bBKeJeSRr6jqxwM5ODRZ TFaR/aTZ/Fuwxa/IOWIwrQHDo8fUbb+gX7RwMfvRvFEFiZ3uuC+aCvynY4TMkRsl9c euaLjiPUmJi+3AJZrG2/YTgGYzYUD0+uVJneLn5ONCohGxJEPsOuwTAyG+/oAnLoeV Fp1fr9vZSD0+CUp7jVRJUlCxGaZrSemlQOj/AgqEOs5PW1iBuBvoexS/tWdqdlbB3r x8yTl5Hp55Z6Q== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH 6/9] kbuild: refactor scripts/Makefile.modinst Date: Wed, 31 Mar 2021 22:38:07 +0900 Message-Id: <20210331133811.3221540-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210331133811.3221540-1-masahiroy@kernel.org> References: <20210331133811.3221540-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org scripts/Makefile.modinst is ugly and weird in multiple ways; it specifies real files $(modules) as phony, makes directory manipulation needlessly too complicated. Clean up the Makefile code, and show the full path of installed modules in the log. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- scripts/Makefile.modinst | 42 +++++++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index e3c2bd1b6f42..88e5c15e1186 100644 --- a/Makefile +++ b/Makefile @@ -1141,7 +1141,7 @@ endif # CONFIG_BPF PHONY += prepare0 -extmod_prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/) +export extmod_prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/) export MODORDER := $(extmod_prefix)modules.order export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index ad1981233d0b..3b2d0380504d 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -8,28 +8,34 @@ __modinst: include $(srctree)/scripts/Kbuild.include -modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) +modules := $(sort $(shell cat $(MODORDER))) + +ifeq ($(KBUILD_EXTMOD),) +subdir := kernel +else +INSTALL_MOD_DIR ?= extra +subdir := $(INSTALL_MOD_DIR) +endif + +dst := $(MODLIB)/$(subdir) + +modules := $(patsubst $(extmod_prefix)%, $(dst)/%, $(modules)) -PHONY += $(modules) __modinst: $(modules) @: # Don't stop modules_install if we can't sign external modules. -quiet_cmd_modules_install = INSTALL $@ - cmd_modules_install = \ - mkdir -p $(2) ; \ - cp $@ $(2) ; \ - $(mod_strip_cmd) $(2)/$(notdir $@) ; \ - $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \ - $(mod_compress_cmd) $(2)/$(notdir $@) - -# Modules built outside the kernel source tree go into extra by default -INSTALL_MOD_DIR ?= extra -ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D)) - -modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D)) - -$(modules): - $(call cmd,modules_install,$(MODLIB)/$(modinst_dir)) +quiet_cmd_install = INSTALL $@ + cmd_install = \ + mkdir -p $(dir $@); cp $< $@; \ + $(mod_strip_cmd) $@; \ + $(mod_sign_cmd) $@ $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \ + $(mod_compress_cmd) $@ + +$(modules): $(dst)/%: $(extmod_prefix)% FORCE + $(call cmd,install) + +PHONY += FORCE +FORCE: .PHONY: $(PHONY) -- 2.27.0