summaryrefslogtreecommitdiff
path: root/scripts/Makefile.modinst
blob: 8e9debb781d15996098e2c25efce7544e27c240f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# SPDX-License-Identifier: GPL-2.0
# ==========================================================================
# Installing modules
# ==========================================================================

PHONY := __modinst
__modinst:

include $(srctree)/scripts/Kbuild.include

modules := $(sort $(shell cat $(MODORDER)))

ifeq ($(KBUILD_EXTMOD),)
dst := $(MODLIB)/kernel
else
INSTALL_MOD_DIR ?= extra
dst := $(MODLIB)/$(INSTALL_MOD_DIR)
endif

modules := $(patsubst $(extmod_prefix)%, $(dst)/%, $(modules))

__modinst: $(modules)
	@:

# Don't stop modules_install if we can't sign external modules.
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)