forked from CANopenNode/CANopenNode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (55 loc) · 1.48 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Makefile for CANopenNode with Linux socketCAN
DRV_SRC = socketCAN
CANOPEN_SRC = .
APPL_SRC = example
LINK_TARGET = canopend
INCLUDE_DIRS = \
-I$(DRV_SRC) \
-I$(CANOPEN_SRC) \
-I$(APPL_SRC)
SOURCES = \
$(DRV_SRC)/CO_driver.c \
$(DRV_SRC)/CO_error.c \
$(DRV_SRC)/CO_epoll_interface.c \
$(DRV_SRC)/CO_OD_storage.c \
$(CANOPEN_SRC)/301/CO_NMT_Heartbeat.c \
$(CANOPEN_SRC)/301/CO_HBconsumer.c \
$(CANOPEN_SRC)/301/CO_Emergency.c \
$(CANOPEN_SRC)/301/CO_SDOserver.c \
$(CANOPEN_SRC)/301/CO_SDOclient.c \
$(CANOPEN_SRC)/301/CO_TIME.c \
$(CANOPEN_SRC)/301/CO_SYNC.c \
$(CANOPEN_SRC)/301/CO_PDO.c \
$(CANOPEN_SRC)/301/crc16-ccitt.c \
$(CANOPEN_SRC)/301/CO_fifo.c \
$(CANOPEN_SRC)/303/CO_LEDs.c \
$(CANOPEN_SRC)/304/CO_GFC.c \
$(CANOPEN_SRC)/304/CO_SRDO.c \
$(CANOPEN_SRC)/305/CO_LSSslave.c \
$(CANOPEN_SRC)/305/CO_LSSmaster.c \
$(CANOPEN_SRC)/309/CO_gateway_ascii.c \
$(CANOPEN_SRC)/extra/CO_trace.c \
$(CANOPEN_SRC)/CANopen.c \
$(APPL_SRC)/CO_OD.c \
$(DRV_SRC)/CO_main_basic.c
OBJS = $(SOURCES:%.c=%.o)
CC ?= gcc
OPT =
OPT += -DCO_VERSION_MAJOR=2
OPT += -DCO_SINGLE_THREAD
OPT += -g
#OPT += -Wextra -Wshadow -pedantic -fanalyzer
#OPT += -DCO_USE_GLOBALS
CFLAGS = -Wall $(OPT) $(INCLUDE_DIRS)
LDFLAGS =
LDFLAGS += -g
LDFLAGS += -pthread
#Options can be also passed via make: 'make OPT="-g" LDFLAGS="-pthread"'
.PHONY: all clean
all: clean $(LINK_TARGET)
clean:
rm -f $(OBJS) $(LINK_TARGET)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
$(LINK_TARGET): $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@