]> git.ipfire.org Git - thirdparty/kernel/stable.git/blame - scripts/Makefile.modinst
Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
[thirdparty/kernel/stable.git] / scripts / Makefile.modinst
CommitLineData
b2441318 1# SPDX-License-Identifier: GPL-2.0
1da177e4
LT
2# ==========================================================================
3# Installing modules
4# ==========================================================================
5
4f193362 6PHONY := __modinst
1da177e4
LT
7__modinst:
8
8ec4b4ff 9include scripts/Kbuild.include
1da177e4
LT
10
11#
12
ef591a55 13__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
1da177e4
LT
14modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
15
4f193362 16PHONY += $(modules)
1da177e4
LT
17__modinst: $(modules)
18 @:
19
f6a79af8 20# Don't stop modules_install if we can't sign external modules.
1da177e4 21quiet_cmd_modules_install = INSTALL $@
40e42f6a
BJ
22 cmd_modules_install = \
23 mkdir -p $(2) ; \
24 cp $@ $(2) ; \
25 $(mod_strip_cmd) $(2)/$(notdir $@) ; \
caf6fe91 26 $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) && \
beb50df3 27 $(mod_compress_cmd) $(2)/$(notdir $@)
1da177e4
LT
28
29# Modules built outside the kernel source tree go into extra by default
30INSTALL_MOD_DIR ?= extra
9b213118 31ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
1da177e4
LT
32
33modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
34
35$(modules):
36 $(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
4f193362 37
4f193362 38.PHONY: $(PHONY)