Improved installation, added quick modules_install target.
--- a/Makefile.am Fri Nov 03 12:18:37 2006 +0000
+++ b/Makefile.am Fri Nov 03 14:18:05 2006 +0000
@@ -43,6 +43,10 @@
globals.h \
LICENSE
+modules_install:
+ $(MAKE) -C master modules_install
+ $(MAKE) -C devices modules_install
+
mydist:
@SVNREV=`svnversion $(srcdir)` && \
$(MAKE) dist-bzip2 \
--- a/configure.ac Fri Nov 03 12:18:37 2006 +0000
+++ b/configure.ac Fri Nov 03 14:18:05 2006 +0000
@@ -36,7 +36,7 @@
modulesdir=/lib/modules/${version}
if test \! -d ${modulesdir} || test \! -d ${modulesdir}/build; then
echo
- AC_MSG_ERROR([Invalid modules directory ${modulesdir}])
+ AC_MSG_ERROR([Failed to find Linux sources. Use --with-linux-dir!])
fi
sourcedir=`cd ${modulesdir}/build && pwd -P`
]
@@ -45,12 +45,31 @@
AC_MSG_CHECKING([for Linux kernel sources])
if test \! -r ${sourcedir}/.config; then
- echo
- AC_MSG_ERROR([No configured Linux kernel sources in $sourcedir])
+ echo
+ AC_MSG_ERROR([No configured Linux kernel sources in $sourcedir])
fi
+# Try to get kernel release string
+if test -r ${sourcedir}/.kernelrelease; then
+ kernelrelease=`cat $sourcedir/.kernelrelease`
+elif test -r ${sourcedir}/include/linux/version.h; then
+ hdr=$sourcedir/include/linux/version.h
+ kernelrelease=`grep UTS_RELEASE $hdr | cut -d " " -f 3- | tr -d \"`
+fi
+
+if test -z "$kernelrelease"; then
+ echo
+ AC_MSG_ERROR([Failed to extract Linux kernel version!])
+fi
+
+# Extract three numbers from kernel release string
+linuxversion=`echo $kernelrelease | grep -oE [[0-9]]+\.[[0-9]]+\.[[0-9]]+`
+
AC_SUBST(LINUX_SOURCE_DIR,[$sourcedir])
-AC_MSG_RESULT($LINUX_SOURCE_DIR)
+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)])
#------------------------------------------------------------------------------
# Debug interface
--- a/devices/Makefile.am Fri Nov 03 12:18:37 2006 +0000
+++ b/devices/Makefile.am Fri Nov 03 14:18:05 2006 +0000
@@ -45,9 +45,9 @@
clean-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
-install-data-local:
- $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
- INSTALL_MOD_PATH="$(DESTDIR)" \
- INSTALL_MOD_DIR="ethercat" modules_install
+install-data-local: modules_install
+
+modules_install:
+ cp $(srcdir)/ec_8139too.ko $(DESTDIR)$(LINUX_MOD_PATH)
#------------------------------------------------------------------------------
--- a/examples/mini/Makefile.am Fri Nov 03 12:18:37 2006 +0000
+++ b/examples/mini/Makefile.am Fri Nov 03 14:18:05 2006 +0000
@@ -43,9 +43,9 @@
clean-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
-install-data-local:
- $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
- INSTALL_MOD_PATH="$(DESTDIR)" \
- INSTALL_MOD_DIR="ethercat" modules_install
+install-data-local: modules_install
+
+modules_install:
+ cp $(srcdir)/ec_mini.ko $(DESTDIR)$(LINUX_MOD_PATH)
#------------------------------------------------------------------------------
--- a/examples/msr/Makefile.am Fri Nov 03 12:18:37 2006 +0000
+++ b/examples/msr/Makefile.am Fri Nov 03 14:18:05 2006 +0000
@@ -44,9 +44,9 @@
clean-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
-install-data-local:
- $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
- INSTALL_MOD_PATH="$(DESTDIR)" \
- INSTALL_MOD_DIR="ethercat" modules_install
+install-data-local: modules_install
+
+modules_install:
+ cp $(srcdir)/ec_msr_sample.ko $(DESTDIR)$(LINUX_MOD_PATH)
#------------------------------------------------------------------------------
--- a/examples/rtai/Makefile.am Fri Nov 03 12:18:37 2006 +0000
+++ b/examples/rtai/Makefile.am Fri Nov 03 14:18:05 2006 +0000
@@ -43,9 +43,9 @@
clean-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
-install-data-local:
- $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
- INSTALL_MOD_PATH="$(DESTDIR)" \
- INSTALL_MOD_DIR="ethercat" modules_install
+install-data-local: modules_install
+
+modules_install:
+ cp $(srcdir)/ec_rtai_sample.ko $(DESTDIR)$(LINUX_MOD_PATH)
#------------------------------------------------------------------------------
--- a/master/Makefile.am Fri Nov 03 12:18:37 2006 +0000
+++ b/master/Makefile.am Fri Nov 03 14:18:05 2006 +0000
@@ -58,9 +58,9 @@
clean-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
-install-data-local:
- $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \
- INSTALL_MOD_PATH="$(DESTDIR)" \
- INSTALL_MOD_DIR="ethercat" modules_install
+install-data-local: modules_install
+
+modules_install:
+ cp $(srcdir)/ec_master.ko $(DESTDIR)$(LINUX_MOD_PATH)
#------------------------------------------------------------------------------