Added --enable-dummy; renamed EC_DBG_IF to EC_DEBUG_IF, ENABLE_DEBUG_IF
authorFlorian Pose <fp@igh-essen.com>
Tue, 07 Aug 2007 07:54:51 +0000
changeset 679 62fc387ec928
parent 678 5e0d5f04dc65
child 680 48c2dbc12bde
Added --enable-dummy; renamed EC_DBG_IF to EC_DEBUG_IF, ENABLE_DEBUG_IF
conditional.
configure.ac
dummy/Kbuild
dummy/Makefile.am
master/Kbuild
master/device.c
master/device.h
--- a/configure.ac	Mon Aug 06 12:33:09 2007 +0000
+++ b/configure.ac	Tue Aug 07 07:54:51 2007 +0000
@@ -346,25 +346,48 @@
 # Debug interface
 #------------------------------------------------------------------------------
 
-AC_ARG_ENABLE([dbg-if],
-    AS_HELP_STRING([--enable-dbg-if],
+AC_ARG_ENABLE([debug-if],
+    AS_HELP_STRING([--enable-debug-if],
                    [Create a debug interface for each master @<:@NO@:>@]),
     [
         case "${enableval}" in
             yes) dbg=1
-                AC_DEFINE([EC_DBG_IF], [1], [Debug interfaces enabled])
                 ;;
             no) dbg=0
                 ;;
-            *) AC_MSG_ERROR([Invalid value for --enable-dbg-if])
+            *) AC_MSG_ERROR([Invalid value for --enable-debug-if])
                 ;;
         esac
     ],
     [dbg=0]
 )
 
-AM_CONDITIONAL(EC_DBG_IF, test "x$dbg" = "x1")
-AC_SUBST([EC_DBG_IF],${dbg})
+if test "x${dbg}" = "x1"; then
+    AC_DEFINE([EC_DEBUG_IF], [1], [Debug interfaces enabled])
+fi
+AM_CONDITIONAL(ENABLE_DEBUG_IF, test "x$dbg" = "x1")
+
+#------------------------------------------------------------------------------
+# Dummy master module
+#------------------------------------------------------------------------------
+
+AC_ARG_ENABLE([dummy],
+    AS_HELP_STRING([--enable-dummy],
+                   [Build the dummy master module @<:@NO@:>@]),
+    [
+        case "${enableval}" in
+            yes) dummy=1
+                ;;
+            no) dummy=0
+                ;;
+            *) AC_MSG_ERROR([Invalid value for --enable-dummy])
+                ;;
+        esac
+    ],
+    [dummy=0]
+)
+
+AM_CONDITIONAL(ENABLE_DUMMY, test "x$dummy" = "x1")
 
 #------------------------------------------------------------------------------
 
@@ -374,7 +397,7 @@
 
 cat > config.kbuild <<EOF
 # config.kbuild - created by configure
-EC_DBG_IF := ${dbg}
+EC_DEBUG_IF := ${dbg}
 EC_ENABLE_8139TOO := ${enable8139too}
 EC_8139TOO_KERNEL := ${kernel8139too}
 EC_ENABLE_E100 := ${enablee100}
@@ -385,6 +408,7 @@
 EC_E1000_KERNEL := ${kernele1000}
 EC_RTAI_DIR := "${rtaidir}"
 EC_MSR_DIR := "${msrdir}"
+EC_DUMMY := ${dummy}
 EOF
 
 #------------------------------------------------------------------------------
--- a/dummy/Kbuild	Mon Aug 06 12:33:09 2007 +0000
+++ b/dummy/Kbuild	Tue Aug 07 07:54:51 2007 +0000
@@ -33,16 +33,16 @@
 
 include $(src)/../config.kbuild
 
-obj-m := ec_dummy.o
-
-ec_dummy-objs := module.o master.o slave.o domain.o
-
 REV := $(shell if test -s $(src)/../svnrevision; then \
 		cat $(src)/../svnrevision; \
 	else \
 		svnversion $(src) 2>/dev/null || echo "unknown"; \
 	fi)
 
