# HG changeset patch # User Florian Pose # Date 1162830460 0 # Node ID 8354ddf384813f3abf5998be65d04154675d87a6 # Parent 9fde4a17b820f13f851eb0b284c263096c667405 Improved autotools, added config.kbuild, --with-msr-dir, --with-rtai-dir, --with-8139too-kernel. diff -r 9fde4a17b820 -r 8354ddf38481 Kbuild --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Kbuild Mon Nov 06 16:27:40 2006 +0000 @@ -0,0 +1,36 @@ +#------------------------------------------------------------------------------ +# +# $Id$ +# +# Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH +# +# This file is part of the IgH EtherCAT Master. +# +# The IgH EtherCAT Master is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# The IgH EtherCAT Master is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the IgH EtherCAT Master; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# The right to use EtherCAT Technology is granted and comes free of +# charge under condition of compatibility of product made by +# Licensee. People intending to distribute/sell products based on the +# code, have to sign an agreement to guarantee that products using +# software based on IgH EtherCAT master stay compatible with the actual +# EtherCAT specification (which are released themselves as an open +# standard) as the (only) precondition to have the right to use EtherCAT +# Technology, IP and trade marks. +# +#------------------------------------------------------------------------------ + +obj-m := master/ devices/ + +#------------------------------------------------------------------------------ diff -r 9fde4a17b820 -r 8354ddf38481 Makefile.am --- a/Makefile.am Mon Nov 06 14:22:35 2006 +0000 +++ b/Makefile.am Mon Nov 06 16:27:40 2006 +0000 @@ -43,6 +43,9 @@ globals.h \ LICENSE +modules: + $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules + modules_install: $(MAKE) -C master modules_install $(MAKE) -C devices modules_install @@ -66,6 +69,7 @@ config.h.in \ config.log \ config.status \ + config.kbuild \ configure.in \ configure \ Makefile \ diff -r 9fde4a17b820 -r 8354ddf38481 configure.ac --- a/configure.ac Mon Nov 06 14:22:35 2006 +0000 +++ b/configure.ac Mon Nov 06 16:27:40 2006 +0000 @@ -72,6 +72,96 @@ AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $LINUX_KERNEL_RELEASE)]) #------------------------------------------------------------------------------ +# 8139too Kernel +#------------------------------------------------------------------------------ + +AC_ARG_WITH([8139too-kernel], + AC_HELP_STRING( + [--with-8139too-kernel=], + [8139too kernel (only if differing)] + ), + [ + kernel8139too=[$withval] + ], + [ + kernel8139too=$linuxversion + ] +) + +AC_MSG_CHECKING([for kernel for 8139too driver]) + +kernels=`ls -1 devices/ | grep -oE "^8139too-.*-" | cut -d "-" -f 2 | uniq` +found=0 +for k in $kernels; do + if test "$kernel8139too" = "$k"; then + found=1 + fi +done +if test $found -ne 1; then + AC_MSG_ERROR([kernel $kernel8139too not available for 8139too driver!]) +fi + +AC_MSG_RESULT([$kernel8139too]) + +#------------------------------------------------------------------------------ +# RTAI path (optional) +#------------------------------------------------------------------------------ + +AC_ARG_WITH([rtai-dir], + AC_HELP_STRING( + [--with-rtai-dir=], + [RTAI path (only for RTAI examples)] + ), + [ + rtaidir=[$withval] + ], + [ + rtaidir="" + ] +) + +AC_MSG_CHECKING([for RTAI path]) + +if test -z "${rtaidir}"; then + AC_MSG_RESULT([not specified.]) +else + if test \! -r ${rtaidir}/include/rtai.h; then + AC_MSG_ERROR([no RTAI installation found in ${rtaidir}!]) + fi + AC_MSG_RESULT([$rtaidir]) + AC_SUBST(RTAI_DIR,[$rtaidir]) +fi + +#------------------------------------------------------------------------------ +# MSR path (optional) +#------------------------------------------------------------------------------ + +AC_ARG_WITH([msr-dir], + AC_HELP_STRING( + [--with-msr-dir=], + [MSR path (only for MSR example)] + ), + [ + msrdir=[$withval] + ], + [ + msrdir="" + ] +) + +AC_MSG_CHECKING([for MSR path]) + +if test -z "${msrdir}"; then + AC_MSG_RESULT([not specified.]) +else + if test \! -r ${msrdir}/include/msr.h; then + AC_MSG_ERROR([no MSR installation found in ${msrdir}!]) + fi + AC_MSG_RESULT([$msrdir]) + AC_SUBST(MSR_DIR,[$msrdir]) +fi + +#------------------------------------------------------------------------------ # Debug interface #------------------------------------------------------------------------------ @@ -97,6 +187,20 @@ #------------------------------------------------------------------------------ +# Create config.kbuild + +echo configure: creating config.kbuild... + +cat > config.kbuild </dev/null || echo "unknown"; \ fi) -CFLAGS_8139too-$(EC_MOD_KERNEL)-ethercat.o = -DSVNREV=$(REV) +CFLAGS_$(EC_8139TOO_OBJ) = -DSVNREV=$(REV) #------------------------------------------------------------------------------ diff -r 9fde4a17b820 -r 8354ddf38481 devices/Makefile.am --- a/devices/Makefile.am Mon Nov 06 14:22:35 2006 +0000 +++ b/devices/Makefile.am Mon Nov 06 16:27:40 2006 +0000 @@ -39,15 +39,13 @@ 8139too-2.6.17-ethercat.c \ 8139too-2.6.17-orig.c -all-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules +modules: + $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_top_srcdir@" modules + +modules_install: + cp $(srcdir)/ec_8139too.ko $(DESTDIR)$(LINUX_MOD_PATH) clean-local: $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean -install-data-local: modules_install - -modules_install: - cp $(srcdir)/ec_8139too.ko $(DESTDIR)$(LINUX_MOD_PATH) - #------------------------------------------------------------------------------ diff -r 9fde4a17b820 -r 8354ddf38481 examples/mini/Kbuild --- a/examples/mini/Kbuild Mon Nov 06 14:22:35 2006 +0000 +++ b/examples/mini/Kbuild Mon Nov 06 16:27:40 2006 +0000 @@ -1,7 +1,5 @@ #------------------------------------------------------------------------------ # -# Kbuild -# # $Id$ # # Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH diff -r 9fde4a17b820 -r 8354ddf38481 examples/msr/Kbuild --- a/examples/msr/Kbuild Mon Nov 06 14:22:35 2006 +0000 +++ b/examples/msr/Kbuild Mon Nov 06 16:27:40 2006 +0000 @@ -1,7 +1,5 @@ #------------------------------------------------------------------------------ # -# Kbuild -# # $Id$ # # Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH @@ -33,6 +31,8 @@ # #------------------------------------------------------------------------------ +include $(src)/../../config.kbuild + MODULE := ec_msr_sample obj-m := $(MODULE).o @@ -52,7 +52,7 @@ rt_lib/msr-math/msr_hex_bin.o \ libm.o -EXTRA_CFLAGS := -I$(src)/rt_lib/msr-include -I/usr/realtime/include \ +EXTRA_CFLAGS := -I$(EC_MSR_DIR)/include -I$(EC_RTAI_DIR)/include \ -D_SIMULATION -mhard-float #------------------------------------------------------------------------------ diff -r 9fde4a17b820 -r 8354ddf38481 examples/rtai/Kbuild --- a/examples/rtai/Kbuild Mon Nov 06 14:22:35 2006 +0000 +++ b/examples/rtai/Kbuild Mon Nov 06 16:27:40 2006 +0000 @@ -31,10 +31,12 @@ # #------------------------------------------------------------------------------ +include $(src)/../../config.kbuild + obj-m := ec_rtai_sample.o ec_rtai_sample-objs := rtai_sample.o -EXTRA_CFLAGS := -I/usr/realtime/include +EXTRA_CFLAGS := -I$(EC_RTAI_DIR)/include #------------------------------------------------------------------------------ diff -r 9fde4a17b820 -r 8354ddf38481 examples/rtai/Makefile.am --- a/examples/rtai/Makefile.am Mon Nov 06 14:22:35 2006 +0000 +++ b/examples/rtai/Makefile.am Mon Nov 06 16:27:40 2006 +0000 @@ -1,7 +1,5 @@ #------------------------------------------------------------------------------ # -# Makefile.am -# # IgH EtherCAT master module # # $Id$ diff -r 9fde4a17b820 -r 8354ddf38481 master/Kbuild --- a/master/Kbuild Mon Nov 06 14:22:35 2006 +0000 +++ b/master/Kbuild Mon Nov 06 16:27:40 2006 +0000 @@ -31,6 +31,8 @@ # #------------------------------------------------------------------------------ +include $(src)/../config.kbuild + obj-m := ec_master.o ec_master-objs := module.o master.o device.o slave.o datagram.o \ diff -r 9fde4a17b820 -r 8354ddf38481 master/Makefile.am --- a/master/Makefile.am Mon Nov 06 14:22:35 2006 +0000 +++ b/master/Makefile.am Mon Nov 06 16:27:40 2006 +0000 @@ -51,16 +51,13 @@ slave.c slave.h \ xmldev.c xmldev.h -all-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" \ - M="@abs_srcdir@" EC_DBG_IF="$(EC_DBG_IF)" modules +modules: + $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_top_srcdir@" modules + +modules_install: + cp $(srcdir)/ec_master.ko $(DESTDIR)$(LINUX_MOD_PATH) clean-local: $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean -install-data-local: modules_install - -modules_install: - cp $(srcdir)/ec_master.ko $(DESTDIR)$(LINUX_MOD_PATH) - #------------------------------------------------------------------------------