Guest User

Makefile for toshiba_acpi

a guest
Jun 27th, 2014
393
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #
  2. # Makefile -- makefile for the Toshiba ACPI extras driver
  3. #
  4. # This program is free software; you can redistribute it and/or modify it
  5. # under the terms of the GNU General Public License as published by the
  6. # Free Software Foundation; either version 2, or (at your option) any
  7. # later version.
  8. #
  9. # This program is distributed in the hope that it will be useful, but
  10. # WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # General Public License for more details.
  13. #
  14. # Written by Soós Péter <sp@osb.hu>, 2002-2004
  15. # Modified by Azael Avalos <coproscefalo@gmail.com>, 2013
  16. #
  17.  
  18. MODULE_NAME = toshiba_acpi
  19.  
  20. ifeq ($(KERNELRELEASE),)
  21.  
  22. DESTDIR =
  23. MODDIR  = $(DESTDIR)/lib/modules
  24. KVERS   = $(shell uname -r)
  25. KVER    = $(KVERS)
  26. VMODDIR = $(MODDIR)/$(KVER)
  27. INSTDIR = kernel/drivers/platform/x86
  28. #KSRC   = /usr/src/linux
  29. KSRC    = $(VMODDIR)/build
  30. KMODDIR = $(KSRC)/drivers/platform/toshiba_acpi
  31. KDOCDIR = $(KSRC)/Documentation/toshiba_acpi
  32. PWD = $(shell pwd)
  33. TODAY   = $(shell date +%Y%m%d)
  34. KERNEL  = $(shell echo $(KVER) | cut -d . -f 1-2)
  35.  
  36. DEPMOD  = /sbin/depmod -a
  37. RMMOD   = /sbin/modprobe -r
  38. INSMOD  = /sbin/modprobe
  39. INSTALL = install -m 644
  40. MKDIR   = mkdir -p
  41. RM  = rm -f
  42. FIND    = find
  43. endif
  44.  
  45. obj-m         += $(MODULE_NAME).o
  46.  
  47. all:         $(MODULE_NAME).ko
  48.  
  49. clean:
  50.         make -C $(KSRC) M=$(PWD) clean
  51.         $(RM) -r *~ "#*#" .swp
  52.         $(RM) -r Module.symvers Modules.symvers
  53.  
  54. install:    all
  55.         # Removing module from locations used by previous versions
  56.         $(RM) $(VMODDIR)/kernel/drivers/platform/x86/$(MODULE_NAME).ko
  57.         make INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=$(INSTDIR) -C $(KSRC) M=$(PWD) modules_install
  58.  
  59. unload:
  60.         $(RMMOD) $(MODULE_NAME) || :
  61.  
  62. load:       install unload
  63.         $(DEPMOD)
  64.         $(INSMOD) $(MODULE_NAME)
  65.  
  66. uninstall:  unload
  67.         $(FIND) $(VMODDIR) -name "$(MODULE_NAME).ko" -exec $(RM) {} \;
  68.         $(DEPMOD)
  69.  
  70. $(MODULE_NAME).ko:
  71.         $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
  72.  
  73. kinstall:
  74.         $(RM) -r $(KMODDIR)
  75.         $(MKDIR) $(KMODDIR)
  76.         $(INSTALL) *.h *.c sections.lds $(KMODDIR)
  77.         $(MKDIR) $(KDOCDIR)
  78.         $(INSTALL) doc/README $(KDOCDIR)
  79.  
  80. # End of file
RAW Paste Data