hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
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
# Normally this makefile shouldn't be called directly and we expect the output
# path to be on a certain location to fit together with the other OP-TEE
# gits and helper scripts.
ifeq ($O,)
$(error output path should be specified when calling this makefile)
endif
 
include $(TA_DEV_KIT_DIR)/host_include/conf.mk
 
# By default we expect optee_client exported folder to be on a certain relative
# path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will
# be used instead.
OPTEE_CLIENT_EXPORT ?= ../../client_export/
ifeq "$(COMPILE_NS_USER)" "64"
OPTEE_CLIENT_LIB ?= ../../../../bin/optee_v1/lib/arm64/
else
OPTEE_CLIENT_LIB ?= ../../../../bin/optee_v1/lib/arm/
endif
 
 
CC        ?= $(CROSS_COMPILE)gcc
CPP        ?= $(CROSS_COMPILE)cpp
LD        ?= $(CROSS_COMPILE)ld
AR        ?= $(CROSS_COMPILE)ar
NM        ?= $(CROSS_COMPILE)nm
OBJCOPY        ?= $(CROSS_COMPILE)objcopy
OBJDUMP        ?= $(CROSS_COMPILE)objdump
READELF        ?= $(CROSS_COMPILE)readelf
 
 
SRC_PATH := .
 
srcs := $(wildcard $(SRC_PATH)/*.c)
 
objs     := $(patsubst %.c,$(O)/%.o, $(srcs))
 
 
 
CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/public
CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
CFLAGS += -I../../ta/rk_test/include
 
CFLAGS += -I./include
CFLAGS += -Wall -Wcast-align  \
     -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
     -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
     -Wmissing-declarations -Wmissing-format-attribute \
     -Wmissing-include-dirs -Wmissing-noreturn \
     -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
     -Wshadow -Wstrict-prototypes -Wswitch-default \
     -Wwrite-strings \
     -Wno-missing-field-initializers -Wno-format-zero-length
 
LDFLAGS += -L$(OPTEE_CLIENT_LIB)
LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
 
 
.PHONY: all
all: rk_test
 
rk_test: rktest
 
rktest: $(objs)
   @echo "  LD      $(O)/$@"
   $(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
   @echo "  OPTEE_CLIENT_LIB=$(OPTEE_CLIENT_LIB)"
 
 
$(O)/%.o: $(CURDIR)/%.c
   $(q)mkdir -p $(O)/
   @echo '  CC      $<'
   $(q)$(CC) $(CFLAGS) -c $< -o $@
 
.PHONY: clean
clean:
   @echo '  CLEAN $(O)'
   $(q)rm -f $(O)/rktest
   $(q)$(foreach obj,$(objs), rm -f $(obj))