xref: /OK3568_Linux_fs/device/rockchip/common/linux-kbuild/aarch64/linux-kbuild-4.4/scripts/Makefile.modinst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# ==========================================================================
2*4882a593Smuzhiyun# Installing modules
3*4882a593Smuzhiyun# ==========================================================================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunPHONY := __modinst
6*4882a593Smuzhiyun__modinst:
7*4882a593Smuzhiyun
8*4882a593Smuzhiyuninclude scripts/Kbuild.include
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun#
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
13*4882a593Smuzhiyunmodules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunPHONY += $(modules)
16*4882a593Smuzhiyun__modinst: $(modules)
17*4882a593Smuzhiyun	@:
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun# Don't stop modules_install if we can't sign external modules.
20*4882a593Smuzhiyunquiet_cmd_modules_install = INSTALL $@
21*4882a593Smuzhiyun      cmd_modules_install = \
22*4882a593Smuzhiyun    mkdir -p $(2) ; \
23*4882a593Smuzhiyun    cp $@ $(2) ; \
24*4882a593Smuzhiyun    $(mod_strip_cmd) $(2)/$(notdir $@) ; \
25*4882a593Smuzhiyun    $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) && \
26*4882a593Smuzhiyun    $(mod_compress_cmd) $(2)/$(notdir $@)
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun# Modules built outside the kernel source tree go into extra by default
29*4882a593SmuzhiyunINSTALL_MOD_DIR ?= extra
30*4882a593Smuzhiyunext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
31*4882a593Smuzhiyun
32*4882a593Smuzhiyunmodinst_dir ?= $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun$(modules):
35*4882a593Smuzhiyun	$(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun# Declare the contents of the .PHONY variable as phony.  We keep that
39*4882a593Smuzhiyun# information in a variable so we can use it in if_changed and friends.
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun.PHONY: $(PHONY)
42