-CFLAGS_dummy.o := -DSVNREV=$(REV)
+ifeq ($(EC_DUMMY),1)
+    obj-m := ec_dummy.o
+	ec_dummy-objs := module.o master.o slave.o domain.o
+	CFLAGS_dummy.o := -DSVNREV=$(REV)
+endif
 
 #------------------------------------------------------------------------------
--- a/dummy/Makefile.am	Mon Aug 06 12:33:09 2007 +0000
+++ b/dummy/Makefile.am	Tue Aug 07 07:54:51 2007 +0000
@@ -39,11 +39,13 @@
     domain.c
 
 modules:
-	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_top_srcdir@" modules
+	$(MAKE) -C "@abs_top_srcdir@" modules
 
 modules_install:
 	mkdir -p $(DESTDIR)$(LINUX_MOD_PATH)
+if ENABLE_DUMMY
 	cp $(srcdir)/ec_dummy.ko $(DESTDIR)$(LINUX_MOD_PATH)
+endif
 
 clean-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean
--- a/master/Kbuild	Mon Aug 06 12:33:09 2007 +0000
+++ b/master/Kbuild	Tue Aug 07 07:54:51 2007 +0000
@@ -39,7 +39,7 @@
     datagram.o domain.o mailbox.o canopen.o ethernet.o fsm_sii.o fsm_change.o \
     fsm_coe.o fsm_mapping.o fsm_slave.o fsm_master.o xmldev.o
 
-ifeq ($(EC_DBG_IF),1)
+ifeq ($(ENABLE_DEBUG_IF),1)
 	ec_master-objs += debug.o
 endif
 
--- a/master/device.c	Mon Aug 06 12:33:09 2007 +0000
+++ b/master/device.c	Tue Aug 07 07:54:51 2007 +0000
@@ -59,7 +59,7 @@
 {
     device->master = master;
 
-#ifdef EC_DBG_IF
+#ifdef EC_DEBUG_IF
     if (ec_debug_init(&device->dbg)) {
         EC_ERR("Failed to init debug device!\n");
         goto out_return;
@@ -68,7 +68,7 @@
 
     if (!(device->tx_skb = dev_alloc_skb(ETH_FRAME_LEN))) {
         EC_ERR("Error allocating device socket buffer!\n");
-#ifdef EC_DBG_IF
+#ifdef EC_DEBUG_IF
         goto out_debug;
 #else
         goto out_return;
@@ -84,7 +84,7 @@
     ec_device_detach(device); // resets remaining fields
     return 0;
 
-#ifdef EC_DBG_IF
+#ifdef EC_DEBUG_IF
  out_debug:
     ec_debug_clear(&device->dbg);
 #endif
@@ -102,7 +102,7 @@
 {
     if (device->open) ec_device_close(device);
     dev_kfree_skb(device->tx_skb);
-#ifdef EC_DBG_IF
+#ifdef EC_DEBUG_IF
     ec_debug_clear(&device->dbg);
 #endif
 }
@@ -234,7 +234,7 @@
         ec_print_data(device->tx_skb->data + ETH_HLEN, size);
     }
 
-#ifdef EC_DBG_IF
+#ifdef EC_DEBUG_IF
     ec_debug_send(&device->dbg, device->tx_skb->data, ETH_HLEN + size);
 #endif
 
@@ -283,7 +283,7 @@
                            data + ETH_HLEN, size - ETH_HLEN);
     }
 
-#ifdef EC_DBG_IF
+#ifdef EC_DEBUG_IF
     ec_debug_send(&device->dbg, data, size);
 #endif
 
--- a/master/device.h	Mon Aug 06 12:33:09 2007 +0000
+++ b/master/device.h	Tue Aug 07 07:54:51 2007 +0000
@@ -47,7 +47,7 @@
 #include "../devices/ecdev.h"
 #include "globals.h"
 
-#ifdef EC_DBG_IF
+#ifdef EC_DEBUG_IF
 #include "debug.h"
 #endif
 
@@ -73,7 +73,7 @@
     unsigned long jiffies_poll; /**< jiffies of last poll */
     unsigned int tx_count; /**< number of frames sent */
     unsigned int rx_count; /**< number of frames received */
-#ifdef EC_DBG_IF
+#ifdef EC_DEBUG_IF
     ec_debug_t dbg; /**< debug device */
 #endif
 };