Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
authorFlorian Pose <fp@igh-essen.com>
Wed, 25 Oct 2006 16:49:53 +0000
changeset 444 31223539fc00
parent 443 0746236dd032
child 445 3b7eec329112
Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Makefile.am
configure.ac
devices/8139too.c
devices/Kbuild
globals.h
master/Kbuild
master/globals.h
master/master.c
master/module.c
--- a/Makefile.am	Wed Oct 25 13:32:17 2006 +0000
+++ b/Makefile.am	Wed Oct 25 16:49:53 2006 +0000
@@ -39,7 +39,8 @@
 
 mydist:
 	@SVNREV=`svnversion $(srcdir)` && \
-	  $(MAKE) dist-bzip2 distdir=$(PACKAGE)-$(VERSION)-trunk-r$${SVNREV}
+	  $(MAKE) dist-bzip2 \
+	  distdir=$(PACKAGE)-$(VERSION)-$(BRANCH)-r$${SVNREV}
 
 dist-hook:
 	if which svnversion >/dev/null 2>&1; then \
--- a/configure.ac	Wed Oct 25 13:32:17 2006 +0000
+++ b/configure.ac	Wed Oct 25 16:49:53 2006 +0000
@@ -11,6 +11,15 @@
 AC_CONFIG_SRCDIR([config.h.in])
 
 #------------------------------------------------------------------------------
+# Global
+#------------------------------------------------------------------------------
+
+branch=trunk
+
+AC_DEFINE_UNQUOTED(BRANCH, ["$branch"], [Subversion branch])
+AC_SUBST(BRANCH, [$branch])
+
+#------------------------------------------------------------------------------
 # Linux sources
 #------------------------------------------------------------------------------
 
--- a/devices/8139too.c	Wed Oct 25 13:32:17 2006 +0000
+++ b/devices/8139too.c	Wed Oct 25 16:49:53 2006 +0000
@@ -155,11 +155,8 @@
 
 /* EtherCAT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
 
+#include "../globals.h"
 #include "ecdev.h"
-#include "../master/globals.h"
-
-#define LIT(X) #X
-#define STR(X) LIT(X)
 
 #define RTL8139_DRIVER_NAME DRV_NAME \
                             " EtherCAT-capable Fast Ethernet driver " \
--- a/devices/Kbuild	Wed Oct 25 13:32:17 2006 +0000
+++ b/devices/Kbuild	Wed Oct 25 16:49:53 2006 +0000
@@ -45,6 +45,6 @@
 		svnversion $(src)/.. 2>/dev/null || echo "unknown"; \
 	fi)
 
-EXTRA_CFLAGS = -DSVNREV=$(REV)
+CFLAGS_8139too.o = -DSVNREV=$(REV)
 
 #------------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/globals.h	Wed Oct 25 16:49:53 2006 +0000
@@ -0,0 +1,72 @@
+/******************************************************************************
+ *
+ *  $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.
+ *
+ *****************************************************************************/
+
+/**
+   \file
+   Global definitions and macros.
+*/
+
+/*****************************************************************************/
+
+#ifndef _EC_GLOBALS_
+#define _EC_GLOBALS_
+
+#include "config.h"
+
+/******************************************************************************
+ *  Overall macros
+ *****************************************************************************/
+
+/**
+   Helper macro for EC_STR(), literates a macro argument.
+   \param X argument to literate.
+*/
+
+#define EC_LIT(X) #X
+
+/**
+   Converts a macro argument to a string.
+   \param X argument to stringify.
+*/
+
+#define EC_STR(X) EC_LIT(X)
+
+/**
+   Master version string
+*/
+
+#define EC_MASTER_VERSION VERSION " " BRANCH " r" EC_STR(SVNREV)
+
+/*****************************************************************************/
+
+#endif
--- a/master/Kbuild	Wed Oct 25 13:32:17 2006 +0000
+++ b/master/Kbuild	Wed Oct 25 16:49:53 2006 +0000
@@ -51,6 +51,6 @@
 		svnversion $(src) 2>/dev/null || echo "unknown"; \
 	fi)
 
-EXTRA_CFLAGS := -DSVNREV=$(REV)
+CFLAGS_module.o := -DSVNREV=$(REV)
 
 #------------------------------------------------------------------------------
--- a/master/globals.h	Wed Oct 25 13:32:17 2006 +0000
+++ b/master/globals.h	Wed Oct 25 16:49:53 2006 +0000
@@ -38,33 +38,17 @@
 
 /*****************************************************************************/
 
-#ifndef _EC_GLOBALS_
-#define _EC_GLOBALS_
+#ifndef _EC_MASTER_GLOBALS_
+#define _EC_MASTER_GLOBALS_
 
 #include <linux/types.h>
 
-#include "../config.h"
+#include "../globals.h"
 
 /******************************************************************************
  *  EtherCAT master
  *****************************************************************************/
 
-/** master main version */
-#define EC_MASTER_VERSION_MAIN  1
-
-/** master sub version (after the dot) */
-#define EC_MASTER_VERSION_SUB   1
-
-/** master extra version (just a string) */
-#define EC_MASTER_VERSION_EXTRA "trunk"
-
-/** Compile version info. */
-
-#define EC_MASTER_VERSION EC_STR(EC_MASTER_VERSION_MAIN) \
-                          "." EC_STR(EC_MASTER_VERSION_SUB) \
-                          " " EC_MASTER_VERSION_EXTRA \
-                          " r" EC_STR(SVNREV)
-
 /** maximum number of FMMUs per slave */
 #define EC_MAX_FMMUS 16
 
@@ -150,20 +134,6 @@
     printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args)
 
 /**
-   Helper macro for EC_STR(), literates a macro argument.
-   \param X argument to literate.
-*/
-
-#define EC_LIT(X) #X
-
-/**
-   Converts a macro argument to a string.
-   \param X argument to stringify.
-*/
-
-#define EC_STR(X) EC_LIT(X)
-
-/**
    Convenience macro for defining read-only SysFS attributes.
    This results in creating a static variable called attr_\a NAME. The SysFS
    file will be world-readable.
@@ -189,6 +159,10 @@
 
 /*****************************************************************************/
 
+extern char *ec_master_version_str;
+
+/*****************************************************************************/
+
 void ec_print_data(const uint8_t *, size_t);
 void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t);
 size_t ec_state_string(uint8_t, char *);
--- a/master/master.c	Wed Oct 25 13:32:17 2006 +0000
+++ b/master/master.c	Wed Oct 25 16:49:53 2006 +0000
@@ -765,7 +765,7 @@
     ec_eoe_t *eoe;
     uint32_t cur, sum, min, max, pos, i;
 
-    off += sprintf(buffer + off, "\nVersion: " EC_MASTER_VERSION);
+    off += sprintf(buffer + off, "\nVersion: %s", ec_master_version_str);
     off += sprintf(buffer + off, "\nMode: ");
     switch (master->mode) {
         case EC_MASTER_MODE_ORPHANED:
--- a/master/module.c	Wed Oct 25 13:32:17 2006 +0000
+++ b/master/module.c	Wed Oct 25 16:49:53 2006 +0000
@@ -58,6 +58,8 @@
 static struct list_head ec_masters; /**< list of masters */
 static dev_t device_number;
 
+char *ec_master_version_str = EC_MASTER_VERSION;
+
 /*****************************************************************************/
 
 /** \cond */