author | Christian Taedcke <hacking@taedcke.com> |
Mon, 21 May 2012 16:13:47 +0200 | |
changeset 720 | 09dd61317f0f |
parent 658 | 7758d60e9260 |
child 790 | 1936110171a2 |
permissions | -rw-r--r-- |
448
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
1 |
#! gmake |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
2 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
3 |
# |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
4 |
# Copyright (C) 2006 Laurent Bessard |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
5 |
# |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
6 |
# This file is part of canfestival, a library implementing the canopen |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
7 |
# stack |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
8 |
# |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
9 |
# This library is free software; you can redistribute it and/or |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
10 |
# modify it under the terms of the GNU Lesser General Public |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
11 |
# License as published by the Free Software Foundation; either |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
12 |
# version 2.1 of the License, or (at your option) any later version. |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
13 |
# |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
14 |
# This library is distributed in the hope that it will be useful, |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
17 |
# Lesser General Public License for more details. |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
18 |
# |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
19 |
# You should have received a copy of the GNU Lesser General Public |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
20 |
# License along with this library; if not, write to the Free Software |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
21 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
22 |
# |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
23 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
24 |
CC = SUB_CC |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
25 |
OPT_CFLAGS = -O2 |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
26 |
CFLAGS = SUB_OPT_CFLAGS |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
27 |
PROG_CFLAGS = SUB_PROG_CFLAGS |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
28 |
PREFIX = SUB_PREFIX |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
29 |
TARGET = SUB_TARGET |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
30 |
CAN_DRIVER = SUB_CAN_DRIVER |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
31 |
TIMERS_DRIVER = SUB_TIMERS_DRIVER |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
32 |
ENABLE_DLL_DRIVERS=SUB_ENABLE_DLL_DRIVERS |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
33 |
CAN_DLL_CFLAGS=SUB_CAN_DLL_CFLAGS |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
34 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
35 |
INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(CAN_DRIVER) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
36 |
INCLUDES += -I../../include/$(TIMERS_DRIVER) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
37 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
38 |
OBJS = $(CAN_DRIVER).o |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
39 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
40 |
ifeq ($(ENABLE_DLL_DRIVERS),1) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
41 |
CFLAGS += -fPIC |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
42 |
DRIVER = libcanfestival_$(CAN_DRIVER).so |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
43 |
else |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
44 |
DRIVER = $(OBJS) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
45 |
endif |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
46 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
47 |
HUB=can_serial_hub |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
48 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
49 |
TARGET_SOFILES = $(PREFIX)/lib/$(DRIVER) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
50 |
TARGET_BINFILES = $(PREFIX)/bin/$(HUB) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
51 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
52 |
all: driver $(HUB) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
53 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
54 |
$(HUB): $(HUB).c |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
55 |
$(CC) -O2 -Wall -fno-strict-aliasing $(INCLUDES) -o $(HUB) $(HUB).c -ldl |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
56 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
57 |
driver: $(DRIVER) $(HUB) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
58 |
|
658
7758d60e9260
FIXED: - changed make targets from "%o: %c" to "%.o: %.c" (Patch from irc <oleg_osov>)
Christian Taedcke
parents:
504
diff
changeset
|
59 |
%.o: %.c |
448
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
60 |
$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $< |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
61 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
62 |
libcanfestival_$(CAN_DRIVER).so: $(OBJS) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
63 |
$(CC) -shared -Wl,-soname,libcanfestival_$(CAN_DRIVER).so $(CAN_DLL_CFLAGS) -o $@ $< |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
64 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
65 |
install: libcanfestival_$(CAN_DRIVER).so $(HUB) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
66 |
mkdir -p $(PREFIX)/lib/ |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
67 |
cp libcanfestival_$(CAN_DRIVER).so $(PREFIX)/lib/ |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
68 |
mkdir -p $(PREFIX)/bin/ |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
69 |
cp $(HUB) $(PREFIX)/bin/ |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
70 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
71 |
uninstall: |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
72 |
rm -f $(TARGET_SOFILES) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
73 |
rm -f $(TARGET_BINFILES) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
74 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
75 |
clean: |
504
ad574af3628d
Added removal of dynamically loaded CAN driver interface library in clean make target
etisserant
parents:
448
diff
changeset
|
76 |
rm -f $(OBJS) libcanfestival_$(CAN_DRIVER).so |
448
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
77 |
rm -f $(HUB) |
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
78 |
|
732c33c2d8a7
CAN over Serial link (TTY) interface, with serial hub software. Thanks to James Steward.
etisserant
parents:
diff
changeset
|
79 |
mrproper: clean |