Makefile 1.16 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 \
34
	block_beckhoff_ax5xxx.c \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
35
	block_stoeber.c
Jeroen Vreeken's avatar
Jeroen Vreeken committed
36

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

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

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

Jeroen Vreeken's avatar
Jeroen Vreeken committed
45
46
47
48
49
50
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
51
ec_enum_LDFLAGS=-lethercat
Jeroen Vreeken's avatar
Jeroen Vreeken committed
52
ec_enum: ec_enum.o
Jeroen Vreeken's avatar
Jeroen Vreeken committed
53
54
55
56

ec_enum.o: esc_id.h

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

include ../build.mk