You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

  1. MOD_NAME := snd-i2smic-rpi
  2. ifneq ($(KERNELRELEASE),)
  3. # call from kernel build system
  4. all:
  5. @echo "Building from the kernel build system"
  6. @echo "Module build: $(CONFIG_SND_I2S_RPI)"
  7. @echo "Name: $(MOD_NAME)"
  8. obj-$(CONFIG_SND_I2S_RPI) := $(MOD_NAME).o
  9. else
  10. # external module build
  11. EXTRA_FLAGS += -I$(PWD)
  12. #
  13. # KDIR is a path to a directory containing kernel source.
  14. # It can be specified on the command line passed to make to enable the module to
  15. # be built and installed for a kernel other than the one currently running.
  16. # By default it is the path to the symbolic link created when
  17. # the current kernel's modules were installed, but
  18. # any valid path to the directory in which the target kernel's source is located
  19. # can be provided on the command line.
  20. #
  21. KDIR ?= /lib/modules/$(shell uname -r)/build
  22. MDIR ?= /lib/modules/$(shell uname -r)
  23. PWD := $(shell pwd)
  24. export CONFIG_SND_I2S_RPI := m
  25. all:
  26. $(MAKE) -C $(KDIR) M=$(PWD) modules
  27. clean:
  28. $(MAKE) -C $(KDIR) M=$(PWD) clean
  29. help:
  30. $(MAKE) -C $(KDIR) M=$(PWD) help
  31. install: snd-i2smic-rpi.ko
  32. rm -f ${MDIR}/kernel/sound/drivers/$(MOD_NAME).ko
  33. install -m644 -b -D $(MOD_NAME).ko ${MDIR}/kernel/sound/drivers/$(MOD_NAME).ko
  34. depmod -a
  35. uninstall:
  36. rm -rf ${MDIR}/kernel/sound/drivers/$(MOD_NAME).ko
  37. depmod -a
  38. endif
  39. .PHONY : all clean install uninstall