build.mk 1.53 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))
Jeroen Vreeken's avatar
Jeroen Vreeken committed
15
16
17
18
$(eval $(call SUBDIR,ec))
$(eval $(call SUBDIR,dt_elevation))
$(eval $(call SUBDIR,test))

Jeroen Vreeken's avatar
Jeroen Vreeken committed
19
20
21
ifneq (,$(findstring arm,$(HW)))
$(eval $(call SUBDIR,am335x))
endif
Jeroen Vreeken's avatar
Jeroen Vreeken committed
22
23
24
25
26

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
27
28

, := ,
29
30
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
31
BLOCKS += $(subst .la,,$(subst lib,-l,$(CTRL_BLOCK_LIBS)))
Jeroen Vreeken's avatar
Jeroen Vreeken committed
32

33
34
35
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
36
37
38
39
$(DIR)/dt_ctrl: \
	libcontroller.la \
	liblog.la \
	libshell.la \
40
41
	$(CTRL_BLOCK_LIBS) \
	$(CTRL_TRIGGER_LIBS)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
42
43
$(DIR)/dt_ctrl_CFLAGS += -Wall -O3
$(DIR)/dt_ctrl_LDFLAGS += \
Jeroen Vreeken's avatar
Jeroen Vreeken committed
44
45
46
47
	-Wl,-E \
	-lcontroller \
	-llog \
	-lshell \
48
49
	$(BLOCKS) \
	$(TRIGGERS)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
50
51
$(DIR)/dt_ctrl: $(DT_CTRL_OBJS)

Jeroen Vreeken's avatar
Jeroen Vreeken committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
test: dt_ctrl_test

DT_CTRL_TESTS := $(CTRL_TESTS)
DT_CTRL := $(DIR)/dt_ctrl
define DT_CTRl_TEST
	$(DT_CTRL) $1

endef

dt_ctrl_test: $(DIR)/dt_ctrl
dt_ctrl_test:
	echo tests: $(DT_CTRL_TESTS)
	$(foreach TESTITEM,$(DT_CTRL_TESTS),$(call DT_CTRl_TEST,$(TESTITEM)))

Jeroen Vreeken's avatar
Jeroen Vreeken committed
66
67
68
69

SRCS += $(DT_CTRL_SRCS)
TARGETS += $(DT_CTRL_TARGETS)
CLEAN += $(DT_CTRL_TARGETS) $(DT_CTRL_OBJS)