From 8dba8eaa13126ac9a1c90aa0f93511bf1c83fb09 Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Wed, 25 Oct 2006 16:49:53 +0000 Subject: [PATCH] Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling. --- Makefile.am | 3 +- configure.ac | 9 ++++++ devices/8139too.c | 5 +--- devices/Kbuild | 2 +- globals.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++ master/Kbuild | 2 +- master/globals.h | 40 +++++--------------------- master/master.c | 2 +- master/module.c | 2 ++ 9 files changed, 96 insertions(+), 41 deletions(-) create mode 100644 globals.h diff --git a/Makefile.am b/Makefile.am index 66c12f1d..a1080322 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,8 @@ EXTRA_DIST = documentation/ethercat_doc.pdf 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 \ diff --git a/configure.ac b/configure.ac index 51d4cc37..b85fc16f 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,15 @@ AC_PREFIX_DEFAULT([/opt/etherlab]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR([config.h.in]) +#------------------------------------------------------------------------------ +# Global +#------------------------------------------------------------------------------ + +branch=trunk + +AC_DEFINE_UNQUOTED(BRANCH, ["$branch"], [Subversion branch]) +AC_SUBST(BRANCH, [$branch]) + #------------------------------------------------------------------------------ # Linux sources #------------------------------------------------------------------------------ diff --git a/devices/8139too.c b/devices/8139too.c index 087099e4..bbe16802 100644 --- a/devices/8139too.c +++ b/devices/8139too.c @@ -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 " \ diff --git a/devices/Kbuild b/devices/Kbuild index fe841ff7..f4fb85fa 100644 --- a/devices/Kbuild +++ b/devices/Kbuild @@ -45,6 +45,6 @@ REV := $(shell if test -s $(src)/../svnrevision; then \ svnversion $(src)/.. 2>/dev/null || echo "unknown"; \ fi) -EXTRA_CFLAGS = -DSVNREV=$(REV) +CFLAGS_8139too.o = -DSVNREV=$(REV) #------------------------------------------------------------------------------ diff --git a/globals.h b/globals.h new file mode 100644 index 00000000..d060fea6 --- /dev/null +++ b/globals.h @@ -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 diff --git a/master/Kbuild b/master/Kbuild index 5c4f641b..905fe40e 100644 --- a/master/Kbuild +++ b/master/Kbuild @@ -51,6 +51,6 @@ REV := $(shell if test -s $(src)/../svnrevision; then \ svnversion $(src) 2>/dev/null || echo "unknown"; \ fi) -EXTRA_CFLAGS := -DSVNREV=$(REV) +CFLAGS_module.o := -DSVNREV=$(REV) #------------------------------------------------------------------------------ diff --git a/master/globals.h b/master/globals.h index 8fb56529..09287783 100644 --- a/master/globals.h +++ b/master/globals.h @@ -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 @@ -149,20 +133,6 @@ #define EC_DBG(fmt, args...) \ 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 @@ -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 *); diff --git a/master/master.c b/master/master.c index 493b0a13..532e7f24 100644 --- a/master/master.c +++ b/master/master.c @@ -765,7 +765,7 @@ ssize_t ec_master_info(ec_master_t *master, /**< EtherCAT master */ 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: diff --git a/master/module.c b/master/module.c index e76bc22c..524ede5f 100644 --- a/master/module.c +++ b/master/module.c @@ -58,6 +58,8 @@ static int ec_eoeif_count = 0; /**< parameter value, number of EoE interf. */ static struct list_head ec_masters; /**< list of masters */ static dev_t device_number; +char *ec_master_version_str = EC_MASTER_VERSION; + /*****************************************************************************/ /** \cond */ -- GitLab