xref: /OK3568_Linux_fs/buildroot/package/rockchip/tee-user-app/extra_app/host/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_v2/lib/arm64/
16else
17OPTEE_CLIENT_LIB ?= ../../../../bin/optee_v2/lib/arm/
18endif
19
20CC		?= $(CROSS_COMPILE)gcc
21CPP		?= $(CROSS_COMPILE)cpp
22LD		?= $(CROSS_COMPILE)ld
23AR		?= $(CROSS_COMPILE)ar
24NM		?= $(CROSS_COMPILE)nm
25OBJCOPY		?= $(CROSS_COMPILE)objcopy
26OBJDUMP		?= $(CROSS_COMPILE)objdump
27READELF		?= $(CROSS_COMPILE)readelf
28
29
30SRC_PATH := .
31
32srcs := $(wildcard $(SRC_PATH)/*.c)
33
34objs 	:= $(patsubst %.c,$(O)/%.o, $(srcs))
35
36
37CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/public
38CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include
39CFLAGS += -I../../ta/extra_app/include
40# CFLAGS += -I./include
41CFLAGS += -Wall -Wcast-align  \
42	  -Werror-implicit-function-declaration -Wextra -Wfloat-equal \
43	  -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \
44	  -Wmissing-declarations -Wmissing-format-attribute \
45	  -Wmissing-include-dirs -Wmissing-noreturn \
46	  -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
47	  -Wshadow -Wstrict-prototypes -Wswitch-default \
48	  -Wwrite-strings \
49	  -Wno-missing-field-initializers -Wno-format-zero-length
50
51LDFLAGS += -L$(OPTEE_CLIENT_LIB)
52LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec  -lpthread
53
54
55.PHONY: extra_app
56extra_app: keybox_app
57
58keybox_app: $(objs)
59	@echo "  LD      $(O)/$@"
60	$(q)@$(CC) -o $(O)/$@ $+ $(LDFLAGS)
61	@echo "  OPTEE_CLIENT_LIB=$(OPTEE_CLIENT_LIB)"
62
63
64$(O)/%.o: $(CURDIR)/%.c
65	$(q)mkdir -p $(O)/
66	@echo '  CC      $<'
67	$(q)$(CC) $(CFLAGS) -c $< -o $@
68
69.PHONY: clean
70clean:
71	@echo '  CLEAN $(O)'
72	$(q)rm -f $(O)/keybox
73	$(q)$(foreach obj,$(objs), rm -f $(obj))
74