drivers/can_kvaser/Makefile.in
author Edouard Tisserant
Mon, 23 Apr 2018 12:32:03 +0200
changeset 805 570e3a444023
parent 790 1936110171a2
permissions -rw-r--r--
Workaround Alchemy task not beeing waken up when closing file descriptor it is waiting on, sequel of Xenomai3 all posix file ops
400
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     1
#! gmake
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     2
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     3
#
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     4
# Copyright (C) 2006 Giuseppe Massimo Bertani and Laurent Bessard
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     5
# 
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     6
# This file is part of canfestival, a library implementing the canopen
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     7
# stack
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     8
# 
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
     9
# This library is free software; you can redistribute it and/or
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    10
# modify it under the terms of the GNU Lesser General Public
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    11
# License as published by the Free Software Foundation; either
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    12
# version 2.1 of the License, or (at your option) any later version.
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    13
# 
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    14
# This library is distributed in the hope that it will be useful,
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    17
# Lesser General Public License for more details.
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    18
# 
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    19
# You should have received a copy of the GNU Lesser General Public
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    20
# License along with this library; if not, write to the Free Software
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    21
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    22
# 
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    23
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    24
CC = SUB_CC
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    25
OPT_CFLAGS = -O2
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    26
CFLAGS = SUB_OPT_CFLAGS
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    27
PROG_CFLAGS = SUB_PROG_CFLAGS
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    28
PREFIX = SUB_PREFIX
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    29
TARGET = SUB_TARGET
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    30
CAN_DRIVER = SUB_CAN_DRIVER
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    31
TIMERS_DRIVER = SUB_TIMERS_DRIVER
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    32
ENABLE_DLL_DRIVERS = SUB_ENABLE_DLL_DRIVERS
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    33
CAN_DLL_CFLAGS = SUB_CAN_DLL_CFLAGS
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    34
OS_NAME = SUB_OS_NAME
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    35
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    36
INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(CAN_DRIVER)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    37
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    38
OBJS = $(CAN_DRIVER).o
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    39
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    40
#GMB: must detect if we are under cygwin (produces a DLL driver)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    41
#or under a real unix machine (produces a .so driver)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    42
ifeq ($(ENABLE_DLL_DRIVERS),1)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    43
    ifeq ($(OS_NAME),CYGWIN)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    44
        DRIVER = libcanfestival_$(CAN_DRIVER).dll
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    45
    else
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    46
        ifeq ($(TARGET),unix)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    47
            CFLAGS += -fPIC
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    48
            DRIVER = libcanfestival_$(CAN_DRIVER).so
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    49
        endif
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    50
    endif
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    51
else
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    52
DRIVER = $(OBJS)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    53
endif
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    54
790
1936110171a2 Honor DESTDIR in install rules
Samuel Martin <s.martin49@gmail.com>
parents: 658
diff changeset
    55
TARGET_SOFILES = $(DESTDIR)$(PREFIX)/lib/$(DRIVER)
400
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    56
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    57
all: driver
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    58
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    59
driver: $(DRIVER)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    60
658
7758d60e9260 FIXED: - changed make targets from "%o: %c" to "%.o: %.c" (Patch from irc <oleg_osov>)
Christian Taedcke
parents: 502
diff changeset
    61
%.o: %.c
400
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    62
	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $<
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    63
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    64
$(DRIVER): $(OBJS)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    65
	$(CC) -shared -Wl,-soname,$(DRIVER) $(CAN_DLL_CFLAGS) -o $@ $< 
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    66
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    67
install: $(DRIVER)
790
1936110171a2 Honor DESTDIR in install rules
Samuel Martin <s.martin49@gmail.com>
parents: 658
diff changeset
    68
	mkdir -p $(DESTDIR)$(PREFIX)/lib/
1936110171a2 Honor DESTDIR in install rules
Samuel Martin <s.martin49@gmail.com>
parents: 658
diff changeset
    69
	cp $< $(DESTDIR)$(PREFIX)/lib/
400
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    70
		
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    71
uninstall:
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    72
	rm -f $(TARGET_SOFILES)
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    73
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    74
clean:
502
e06afbb9adcd Added removal of dynamically loaded CAN driver interface library in clean make target
etisserant
parents: 400
diff changeset
    75
	rm -f $(OBJS) libcanfestival_$(CAN_DRIVER).so
400
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    76
7d845f5d730c Added Kvaser hardware support, thanks to Giuseppe Massimo Bertani .
etisserant
parents:
diff changeset
    77
mrproper: clean