1# Makefile for CANopenNode, basic compile with no CAN device.
2
3
4STACKDRV_SRC =  stack/drvTemplate
5STACK_SRC =     stack
6CANOPEN_SRC =   .
7APPL_SRC =      example
8
9
10LINK_TARGET  =  canopennode
11
12
13INCLUDE_DIRS = -I$(STACKDRV_SRC) \
14               -I$(STACK_SRC)    \
15               -I$(CANOPEN_SRC)  \
16               -I$(APPL_SRC)
17
18
19SOURCES =       $(STACKDRV_SRC)/CO_driver.c     \
20                $(STACKDRV_SRC)/eeprom.c        \
21                $(STACK_SRC)/crc16-ccitt.c      \
22                $(STACK_SRC)/CO_SDO.c           \
23                $(STACK_SRC)/CO_Emergency.c     \
24                $(STACK_SRC)/CO_NMT_Heartbeat.c \
25                $(STACK_SRC)/CO_SYNC.c          \
26                $(STACK_SRC)/CO_TIME.c          \
27                $(STACK_SRC)/CO_PDO.c           \
28                $(STACK_SRC)/CO_HBconsumer.c    \
29                $(STACK_SRC)/CO_SDOmaster.c     \
30                $(STACK_SRC)/CO_LSSmaster.c     \
31                $(STACK_SRC)/CO_LSSslave.c      \
32                $(STACK_SRC)/CO_trace.c         \
33                $(CANOPEN_SRC)/CANopen.c        \
34                $(APPL_SRC)/CO_OD.c             \
35                $(APPL_SRC)/main.c
36
37
38OBJS = $(SOURCES:%.c=%.o)
39CC = gcc
40CFLAGS = -Wall $(INCLUDE_DIRS)
41LDFLAGS =
42
43
44.PHONY: all clean
45
46all: clean $(LINK_TARGET)
47
48clean:
49	rm -f $(OBJS) $(LINK_TARGET)
50
51%.o: %.c
52	$(CC) $(CFLAGS) -c $< -o $@
53
54$(LINK_TARGET): $(OBJS)
55	$(CC) $(LDFLAGS) $^ -o $@
56