blob: 8e9debb781d15996098e2c25efce7544e27c240f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002# ==========================================================================
3# Installing modules
4# ==========================================================================
5
Paul Smith4f193362006-03-05 17:14:10 -05006PHONY := __modinst
Linus Torvalds1da177e2005-04-16 15:20:36 -07007__modinst:
8
Masahiro Yamada3204a7f2021-02-28 15:10:26 +09009include $(srctree)/scripts/Kbuild.include
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
Masahiro Yamadaccae4cf2021-03-31 22:38:07 +090011modules := $(sort $(shell cat $(MODORDER)))
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
Masahiro Yamadaccae4cf2021-03-31 22:38:07 +090013ifeq ($(KBUILD_EXTMOD),)
14dst := $(MODLIB)/kernel
15else
16INSTALL_MOD_DIR ?= extra
17dst := $(MODLIB)/$(INSTALL_MOD_DIR)
18endif
19
20modules := $(patsubst $(extmod_prefix)%, $(dst)/%, $(modules))
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022__modinst: $(modules)
23 @:
24
Rusty Russellf6a79af2012-11-06 11:46:59 +103025# Don't stop modules_install if we can't sign external modules.
Masahiro Yamadaccae4cf2021-03-31 22:38:07 +090026quiet_cmd_install = INSTALL $@
27 cmd_install = \
28 mkdir -p $(dir $@); cp $< $@; \
29 $(mod_strip_cmd) $@; \
30 $(mod_sign_cmd) $@ $(patsubst %,|| true,$(KBUILD_EXTMOD)) ; \
31 $(mod_compress_cmd) $@
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Masahiro Yamadaccae4cf2021-03-31 22:38:07 +090033$(modules): $(dst)/%: $(extmod_prefix)% FORCE
34 $(call cmd,install)
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Masahiro Yamadaccae4cf2021-03-31 22:38:07 +090036PHONY += FORCE
37FORCE:
Paul Smith4f193362006-03-05 17:14:10 -050038
Paul Smith4f193362006-03-05 17:14:10 -050039.PHONY: $(PHONY)