Use kernel's modules_install target, instead of building our own. Attention:
authorFlorian Pose <fp@igh-essen.com>
Tue, 23 Feb 2010 17:37:02 +0100
changeset 1824 bbb70ca26f09
parent 1823 2bf892fe8080
child 1825 65781b048a47
Use kernel's modules_install target, instead of building our own. Attention:
Module installation directories have changed!
Makefile.am
configure.ac
devices/Makefile.am
devices/e1000/Makefile.am
examples/dc_rtai/Makefile.am
examples/mini/Makefile.am
examples/rtai/Makefile.am
examples/tty/Makefile.am
master/Makefile.am
tty/Makefile.am
--- a/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -81,11 +81,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	$(MAKE) -C master modules_install
-	$(MAKE) -C devices modules_install
-if ENABLE_TTY
-	$(MAKE) -C tty modules_install
-endif
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/configure.ac	Tue Feb 23 15:49:12 2010 +0100
+++ b/configure.ac	Tue Feb 23 17:37:02 2010 +0100
@@ -96,10 +96,24 @@
 linuxversion=`echo $kernelrelease | grep -oE "^[[0-9]]+\.[[0-9]]+\.[[0-9]]+"`
 
 AC_SUBST(LINUX_SOURCE_DIR,[$sourcedir])
-AC_SUBST(LINUX_KERNEL_RELEASE,[$kernelrelease])
-AC_SUBST(LINUX_KERNEL_VERSION,[$linuxversion])
-AC_SUBST(LINUX_MOD_PATH,[/lib/modules/$kernelrelease/ethercat])
-AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $LINUX_KERNEL_RELEASE)])
+AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $kernelrelease)])
+
+#------------------------------------------------------------------------------
+# Linux module installation subdirectory
+#------------------------------------------------------------------------------
+
+AC_ARG_WITH([module-dir],
+    AC_HELP_STRING(
+        [--with-module-dir=<DIR>],
+        [Linux module installation dir. Default: ethercat]
+    ),
+    [moddir=[$withval]],
+    [moddir="ethercat"]
+)
+AC_SUBST(INSTALL_MOD_DIR,[$moddir])
+
+AC_MSG_CHECKING([Linux modules installation directory])
+AC_MSG_RESULT([$INSTALL_MOD_DIR])
 
 #------------------------------------------------------------------------------
 # Generic Ethernet driver
--- a/devices/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/devices/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -92,22 +92,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
-if ENABLE_GENERIC
-	cp $(srcdir)/ec_generic.ko $(DESTDIR)$(LINUX_MOD_PATH)
-endif
-if ENABLE_8139TOO
-	cp $(srcdir)/ec_8139too.ko $(DESTDIR)$(LINUX_MOD_PATH)
-endif
-if ENABLE_E100
-	cp $(srcdir)/ec_e100.ko $(DESTDIR)$(LINUX_MOD_PATH)
-endif
-if ENABLE_E1000
-	$(MAKE) -C e1000 modules_install
-endif
-if ENABLE_R8169
-	cp $(srcdir)/ec_r8169.ko $(DESTDIR)$(LINUX_MOD_PATH)
-endif
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/devices/e1000/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/devices/e1000/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -122,10 +122,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
-if ENABLE_E1000
-	cp $(srcdir)/ec_e1000.ko $(DESTDIR)$(LINUX_MOD_PATH)
-endif
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/examples/dc_rtai/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/examples/dc_rtai/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -40,8 +40,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
-	cp $(srcdir)/ec_dc_rtai_sample.ko $(DESTDIR)$(LINUX_MOD_PATH)
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/examples/mini/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/examples/mini/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -42,8 +42,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
-	cp $(srcdir)/ec_mini.ko $(DESTDIR)$(LINUX_MOD_PATH)
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/examples/rtai/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/examples/rtai/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -40,8 +40,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
-	cp $(srcdir)/ec_rtai_sample.ko $(DESTDIR)$(LINUX_MOD_PATH)
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/examples/tty/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/examples/tty/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -46,8 +46,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
-	cp $(srcdir)/ec_tty_example.ko $(DESTDIR)$(LINUX_MOD_PATH)
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/master/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/master/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -76,8 +76,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
-	cp $(srcdir)/ec_master.ko $(DESTDIR)$(LINUX_MOD_PATH)
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/tty/Makefile.am	Tue Feb 23 15:49:12 2010 +0100
+++ b/tty/Makefile.am	Tue Feb 23 17:37:02 2010 +0100
@@ -42,8 +42,8 @@
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
 
 modules_install:
-	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
-	cp $(srcdir)/ec_tty.ko $(DESTDIR)$(LINUX_MOD_PATH)
+	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
+		INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean