Makefile 1.25 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
13
14
15
16
17
18
19
LDFLAGS= -lpthread -lrt -lm -L../lib

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


LIBSRCS= ec.c esc.c canopen.c ec_stoeber.c block_ec.c eth_linux.c

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

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

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
30
	block_beckhoff_el5101.c \
31
	block_beckhoff_el7031.c \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
32
	block_stoeber.c
Jeroen Vreeken's avatar
Jeroen Vreeken committed
33

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

Jeroen Vreeken's avatar
Jeroen Vreeken committed
37
all: ec_test.o libethercat.la_install ec_enum ec_el_test
Jeroen Vreeken's avatar
Jeroen Vreeken committed
38

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

Jeroen Vreeken's avatar
Jeroen Vreeken committed
42
43
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

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

ec_enum.o: esc_id.h

53
ec_el_test_LDFLAGS= `../controller/block_list.sh ../lib/lib*.a` -Wl,-E -lcontroller -lethercat -llog
54
ec_el_test: ec_el_test.o libethercat.la_install
Jeroen Vreeken's avatar
Jeroen Vreeken committed
55
56

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

include ../build.mk