Makefile 1.79 KB
Newer Older
1
include build.mk
Jeroen Vreeken's avatar
Jeroen Vreeken committed
2

3
4
5
6
7
CFLAGS= -Wall -O3 \
	-I. \
	-Icontroller \
	-I../common/utils \
	-I../common/trace \
8
	-I../common/include \
9
	-Idt_azimuth -Idt_elevation -Iec -Ishell -Ilog
10
LDFLAGS= -lpthread -lrt -lm -Wl,-E -L../common/lib -L./lib
11
CFLAGS_SIM=-DUSE_AZ_SIM -DUSE_EL_SIM
Jeroen Vreeken's avatar
Jeroen Vreeken committed
12

13
14
15
16
OS= $(shell uname -s)
ifneq ($(OS), FreeBSD)
LDFLAGS+= -ldl
endif
Jeroen Vreeken's avatar
Jeroen Vreeken committed
17

18
19

dt_ctrl_LDFLAGS=`./controller/block_list.sh lib/*.a` \
20
21
	-lcontroller -lethercat -lsercos -llog -lshell \
	-ldt_azimuth -ldt_elevation
Jeroen Vreeken's avatar
Jeroen Vreeken committed
22

23
all: dt_ctrl \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
24
25
26
	test \
	controller

27
28
dt_ctrl: lib/libcontroller.la lib/libethercat.la lib/libsercos.la \
	lib/libdt_azimuth.la lib/libdt_elevation.la
Jeroen Vreeken's avatar
Jeroen Vreeken committed
29

Jeroen Vreeken's avatar
Jeroen Vreeken committed
30

Jeroen Vreeken's avatar
Jeroen Vreeken committed
31
dt_ctrl: dt_ctrl.o
Jeroen Vreeken's avatar
Jeroen Vreeken committed
32
33


34
test: lib/libcontroller.la lib/libethercat.la lib/liblog.la
Jeroen Vreeken's avatar
Jeroen Vreeken committed
35
	@echo " SUBDIR: $@"
36
	@$(MAKE) -C test
Jeroen Vreeken's avatar
Jeroen Vreeken committed
37

Jeroen Vreeken's avatar
Jeroen Vreeken committed
38
lib/libcontroller.la: lib/libshell.la lib
Jeroen Vreeken's avatar
Jeroen Vreeken committed
39
40
41
42
43

lib/libcontroller.la:
	@echo " SUBDIR: $@"
	@$(MAKE) -C controller

44
45
lib/libdt_azimuth.la: lib/libcontroller.la

Jeroen Vreeken's avatar
Jeroen Vreeken committed
46
lib/libdt_azimuth.la: lib
Jeroen Vreeken's avatar
Jeroen Vreeken committed
47
48
49
	@echo " SUBDIR: $@"
	@$(MAKE) -C dt_azimuth

50
51
lib/libdt_elevation.la: lib/libcontroller.la

Jeroen Vreeken's avatar
Jeroen Vreeken committed
52
lib/libdt_elevation.la: lib
Jeroen Vreeken's avatar
Jeroen Vreeken committed
53
54
55
	@echo " SUBDIR: $@"
	@$(MAKE) -C dt_elevation

56
57
lib/libethercat.la: lib/liblog.la lib/libshell.la lib/libcontroller.la
lib/libethercat.la: lib/libsercos.la
Jeroen Vreeken's avatar
Jeroen Vreeken committed
58

59
lib/libethercat.la: lib
Jeroen Vreeken's avatar
Jeroen Vreeken committed
60
61
62
	@echo " SUBDIR: $@"
	@$(MAKE) -C ec

63
64
65
66
67
68
lib/libsercos.la: lib/libcontroller.la

lib/libsercos.la:
	@echo " SUBDIR: $@"
	@$(MAKE) -C sercos

69
lib/libshell.la: lib/liblog.la lib
Jeroen Vreeken's avatar
Jeroen Vreeken committed
70
71
72
	@echo " SUBDIR: $@"
	@$(MAKE) -C shell

Jeroen Vreeken's avatar
Jeroen Vreeken committed
73
lib/liblog.la: lib
Jeroen Vreeken's avatar
Jeroen Vreeken committed
74
75
	@echo " SUBDIR: $@"
	@$(MAKE) -C log
Jeroen Vreeken's avatar
Jeroen Vreeken committed
76

Jeroen Vreeken's avatar
Jeroen Vreeken committed
77
78
79
lib:
	@mkdir lib

80
.PHONY: test
Jeroen Vreeken's avatar
Jeroen Vreeken committed
81
82

clean:
Jeroen Vreeken's avatar
Jeroen Vreeken committed
83
	rm -f *.o *.d *.a *.la *.lo lib/*
84
85
	rm -f dt_az dt_az_ctrl \
	    command_shell \
86
	    dt_ctrl
87
88
89
90
	$(MAKE) -C controller clean
	$(MAKE) -C dt_azimuth clean
	$(MAKE) -C dt_elevation clean
	$(MAKE) -C ec clean
91
	$(MAKE) -C sercos clean
92
93
94
	$(MAKE) -C test clean
	$(MAKE) -C shell clean
	$(MAKE) -C log clean