Makefile.modinst 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # ==========================================================================
  2. # Installing modules
  3. # ==========================================================================
  4. PHONY := __modinst
  5. __modinst:
  6. include scripts/Kbuild.include
  7. #
  8. __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
  9. modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
  10. PHONY += $(modules)
  11. __modinst: $(modules)
  12. @:
  13. quiet_cmd_modules_install = INSTALL $@
  14. cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@)
  15. # Modules built outside the kernel source tree go into extra by default
  16. INSTALL_MOD_DIR ?= extra
  17. ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(KBUILD_EXTMOD),,$(@D))
  18. modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
  19. $(modules):
  20. $(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
  21. # Declare the contents of the .PHONY variable as phony. We keep that
  22. # information in a variable se we can use it in if_changed and friends.
  23. .PHONY: $(PHONY)