diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2016-04-09 20:45:52 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2016-04-09 20:45:52 +0200 |
commit | 71f64d82453f5c86dd40104839d98fc12ae44ddf (patch) | |
tree | feb851713553f87a5a517d160eff79919d03496e /driver | |
parent | 5f13a1941af657f3512a48137a9b42b43c98b3e7 (diff) | |
download | pcitool-71f64d82453f5c86dd40104839d98fc12ae44ddf.tar.gz pcitool-71f64d82453f5c86dd40104839d98fc12ae44ddf.tar.bz2 pcitool-71f64d82453f5c86dd40104839d98fc12ae44ddf.tar.xz pcitool-71f64d82453f5c86dd40104839d98fc12ae44ddf.zip |
Fix driver installation on Ubuntu
Diffstat (limited to 'driver')
-rw-r--r-- | driver/Makefile.in | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/driver/Makefile.in b/driver/Makefile.in index 1bae633..e39d1fe 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -7,7 +7,14 @@ KERNELVER ?= $(shell uname -r) KERNELDIR ?= /lib/modules/$(KERNELVER)/build INSTALLDIR ?= /lib/modules/$(KERNELVER)/extra MAININSTALLDIR ?= /lib/modules/$(KERNELVER)/kernel/extra +ifneq ("$(wildcard /lib/modules/$(KERNELVER)/build/include/linux)","") +HEADERDIR ?= /lib/modules/$(KERNELVER)/build/include +else ifneq ("$(wildcard /lib/modules/$(KERNELVER)/source/include/linux)","") HEADERDIR ?= /lib/modules/$(KERNELVER)/source/include +else +HEADERDIR ?= "" +endif + PWD := $(shell pwd) EXTRA_CFLAGS += -I$(M)/.. ${PCILIB_DYNAMIC_HEADERS_INC} @@ -84,8 +91,10 @@ install: @install -m 755 pciDriver.ko $(INSTALLDIR) @echo "INSTALL $(INSTALLDIR)/pciDriver.symvers" @install -m 644 Module.symvers $(INSTALLDIR)/pciDriver.symvers - @echo "INSTALL $(HEADERDIR)/linux/pcidriver.h" - @install -m 644 pcidriver.h $(HEADERDIR)/linux/ + @if [ "$(HEADERDIR)" != "" ]; then \ + echo "INSTALL $(HEADERDIR)/linux/pcidriver.h" ;\ + install -m 644 pcidriver.h $(HEADERDIR)/linux/ ;\ + fi @echo "INSTALL /usr/include/linux/pcidriver.h" @mkdir -p /usr/include/linux @install -m 644 ioctl.h /usr/include/linux/pcidriver.h @@ -99,16 +108,34 @@ install_symvers: uninstall: - @echo "UNINSTALL $(INSTALLDIR)/pciDriver.ko" - @rm -f $(INSTALLDIR)/pciDriver.ko - @rm -f $(MAININSTALLDIR)/pciDriver.ko - @rm -f $(INSTALLDIR)/pciDriver.symvers - @rm -f $(MAININSTALLDIR)/pciDriver.symvers - @echo "UNINSTALL /usr/include/linux/pcidriver.h" - @rm -rf /usr/include/pciDriver/ - @rm -rf /usr/include/linux/pcidriver.h - @echo "UNINSTALL $(HEADERDIR)/linux/pcidriver.h" - @rm -rf $(HEADERDIR)/linux/pcidriver.h + @if [ -f $(INSTALLDIR)/pciDriver.ko ]; then \ + echo "UNINSTALL $(INSTALLDIR)/pciDriver.ko" ;\ + rm -f $(INSTALLDIR)/pciDriver.ko ;\ + fi + @if [ -f $(MAININSTALLDIR)/pciDriver.ko ]; then \ + echo "UNINSTALL $(MAININSTALLDIR)/pciDriver.ko" ;\ + rm -f $(MAININSTALLDIR)/pciDriver.ko ;\ + fi + @if [ -f $(INSTALLDIR)/pciDriver.symvers ]; then \ + echo "UNINSTALL $(INSTALLDIR)/pciDriver.symvers" ;\ + rm -f $(INSTALLDIR)/pciDriver.symvers ;\ + fi + @if [ -f $(MAININSTALLDIR)/pciDriver.symvers ]; then \ + echo "UNINSTALL $(MAININSTALLDIR)/pciDriver.symvers" ;\ + rm -f $(MAININSTALLDIR)/pciDriver.symvers ;\ + fi + @if [ -f /usr/include/linux/pcidriver.h ]; then \ + echo "UNINSTALL /usr/include/linux/pcidriver.h" ;\ + rm -rf /usr/include/linux/pcidriver.h ;\ + fi + @if [ -d /usr/include/pciDriver/ ]; then \ + echo "UNINSTALL /usr/include/pciDriver/" ;\ + rm -rf /usr/include/pciDriver/ ;\ + fi + @if [ "$(HEADERDIR)" != "" -a -f $(HEADERDIR)/linux/pcidriver.h ]; then \ + echo "UNINSTALL $(HEADERDIR)/linux/pcidriver.h" ;\ + rm -rf $(HEADERDIR)/linux/pcidriver.h ;\ + fi clean: rm -rf *.o *.ko *.mod.c .*.o.cmd .*.o.tmp .*.ko.cmd .*.o *.symvers modules.order .tmp_versions |