Makefile 1.13 KB
Newer Older
Jeroen Vreeken's avatar
Jeroen Vreeken committed
1

2
3
OS= $(shell uname -s)

Jeroen Vreeken's avatar
Jeroen Vreeken committed
4
5
CFLAGS= -Wall -O3 \
	-I. -I.. -I../log -I../controller
6
7
8
9
10
11
12
LDFLAGS= -lpthread -lrt -lm -L../lib

ifneq ($(OS), FreeBSD)
LDFLAGS+= -ldl
endif


13
LIBSRCS= ec.c \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
14
15
	esc.c esc_coe.c esc_esi.c esc_mailbox.c esc_device.c esc_watchdog.c \
	esc_dc.c canopen.c ec_stoeber.c block_ec.c
16
17
18
19
20
21

ifeq ($(OS), FreeBSD)
LIBSRCS+= eth_bsd.c
else
LIBSRCS+= eth_linux.c
endif
Jeroen Vreeken's avatar
Jeroen Vreeken committed
22

Jeroen Vreeken's avatar
Jeroen Vreeken committed
23
LIBOBJS= $(LIBSRCS:.c=.lo)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
24
25
26
27
28
29
30
31

BLOCKSRCS= \
	block_beckhoff_el1xxx.c \
	block_beckhoff_el2xxx.c \
	block_beckhoff_el2502.c \
	block_beckhoff_el3xxx.c \
	block_beckhoff_el4xxx.c \
	block_beckhoff_el5001.c \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
32
	block_beckhoff_el5101.c \
33
	block_beckhoff_el7031.c \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
34
	block_stoeber.c
Jeroen Vreeken's avatar
Jeroen Vreeken committed
35

Jeroen Vreeken's avatar
Jeroen Vreeken committed
36
BLOCKS=$(BLOCKSRCS:.c=.lo)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
37
38
SRCS=$(BLOCKSRCS) $(LIBSRCS)

39
all: ec_test.o libethercat.la_install ec_enum
Jeroen Vreeken's avatar
Jeroen Vreeken committed
40

Jeroen Vreeken's avatar
Jeroen Vreeken committed
41
42
libethercat.la_LDFLAGS=-rpath ${CURDIR}/../lib -lcontroller
libethercat.la: $(LIBOBJS) $(BLOCKS)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
43

Jeroen Vreeken's avatar
Jeroen Vreeken committed
44
45
46
47
48
49
libethercat.la_install: libethercat.la
	@echo "CP $^ to libdir"
	@${LIBTOOL} --quiet --mode=install install libethercat.la ${CURDIR}/../lib

ec_enum: libethercat.la_install

Jeroen Vreeken's avatar
Jeroen Vreeken committed
50
ec_enum_LDFLAGS=-lethercat
Jeroen Vreeken's avatar
Jeroen Vreeken committed
51
ec_enum: ec_enum.o
Jeroen Vreeken's avatar
Jeroen Vreeken committed
52
53
54
55

ec_enum.o: esc_id.h

clean:
56
	rm -rf *.o *.a *.la *.lo .libs *.d ec_enum
Jeroen Vreeken's avatar
Jeroen Vreeken committed
57
58

include ../build.mk