xref: /OK3568_Linux_fs/external/security/rk_tee_user/v1/host/rk_test/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1# Normally this makefile shouldn't be called directly and we expect the output
2# path to be on a certain location to fit together with the other OP-TEE
3# gits and helper scripts.
4ifeq ($O,)
5$(error output path should be specified when calling this makefile)
6endif
7
8include $(TA_DEV_KIT_DIR)/host_include/conf.mk
9
10# By default we expect optee_client exported folder to be on a certain relative
11# path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will
12# be used instead.
13OPTEE_CLIENT_EXPORT ?= ../../client_export/
14ifeq "$(COMPILE_NS_USER)" "64"
15OPTEE_CLIENT_LIB ?= ../../../../bin/optee_v1/lib/arm64/
16else
17OPTEE_CLIENT_LIB ?= ../../../../bin/optee_v1/lib/arm/
18endif
19
20
21CC		?= $(CROSS_COMPILE)gcc
22CPP		?= $(CROSS_COMPILE)cpp
23LD		?= $(CROSS_COMPILE)ld
24AR		?= $(CROSS_COMPILE)ar
25NM		?= $(CROSS_COMPILE)nm
26OBJCOPY		?= $(CROSS_COMPILE)objcopy
27OBJDUMP		?= $(CROSS_COMPILE)objdump
28READELF		?= $(CROSS_COMPILE)readelf
29
30
31SRC_PATH := .
32
33srcs := $(wildcard $(SRC_PATH)/*.c)
34
35objs 	:= $(patsubst %.c,$(O)/%.o, $(srcs))
36
37
38
39CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/public
40CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
41CFLAGS += -I../../ta/rk_test/include
42
43CFLAGS += -I./include
44CFLAGS += -Wall -Wcast-align  \
45	  -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
46	  -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
47	  -Wmissing-declarations -Wmissing-format-attribute \
48	  -Wmissing-include-dirs -Wmissing-noreturn \
49	  -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
50	  -Wshadow -Wstrict-prototypes -Wswitch-default \
51	  -Wwrite-strings \
52	  -Wno-missing-field-initializers -Wno-format-zero-length
53
54LDFLAGS += -L$(OPTEE_CLIENT_LIB)
55LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec
56
57
58.PHONY: all
59all: rk_test
60
61rk_test: rktest
62
63rktest: $(objs)
64	@echo "  LD      $(O)/$@"
65	$(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
66	@echo "  OPTEE_CLIENT_LIB=$(OPTEE_CLIENT_LIB)"
67
68
69$(O)/%.o: $(CURDIR)/%.c
70	$(q)mkdir -p $(O)/
71	@echo '  CC      $<'
72	$(q)$(CC) $(CFLAGS) -c $< -o $@
73
74.PHONY: clean
75clean:
76	@echo '  CLEAN $(O)'
77	$(q)rm -f $(O)/rktest
78	$(q)$(foreach obj,$(objs), rm -f $(obj))
79