Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.

This commit is contained in:
Florian Pose 2006-10-25 16:49:53 +00:00
parent e5a176ba9b
commit 4fbd230e2b
9 changed files with 96 additions and 41 deletions

View File

@ -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 \

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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 " \

View File

@ -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)
#------------------------------------------------------------------------------

72
globals.h Normal file
View File

@ -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

View File

@ -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)
#------------------------------------------------------------------------------

View File

@ -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 *);

View File

@ -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:

View File

@ -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 */