Makefile.modinst 1.1 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4
# ==========================================================================
# Installing modules
# ==========================================================================

5
PHONY := __modinst
L
Linus Torvalds 已提交
6 7
__modinst:

S
Sam Ravnborg 已提交
8
include scripts/Kbuild.include
L
Linus Torvalds 已提交
9 10 11

#

12
__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
L
Linus Torvalds 已提交
13 14
modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))

15
PHONY += $(modules)
L
Linus Torvalds 已提交
16 17 18 19
__modinst: $(modules)
	@:

quiet_cmd_modules_install = INSTALL $@
20
      cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@)
L
Linus Torvalds 已提交
21 22 23

# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
24
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
L
Linus Torvalds 已提交
25 26 27 28 29

modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))

$(modules):
	$(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
30 31 32 33 34 35


# Declare the contents of the .PHONY variable as phony.  We keep that
# information in a variable se we can use it in if_changed and friends.

.PHONY: $(PHONY)