drivers/can_anagate_linux/Makefile
author Robert Lehmann <robert.lehmann@sitec-systems.de>
Tue, 28 Jul 2015 16:36:55 +0200
changeset 793 72e9e1064432
parent 790 1936110171a2
permissions -rw-r--r--
timers_unix: Fix termination problem of WaitReceiveTaskEnd

The function pthread_kill sends the Signal thread and to the own process.
If you use this construct than the application which calls uses the
canfestival api will terminate at the call of canClose. To avoid that
use pthread_cancel instead of pthread_kill. To use the pthread_cancel call
you need to set the cancel ability in the thread function. That means
you need to call pthread_setcancelstate and pthread_setcanceltype.
For the termination of the thread at any time it is important to set the
cancel type to PTHREAD_CANCEL_ASYNCHRONOUS.
494
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     1
#! gmake
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     2
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     3
#
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     4
# Copyright (C) 2006 Laurent Bessard
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     5
# 
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     6
# This file is part of canfestival, a library implementing the canopen
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     7
# stack
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     8
# 
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
     9
# This library is free software; you can redistribute it and/or
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    10
# modify it under the terms of the GNU Lesser General Public
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    11
# License as published by the Free Software Foundation; either
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    12
# version 2.1 of the License, or (at your option) any later version.
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    13
# 
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    14
# This library is distributed in the hope that it will be useful,
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    17
# Lesser General Public License for more details.
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    18
# 
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    19
# You should have received a copy of the GNU Lesser General Public
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    20
# License along with this library; if not, write to the Free Software
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    21
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    22
# 
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    23
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    24
CC = gcc
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    25
OPT_CFLAGS = -O2
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    26
CFLAGS = $(OPT_CFLAGS)
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    27
PROG_CFLAGS = 
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    28
PREFIX = /usr/local
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    29
TARGET = unix
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    30
CAN_DRIVER = can_anagate_linux
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    31
TIMERS_DRIVER = timers_unix
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    32
ENABLE_DLL_DRIVERS=1
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    33
CAN_DLL_CFLAGS= -lAnaGateAPIDLL -lAnaCommon
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    34
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    35
INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(CAN_DRIVER)
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    36
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    37
OBJS = $(CAN_DRIVER).o
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    38
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    39
ifeq ($(ENABLE_DLL_DRIVERS),1)
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    40
CFLAGS += -fPIC
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    41
DRIVER = libcanfestival_$(CAN_DRIVER).so
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    42
else
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    43
DRIVER = $(OBJS)
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    44
endif
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    45
790
1936110171a2 Honor DESTDIR in install rules
Samuel Martin <s.martin49@gmail.com>
parents: 658
diff changeset
    46
TARGET_SOFILES = $(DESTDIR)$(PREFIX)/lib/$(DRIVER)
494
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    47
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    48
all: driver
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    49
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    50
driver: $(DRIVER)
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    51
658
7758d60e9260 FIXED: - changed make targets from "%o: %c" to "%.o: %.c" (Patch from irc <oleg_osov>)
Christian Taedcke
parents: 494
diff changeset
    52
%.o: %.c
494
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    53
	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $<
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    54
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    55
libcanfestival_$(CAN_DRIVER).so: $(OBJS)
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    56
	$(CC) -shared -Wl,-soname,libcanfestival_$(CAN_DRIVER).so $(CAN_DLL_CFLAGS) -o $@ $<
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    57
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    58
install: libcanfestival_$(CAN_DRIVER).so
790
1936110171a2 Honor DESTDIR in install rules
Samuel Martin <s.martin49@gmail.com>
parents: 658
diff changeset
    59
	mkdir -p $(DESTDIR)$(PREFIX)/lib/
1936110171a2 Honor DESTDIR in install rules
Samuel Martin <s.martin49@gmail.com>
parents: 658
diff changeset
    60
	cp $< $(DESTDIR)$(PREFIX)/lib/
494
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    61
		
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    62
uninstall:
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    63
	rm -f $(TARGET_SOFILES)
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    64
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    65
clean:
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    66
	rm -f $(OBJS)
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    67
aa36efce6e78 add anagate device support in CanFestival
greg
parents:
diff changeset
    68
mrproper: clean