1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# Get the dir of the ta-dev-kit, requires make version 3.81 or later
ta-dev-kit-dir := $(patsubst %/,%,$(abspath $(dir $(lastword $(MAKEFILE_LIST)))..))
.PHONY: all
all:
include $(ta-dev-kit-dir)/mk/conf.mk
binary := $(BINARY)
libname := $(LIBNAME)
ifneq ($(BINARY),)
ifneq ($(LIBNAME),)
$(error You can only specify one of BINARY or LIBNAME)
endif
else
ifeq ($(LIBNAME),)
$(error You must specify one of BINARY or LIBNAME)
endif
endif
ifneq ($O,)
out-dir := $O
else
out-dir := .
endif
ifneq ($V,1)
q := @
cmd-echo := true
cmd-echo-silent := echo
else
q :=
cmd-echo := echo
cmd-echo-silent := true
endif
ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
cmd-echo-silent := true
endif
else # make-3.8x
ifneq ($(findstring s, $(MAKEFLAGS)),)
cmd-echo-silent := true
endif
endif
cppflags$(sm) := $($(sm)-platform-cppflags) $(CPPFLAGS_$(sm))
aflags$(sm) := $($(sm)-platform-aflags)
cflags$(sm) := $($(sm)-platform-cflags) $(CFLAGS_$(sm))
CFG_TEE_TA_LOG_LEVEL ?= 2
cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL)
ifeq ($(CFG_TEE_TA_MALLOC_DEBUG),y)
# TAs will automatically use debug versions of the malloc() functions
# in libutils (malloc() will be re-defined as mdbg_malloc() etc.).
# mdbg_check() will also be visible.
cppflags$(sm) += -DENABLE_MDBG=1
endif
cppflags$(sm) += -I. -I$(ta-dev-kit-dir)/include
libdirs += $(ta-dev-kit-dir)/lib
libnames += utils utee mpa
libdeps += $(ta-dev-kit-dir)/lib/libutils.a
libdeps += $(ta-dev-kit-dir)/lib/libmpa.a
libdeps += $(ta-dev-kit-dir)/lib/libutee.a
include $(ta-dev-kit-dir)/mk/cleandirs.mk
.PHONY: clean
clean:
@$(cmd-echo-silent) ' CLEAN $(out-dir)'
${q}rm -f $(cleanfiles)
${q}dirs="$(call cleandirs-for-rmdir)"; if [ "$$dirs" ]; then $(RMDIR) $$dirs; fi
@$(cmd-echo-silent) ' CLEAN $(O)'
${q}if [ -d "$(O)" ]; then $(RMDIR) $(O); fi
subdirs = .
include $(ta-dev-kit-dir)/mk/subdir.mk
#the build target is ta
ifneq ($(binary),)
vpath %.c $(ta-dev-kit-dir)/src
srcs += user_ta_header.c
endif
include $(ta-dev-kit-dir)/mk/gcc.mk
include $(ta-dev-kit-dir)/mk/compile.mk
ifneq ($(binary),)
include $(ta-dev-kit-dir)/mk/link.mk
else
ifneq ($(libname),)
all: $(libname).a
cleanfiles += $(libname).a
$(libname).a: $(objs)
@echo ' AR $@'
$(q)rm -f $@ && $(AR$(sm)) rcs -o $@ $^
endif
endif
|