Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
if(x<=1)
return __canque_edge_decref(edge);
y=x;
if(x<=1)
return __canque_edge_decref(edge);
y=x;
+ #ifdef CAN_HAVE_ATOMIC_CMPXCHG
+ atomic_cmpxchg(&edge->edge_used, x, x-1);
+ #else /* workaround for case that atomic_cmpxchg is not defined */
/* This code strongly depends on the definition of atomic_t !!!! */
/* This code strongly depends on the definition of atomic_t !!!! */
- /* x=cmpxchg(&edge->edge_used, x, x-1); */
- /* Next alternative could be more portable */
x=__cmpxchg(&edge->edge_used, x, x-1, sizeof(atomic_t));
/* If even this does not help, comment out CAN_HAVE_ARCH_CMPXCHG in can_sysdep.h */
x=__cmpxchg(&edge->edge_used, x, x-1, sizeof(atomic_t));
/* If even this does not help, comment out CAN_HAVE_ARCH_CMPXCHG in can_sysdep.h */
#ifdef __HAVE_ARCH_CMPXCHG
#define CAN_HAVE_ARCH_CMPXCHG
#ifdef __HAVE_ARCH_CMPXCHG
#define CAN_HAVE_ARCH_CMPXCHG
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
+ #define CAN_HAVE_ATOMIC_CMPXCHG
+ #endif
#endif
#ifndef CAN_WITH_RTL
#endif
#ifndef CAN_WITH_RTL
#define EXPORT_SYMTAB
#endif
#define EXPORT_SYMTAB
#endif
-#include <linux/autoconf.h>
-
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/poll.h>
#include <linux/version.h>
#include <linux/sched.h>
#include <linux/poll.h>
#include <linux/version.h>
-#include <linux/autoconf.h>
#include <linux/interrupt.h>
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0))
#include <linux/interrupt.h>
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0))
+ #include <linux/autoconf.h>
#include <linux/wrapper.h>
#else
#include <linux/device.h>
#include <linux/wrapper.h>
#else
#include <linux/device.h>
# Makefile.rules - OCERA make framework common project rules -*- makefile-gmake -*- #OMK:base.omk
#
# Makefile.rules - OCERA make framework common project rules -*- makefile-gmake -*- #OMK:base.omk
#
-# (C) Copyright 2003 by Pavel Pisa - OCERA team member
-# (C) Copyright 2006 by Michal Sojka - Czech Technical University, FEE, DCE
+# (C) Copyright 2003, 2006, 2007, 2008, 2009 by Pavel Pisa - OCERA team member
+# (C) Copyright 2006, 2007, 2008, 2009, 2010 by Michal Sojka - Czech Technical University, FEE, DCE
#
# Homepage: http://rtime.felk.cvut.cz/omk/
#
# Homepage: http://rtime.felk.cvut.cz/omk/
-# Version: 0.1-88-g324e3bf
+# Version: 0.2-12-g881199c
#
# The OMK build system is distributed under the GNU General Public
# License. See file COPYING for details.
#
# The OMK build system is distributed under the GNU General Public
# License. See file COPYING for details.
# QTDIR .. where QT resides
OMK_RULES_TYPE=linux #OMK:Makefile.rules.linux@
#OMK:base.omk@Makefile.rules.linux
# QTDIR .. where QT resides
OMK_RULES_TYPE=linux #OMK:Makefile.rules.linux@
#OMK:base.omk@Makefile.rules.linux
-# We need to ensure definition of sources directory first
-ifndef SOURCES_DIR
-# Only shell built-in pwd understands -L
-SOURCES_DIR := $(shell ( pwd -L ) )
-endif
-
# If we are not called by OMK leaf Makefile...
ifndef MAKERULES_DIR
MAKERULES_DIR := $(abspath $(dir $(filter %Makefile.rules,$(MAKEFILE_LIST))))
# If we are not called by OMK leaf Makefile...
ifndef MAKERULES_DIR
MAKERULES_DIR := $(abspath $(dir $(filter %Makefile.rules,$(MAKEFILE_LIST))))
OUTPUT_DIR := $(MAKERULES_DIR)
endif
OUTPUT_DIR := $(MAKERULES_DIR)
endif
+# We need to ensure definition of sources directory first
+ifndef SOURCES_DIR
+# Only shell built-in pwd understands -L
+SOURCES_DIR := $(shell ( pwd -L ) )
+INVOCATION_DIR := $(SOURCES_DIR:$(OUTPUT_DIR)%=%)
+INVOCATION_DIR := $(INVOCATION_DIR:/%=%)
+INVOCATION_DIR := $(INVOCATION_DIR:\\%=%)
+endif
+
.PHONY: all default check-make-ver omkize
ifdef W
.PHONY: all default check-make-ver omkize
ifdef W
CONFIG_FILES ?= $(wildcard $(CONFIG_FILE)-default) $(wildcard $(OUTPUT_DIR)/config.target) $(wildcard $(CONFIG_FILE))
CONFIG_FILES ?= $(wildcard $(CONFIG_FILE)-default) $(wildcard $(OUTPUT_DIR)/config.target) $(wildcard $(CONFIG_FILE))
-export SOURCES_DIR MAKERULES_DIR RELATIVE_DIR
+export SOURCES_DIR MAKERULES_DIR RELATIVE_DIR INVOCATION_DIR
export CONFIG_FILE CONFIG_FILES OMK_SERIALIZE_INCLUDED OMK_VERBOSE OMK_SILENT
# OMK_SERIALIZE_INCLUDED has to be exported to submakes because passes
# must to be serialized only in the toplevel make.
export CONFIG_FILE CONFIG_FILES OMK_SERIALIZE_INCLUDED OMK_VERBOSE OMK_SILENT
# OMK_SERIALIZE_INCLUDED has to be exported to submakes because passes
# must to be serialized only in the toplevel make.
# Call a pass in a subdirectory
# Usage: $(call omk_pass_subdir_template,<pass name>,<build dir>,<subdir>)
define omk_pass_subdir_template
.PHONY: $(pass)-$(3)-subdir
$(pass)-submakes: $(pass)-$(3)-subdir
# Call a pass in a subdirectory
# Usage: $(call omk_pass_subdir_template,<pass name>,<build dir>,<subdir>)
define omk_pass_subdir_template
.PHONY: $(pass)-$(3)-subdir
$(pass)-submakes: $(pass)-$(3)-subdir
+$(pass)-$(3)-subdir: MAKEOVERRIDES:=$(filter-out SUBDIRS=%,$(MAKEOVERRIDES))
$(pass)-$(3)-subdir:
@$(call mkdir_def,$(2)/$(3))
+@$(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(3) $(NO_PRINT_DIRECTORY) \
$(pass)-$(3)-subdir:
@$(call mkdir_def,$(2)/$(3))
+@$(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(3) $(NO_PRINT_DIRECTORY) \
LIB_CFLAGS += $(CFLAGS)
ifeq ($(TARGET_OS),win32)
LIB_CFLAGS += $(CFLAGS)
ifeq ($(TARGET_OS),win32)
SOLIB_EXT = dll
else
SOLIB_EXT = so
SOLIB_EXT = dll
else
SOLIB_EXT = so
# Syntax: $(call CMETRIC_o_h_template,<object_file>,<target_header>)
define CMETRIC_o_h_template
# Syntax: $(call CMETRIC_o_h_template,<object_file>,<target_header>)
define CMETRIC_o_h_template
$(Q)if [ -n `dirname $$@` ] ; then \
if [ ! -e `dirname $$@` ] ; then \
mkdir -p `dirname $$@` ; fi ; fi
$(Q)if [ -n `dirname $$@` ] ; then \
if [ ! -e `dirname $$@` ] ; then \
mkdir -p `dirname $$@` ; fi ; fi
- $(Q)echo >$$@ '/* Automatically generated from $$< */'
- $(Q)echo >>$$@ '/* Conditionals to control compilation */'
- $(Q)set -o pipefail ; $(NM) $$< \
+ $(Q)echo >$$@.tmp '/* Automatically generated from $$< */'
+ $(Q)echo >>$$@.tmp '/* Conditionals to control compilation */'
+# Bellow, the tricks with redirection are for shells without set -o pipefail
+# (see http://www.mail-archive.com/dash@vger.kernel.org/msg00149.html)
+ $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) $$<; echo $$$$? >&4; }\
| sed -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2cond_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
| sed -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2cond_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
- | sort >>$$@
- $(Q)echo >>$$@ '/* Defines from the values defined to symbols */'
- $(Q)set -o pipefail ; $(NM) $$< \
+ | sort >>$$@.tmp` && exit $$$$status
+ $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols in hexadecimal format */'
+ $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) $$<; echo $$$$? >&4; }\
| sed -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2def_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
| sed -n 's/^ *0*\(0[0-9A-Fa-f]*\) *A *_cmetric2def_\([A-Za-z_0-9]*\) */#define \2 0x\1/p' \
+ | sort >>$$@.tmp` && exit $$$$status
+ $(Q)echo >>$$@.tmp '/* Defines from the values defined to symbols in decimal format */'
+ $(Q)exec 3>&1; status=`exec 4>&1 >&3; { $(NM) -td $$<; echo $$$$? >&4; }\
+ | sed -n 's/^ *0*\(0\|[1-9][0-9]*\) *A *_cmetric2defdec_\([A-Za-z_0-9]*\) */#define \2 \1/p' \
+ | sort >>$$@.tmp` && exit $$$$status
+ $(Q)mv $$@.tmp $$@
# FIXME: Handle multiple .pro files correctly
$(LOCAL_BUILD_DIR)/$(dir $(1))Makefile: $(SOURCES_DIR)/$(1)
$(Q)mkdir -p $$(dir $$(@)) && cd $$(dir $$(@)) && \
# FIXME: Handle multiple .pro files correctly
$(LOCAL_BUILD_DIR)/$(dir $(1))Makefile: $(SOURCES_DIR)/$(1)
$(Q)mkdir -p $$(dir $$(@)) && cd $$(dir $$(@)) && \
- $(QTDIR:%=%/bin/)qmake \
+ $(if $(QMAKE),$(QMAKE),$(QTDIR:%=%/bin/)qmake) \
TOP_DIR=$(OUTPUT_DIR) \
RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir $(1)) \
$(QTDIR:%=QTDIR=%) CC=$(CC) CXX=$(CXX) \
TOP_DIR=$(OUTPUT_DIR) \
RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir $(1)) \
$(QTDIR:%=QTDIR=%) CC=$(CC) CXX=$(CXX) \
LINUX_VERSION=$(grep UTS_RELEASE ${LINUX_DIR}/include/linux/utsrelease.h | \
sed 's/[^"]*"\(.*\)\{1\}"/\1/')
fi
LINUX_VERSION=$(grep UTS_RELEASE ${LINUX_DIR}/include/linux/utsrelease.h | \
sed 's/[^"]*"\(.*\)\{1\}"/\1/')
fi
+if [ -z "$LINUX_VERSION" ] ; then
+ LINUX_VERSION=$(grep UTS_RELEASE ${LINUX_DIR}/include/generated/utsrelease.h | \
+ sed 's/[^"]*"\(.*\)\{1\}"/\1/')
+fi
LINUX_VERSION_MAJOR=$(echo ${LINUX_VERSION} | cut -d. -f1)
LINUX_VERSION_MINOR=$(echo ${LINUX_VERSION} | cut -d. -f2)
LINUX_VERSION_MAJOR=$(echo ${LINUX_VERSION} | cut -d. -f1)
LINUX_VERSION_MINOR=$(echo ${LINUX_VERSION} | cut -d. -f2)