build.mk 1.62 KB
Newer Older
Jeroen Vreeken's avatar
Jeroen Vreeken committed
1
LIBDIR:=$(DIR)/lib
2
CLEAN += $(DIR)/lib/.libs
Jeroen Vreeken's avatar
Jeroen Vreeken committed
3

Jeroen Vreeken's avatar
Jeroen Vreeken committed
4
5
CTRL_BLOCKS :=
CTRL_BLOCK_LIBS :=
Jeroen Vreeken's avatar
Jeroen Vreeken committed
6
CTRL_TESTS :=
7
8
9
CTRL_TRIGGERS :=
CTRL_TRIGGER_LIBS :=

Jeroen Vreeken's avatar
Jeroen Vreeken committed
10

Jeroen Vreeken's avatar
Jeroen Vreeken committed
11
12
13
$(eval $(call SUBDIR,controller))
$(eval $(call SUBDIR,shell))
$(eval $(call SUBDIR,block))
14
$(eval $(call SUBDIR,trigger))
15
ifdef BUILD_ETHERCAT
Jeroen Vreeken's avatar
Jeroen Vreeken committed
16
$(eval $(call SUBDIR,ec))
17
endif
18
ifdef BUILD_TEST
Jeroen Vreeken's avatar
Jeroen Vreeken committed
19
$(eval $(call SUBDIR,test))
20
endif
21
ifdef BUILD_VESP
Jeroen Vreeken's avatar
Jeroen Vreeken committed
22
$(eval $(call SUBDIR,vesp))
23
24
endif
ifdef BUILD_AM335X
Jeroen Vreeken's avatar
Jeroen Vreeken committed
25
26
$(eval $(call SUBDIR,am335x))
endif
Jeroen Vreeken's avatar
Jeroen Vreeken committed
27
28
29
30
31

DT_CTRL_TARGETS += $(DIR)/dt_ctrl

DT_CTRL_SRCS := $(DIR)/dt_ctrl.c
DT_CTRL_OBJS := $(DT_CTRL_SRCS:.c=.o)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
32
33

, := ,
34
35
BLOCKS := $(addprefix -Wl$(,)-u -Wl$(,)block_,$(addsuffix _create_struct,$(CTRL_BLOCKS)))
BLOCKS += $(addprefix -Wl$(,)-u -Wl$(,)block_,$(addsuffix _create,$(CTRL_BLOCKS)))
Jeroen Vreeken's avatar
Jeroen Vreeken committed
36
BLOCKS += $(subst .la,,$(subst lib,-l,$(CTRL_BLOCK_LIBS)))
Jeroen Vreeken's avatar
Jeroen Vreeken committed
37

38
39
40
TRIGGERS := $(addprefix -Wl$(,)-u -Wl$(,)trigger_,$(addsuffix _create_struct,$(CTRL_TRIGGERS)))
TRIGGERS += $(subst .la,,$(subst lib,-l,$(CTRL_TRIGGER_LIBS)))

Jeroen Vreeken's avatar
Jeroen Vreeken committed
41
42
43
44
$(DIR)/dt_ctrl: \
	libcontroller.la \
	liblog.la \
	libshell.la \
45
46
	$(CTRL_BLOCK_LIBS) \
	$(CTRL_TRIGGER_LIBS)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
47
48
$(DIR)/dt_ctrl_CFLAGS += -Wall -O3
$(DIR)/dt_ctrl_LDFLAGS += \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
49
50
51
52
	-Wl,-E \
	-lcontroller \
	-llog \
	-lshell \
53
54
	$(BLOCKS) \
	$(TRIGGERS)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
55
56
$(DIR)/dt_ctrl: $(DT_CTRL_OBJS)

Jeroen Vreeken's avatar
Jeroen Vreeken committed
57
# Make test reports as part of the test target
Jeroen Vreeken's avatar
Jeroen Vreeken committed
58
59
60
61

DT_CTRL_TESTS := $(CTRL_TESTS)
DT_CTRL := $(DIR)/dt_ctrl

Jeroen Vreeken's avatar
Jeroen Vreeken committed
62
test: $(DIR)/test.output
Jeroen Vreeken's avatar
Jeroen Vreeken committed
63

Jeroen Vreeken's avatar
Jeroen Vreeken committed
64
65
66
67
68
69
$(DIR)/test.output: $(DT_CTRL_TESTS)

$(DT_CTRL_TESTS): $(DT_CTRL)

%.test.output: %.test.ctrl
	@echo "DT_CTRL $<"
70
	@$(DT_CTRL) $< >$@ || (rm $@ && false)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
71

Jeroen Vreeken's avatar
Jeroen Vreeken committed
72
73
74

SRCS += $(DT_CTRL_SRCS)
TARGETS += $(DT_CTRL_TARGETS)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
75
CLEAN += $(DT_CTRL_TARGETS) $(DT_CTRL_OBJS) $(DT_CTRL_TESTS)