From: Guenter Roeck Date: Fri, 15 Sep 2017 15:15:05 +0000 (-0700) Subject: Makefile: Add support for compressed modules X-Git-Tag: v1.0~8 X-Git-Url: https://git.sur5r.net/?p=groeck-it87;a=commitdiff_plain;h=e140a1cda38bf15f0c4e0bee7ce217970b0475d4;hp=aeafb7be7c845d3a60691a32c6e1d86eca623691 Makefile: Add support for compressed modules Signed-off-by: Guenter Roeck --- diff --git a/Makefile b/Makefile index b975bc7..33f43df 100644 --- a/Makefile +++ b/Makefile @@ -14,12 +14,20 @@ DRIVER := it87 # Directory below /lib/modules/$(TARGET)/kernel into which to install # the module: MOD_SUBDIR = drivers/hwmon +MODDESTDIR=$(KERNEL_MODULES)/kernel/$(MOD_SUBDIR) obj-m := $(patsubst %,%.o,$(DRIVER)) obj-ko := $(patsubst %,%.ko,$(DRIVER)) MAKEFLAGS += --no-print-directory +ifneq ("","$(wildcard $(MODDESTDIR)/*.ko.gz)") +COMPRESS_GZIP := y +endif +ifneq ("","$(wildcard $(MODDESTDIR)/*.ko.xz)") +COMPRESS_XZ := y +endif + .PHONY: all install modules modules_install clean all: modules @@ -32,6 +40,12 @@ modules clean: install: modules_install modules_install: - mkdir -p $(KERNEL_MODULES)/kernel/$(MOD_SUBDIR) - cp $(DRIVER).ko $(KERNEL_MODULES)/kernel/$(MOD_SUBDIR)/ + mkdir -p $(MODDESTDIR) + cp $(DRIVER).ko $(MODDESTDIR)/ +ifeq ($(COMPRESS_GZIP), y) + @gzip -f $(MODDESTDIR)/$(DRIVER).ko +endif +ifeq ($(COMPRESS_XZ), y) + @xz -f $(MODDESTDIR)/$(DRIVER).ko +endif depmod -a -F $(SYSTEM_MAP) $(TARGET)