Skip to content
Snippets Groups Projects
Commit 510825d1 authored by Florian Pose's avatar Florian Pose
Browse files

Improved autotools, added config.kbuild, --with-msr-dir, --with-rtai-dir, --with-8139too-kernel.

parent c27da7fb
No related branches found
No related tags found
No related merge requests found
Kbuild 0 → 100644
#------------------------------------------------------------------------------
#
# $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/
#------------------------------------------------------------------------------
......@@ -43,6 +43,9 @@ EXTRA_DIST = \
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 @@ mrproper: clean
config.h.in \
config.log \
config.status \
config.kbuild \
configure.in \
configure \
Makefile \
......
......@@ -71,6 +71,96 @@ 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)])
#------------------------------------------------------------------------------
# 8139too Kernel
#------------------------------------------------------------------------------
AC_ARG_WITH([8139too-kernel],
AC_HELP_STRING(
[--with-8139too-kernel=<X.Y.Z>],
[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=<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=<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 @@ AC_SUBST([EC_DBG_IF],${dbg})
#------------------------------------------------------------------------------
# Create config.kbuild
echo configure: creating config.kbuild...
cat > config.kbuild <<EOF
# config.kbuild - created by configure
EC_DBG_IF := ${dbg}
EC_8139TOO_KERNEL := ${kernel8139too}
EC_RTAI_DIR := "${rtaidir}"
EC_MSR_DIR := "${msrdir}"
EOF
#------------------------------------------------------------------------------
AC_CONFIG_FILES([
Makefile
master/Makefile
......
......@@ -31,11 +31,13 @@
#
#------------------------------------------------------------------------------
EC_MOD_KERNEL := $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
include $(src)/../config.kbuild
EC_8139TOO_OBJ = 8139too-$(EC_8139TOO_KERNEL)-ethercat.o
obj-m := ec_8139too.o
ec_8139too-objs := 8139too-$(EC_MOD_KERNEL)-ethercat.o
ec_8139too-objs := $(EC_8139TOO_OBJ)
REV := $(shell if test -s $(src)/../svnrevision; then \
cat $(src)/../svnrevision; \
......@@ -43,6 +45,6 @@ REV := $(shell if test -s $(src)/../svnrevision; then \
svnversion $(src)/.. 2>/dev/null || echo "unknown"; \
fi)
CFLAGS_8139too-$(EC_MOD_KERNEL)-ethercat.o = -DSVNREV=$(REV)
CFLAGS_$(EC_8139TOO_OBJ) = -DSVNREV=$(REV)
#------------------------------------------------------------------------------
......@@ -39,15 +39,13 @@ EXTRA_DIST = \
8139too-2.6.17-ethercat.c \
8139too-2.6.17-orig.c
all-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules
clean-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
install-data-local: modules_install
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
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#
# Kbuild
#
# $Id$
#
# Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH
......
#------------------------------------------------------------------------------
#
# 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 @@ $(MODULE)-objs := msr_sample.o \
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
#------------------------------------------------------------------------------
......@@ -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
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#
# Makefile.am
#
# IgH EtherCAT master module
#
# $Id$
......
......@@ -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 \
......
......@@ -51,16 +51,13 @@ EXTRA_DIST = \
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
clean-local:
$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
install-data-local: modules_install
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
#------------------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment