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

2
3
OS= $(shell uname -s)

4
CFLAGS= -Wall -O3 -Werror \
5
	-I. -I.. -I../../common/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
	esc.c esc_coe.c esc_esi.c esc_mailbox.c esc_device.c esc_watchdog.c \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
15
	esc_dc.c canopen.c esc_sm.c esc_fmmu.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
35
36
	block_stoeber.c \
	block_ec.c \
	block_ec_sim.c
Jeroen Vreeken's avatar
Jeroen Vreeken committed
37

38
39
#	block_beckhoff_ax5xxx.c \

Jeroen Vreeken's avatar
Jeroen Vreeken committed
40
BLOCKS=$(BLOCKSRCS:.c=.lo)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
41
42
SRCS=$(BLOCKSRCS) $(LIBSRCS)

43
all: libethercat.la_install ec_enum
Jeroen Vreeken's avatar
Jeroen Vreeken committed
44

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

Jeroen Vreeken's avatar
Jeroen Vreeken committed
48
49
50
51
52
53
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
54
ec_enum_LDFLAGS=-lethercat
55
56
57
ifneq ($(OS), FreeBSD)
ec_enum_LDFLAGS+= -ldl
endif
Jeroen Vreeken's avatar
Jeroen Vreeken committed
58
ec_enum: ec_enum.o
Jeroen Vreeken's avatar
Jeroen Vreeken committed
59
60
61
62

ec_enum.o: esc_id.h

clean:
63
	rm -rf *.o *.a *.la *.lo .libs *.d ec_enum
Jeroen Vreeken's avatar
Jeroen Vreeken committed
64
65

include ../build.mk